#### Archived

This topic is now archived and is closed to further replies.

# Sphere Texture mapping

This topic is 6066 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Dear All, I''m trying to texture map a sphere. I got a equation off this site(http://astronomy.swin.edu.au/pbourke/texture/spheremap/), that as far as I can tell is correct(works out exactly the same as on the site when I do the problem). However, when I use the code, there is a ring from the top of the sphere to the bottom, and the top and bottom are blank. Here is my code: texturev = acos(sphere[i].z) / PI ; if (normal.y >= 0) textureu[i] = acos(sphere[i].x/(sin(PI*(texturev[i])))) / TWOPI; else textureu[i]= (PI + acos(sphere[i].x/(sin(PI*(texturev[i]))))) / TWOPI; Anyone see what I''m doing wrong???? Thanks, Jesse www.laeuchli.com/jesse/

##### Share on other sites
Well, it took me quite some time to understand that code, but as it seems to me, it splits up the sphere into two parts (the if/else part) along the textureu coordinate. This way, the texture is split in the middle. The ring seems quite normal for me, then. If I get the code right, your texture must be similar on the left side and the left half, and on the right side and the right half. If you paint a 128x256 texture and then paste a copy of it right to it, the ring should disappear. Maybe it could also work if you change the else clause to:
textureu = (TWOPI - acos(sphere[i]......
And then only make the left and the right part of your texture the same.
But as what you said about the top and the bottom. What does your texture look like? The algorithm uses the _whole_ texture space for texturing. Dont just draw a sphere in your texture, you must fill the whole texture.

1. 1
2. 2
3. 3
4. 4
Rutin
17
5. 5

• 11
• 37
• 12
• 12
• 11
• ### Forum Statistics

• Total Topics
631413
• Total Posts
2999945
×