texture coordinates for sphere mesh
category: code [glöplog]
hello,
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:
http://www.panoramio.com/photo/19699699
thanks a lot in advance!
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:
http://www.panoramio.com/photo/19699699
thanks a lot in advance!
Try cubemapping with nothing on the top or bottom.
Or simply convert the sphere to cylindrical coordinates and hope everything works on the poles.
http://en.wikipedia.org/wiki/Map_projection
That has reminded me of http://en.wikipedia.org/wiki/Hugin_%28software%29.
here's one take: http://sol.gfxile.net/sphere/index.html
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? :)
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'.
what xernobyl said.
something like:
something like:
Code:
vert.u = atan2( vert.x, vert.z );
vert.v = atan2( vert.y, sqrt( vert.x*vert.x+vert.z*vert.z ) );