Go to bottom

texture coordinates for sphere mesh

category: code [glöplog]

i am looking for an algorithm that generates texture coordinates for a sphere mesh so that it fits a spherical panorama texture like this one:


thanks a lot in advance!
added on the 2010-11-02 19:44:44 by zatom zatom
Try cubemapping with nothing on the top or bottom.
added on the 2010-11-02 19:57:04 by xernobyl xernobyl
Or simply convert the sphere to cylindrical coordinates and hope everything works on the poles.
added on the 2010-11-02 19:58:09 by xernobyl xernobyl
If you want to aproximate a sphere with a radius of 1, shouldn't you use a triangle center of 1, instead of vertex distance? :)
added on the 2010-11-03 13:32:59 by xernobyl xernobyl
Cylindrical coordinates are probably the best choice. But you always will end up with bogus texturing on the poles since the triangles at the edge can barely (if NOT) cover the whole area of the texture. Qualitywise You should do cube mapping cause it doesn't have any noticeable side effects. Even tho it needs to convert the texture itself. Which can be 'fun'.
added on the 2010-11-03 13:57:09 by yumeji yumeji
what xernobyl said.
something like:
Code: vert.u = atan2( vert.x, vert.z ); vert.v = atan2( vert.y, sqrt( vert.x*vert.x+vert.z*vert.z ) );
added on the 2010-11-03 17:45:38 by the_Ye-Ti the_Ye-Ti


Go to top