| | |
Texture mapping for sphere!
![]() |
•
•
Join Date: Sep 2007
Posts: 3
Reputation:
Solved Threads: 0
I just study directx9 for a few months by myself,and i've been puzzled by a problem that is how to set texture for a sphere for a long time.i want to create an real earth like that of nasa world wind.In fact,i have create an earth,but some coordinate of the texture is wrong,i guess i have used a wrong formula. I hope you could help me! Thank you !
well,i use directx9.0 and language is c#(2003).
well,i use directx9.0 and language is c#(2003).
How are you drawing the sphere; are you generating the vertices and texture coordinates manually? What is the projection method of the world texture you're using? A projection like this is easy to map: ( http://arstechnica.com/reviews/4q00/...h-map-huge.jpg ), there are other projection types though.. Some of them are easy, some of them not so easy.
You say you're having some problems with some of the coords, that implies to me that you've got it working for the most part, what exactly are the problems though? Is it mostly textured correctly, but with one line of faces where the texture seems really dense ( possibly across the point where the texture joins between 0 and 1 where it 'should' horizontally wrap in texture space )...? I had that problem myself for a while, in OpenGL. Turns out it was because I was re-using point structures, where the vertex would be shared but the texcoord isn't always shared, and that was causing the texture to wrap between 1-dx and 0... which meant I got a whole 0 to ~1 texture segment, backwards, within one column of faces... Easy to solve; double up the last column of vertices so that 1-dx spans to 1; or treat every compound point as unique..
Anyway, be a bit more specific, and I can try and be more helpful.
You say you're having some problems with some of the coords, that implies to me that you've got it working for the most part, what exactly are the problems though? Is it mostly textured correctly, but with one line of faces where the texture seems really dense ( possibly across the point where the texture joins between 0 and 1 where it 'should' horizontally wrap in texture space )...? I had that problem myself for a while, in OpenGL. Turns out it was because I was re-using point structures, where the vertex would be shared but the texcoord isn't always shared, and that was causing the texture to wrap between 1-dx and 0... which meant I got a whole 0 to ~1 texture segment, backwards, within one column of faces... Easy to solve; double up the last column of vertices so that 1-dx spans to 1; or treat every compound point as unique..
Anyway, be a bit more specific, and I can try and be more helpful.
Last edited by MattEvans; Sep 26th, 2007 at 6:46 am.
Plato forgot the nullahedron..
•
•
Join Date: Sep 2007
Posts: 3
Reputation:
Solved Threads: 0
MattEvans,thank you for your reply.
for In fact ,i used two methods to draw the sphere.First I generate vertices and texture coordinates manually,but i find the coordinate is wrong.then i used mesh to draw sphere but use the same formula to generate the texture coordinate,and the problem still happen.so i think the formula that is used to create the texture coordinate is wrong.
for your sencond question :some part of the texture coordinate is right,but when i rotate the sphere ,more and more part of my texture coordinate is wrong,i don't know why.
for In fact ,i used two methods to draw the sphere.First I generate vertices and texture coordinates manually,but i find the coordinate is wrong.then i used mesh to draw sphere but use the same formula to generate the texture coordinate,and the problem still happen.so i think the formula that is used to create the texture coordinate is wrong.
for your sencond question :some part of the texture coordinate is right,but when i rotate the sphere ,more and more part of my texture coordinate is wrong,i don't know why.
•
•
Join Date: Sep 2007
Posts: 3
Reputation:
Solved Threads: 0
MattEvans,thank you for your reply.
For your first question :In fact ,i used two methods to draw the sphere.First I generate vertices and texture coordinates manually,but i find the coordinate is wrong.then i used mesh to draw sphere but use the same formula to generate the texture coordinate,and the problem still happen.so i think the formula that is used to create the texture coordinate is wrong.
For your second question :some part of the texture coordinate is right,but when i rotate the sphere ,more and more part of my texture coordinate is wrong,i don't know why.
well,i want to paste my picture,but i don't know how to,so if you have an email address,i'll send you!
For your first question :In fact ,i used two methods to draw the sphere.First I generate vertices and texture coordinates manually,but i find the coordinate is wrong.then i used mesh to draw sphere but use the same formula to generate the texture coordinate,and the problem still happen.so i think the formula that is used to create the texture coordinate is wrong.
For your second question :some part of the texture coordinate is right,but when i rotate the sphere ,more and more part of my texture coordinate is wrong,i don't know why.
well,i want to paste my picture,but i don't know how to,so if you have an email address,i'll send you!
![]() |
Similar Threads
- New Game Announcement (Game Development)
- Convert mouse position to Texture position on ball (Game Development)
- Computer Science (IT Professionals' Lounge)
- DOS Graphics (Game Development)
- recommendations 4 a 3D graphics prog? (Graphics and Multimedia)
Other Threads in the Game Development Forum
- Previous Thread: How to make gunbound
- Next Thread: Ogre
| Thread Tools | Search this Thread |
3d advertising ai algorithm ban c++ cambridge camera censorship china competition console development engine fov fpx game gamer games gaming gauntanamo government idaho in-gameadvertisement intellectualproperty laracroft live manhunt math mathematics matrix mercenaries microsoft mmorpg modded msn naked news nintendo obama palin physics pirate playstation politics projection ps3 rpg search software sony stephenhawking stocks studio technology terrorism tombraider uk videogame web wii world-of-warcraft xbox xbox-live xbox360






