Textures.AHH!!!

Started by
0 comments, last by laeuchli 24 years, 5 months ago
Hi,I have a texture, And I would like to map it to a sphere. How would I do this. I don't understand textures very well as yet. The way I see it is you map a square texture onto triangles. How could I do this on a sphere with tons of triangles???Please help.
Jesse
Advertisement
We have a square texture. We can view it as a 2D plane, with the upper left corner having coordinates 0,0, and the bottom right having 1,1. When talking about textures, coordinates using aren't called x,y but rather u,v.

When generating the sphere, we also generate coordinates for it. As we move from the north pole of the sphere to the south pole, our v coordinate goes from 0 to 1. When we move from one side of the sphere, and wrapping around to the other side, our u coordinate also goes from 0 to 1.

If you still don't understand, I can send you some code that generates a sphere with texture coordinates, just send me an e-mail (it's in my profile.)

This topic is closed to new replies.

Advertisement