PDA

View Full Version : Spherical texture coords along the axis



RobertCWebb
05-15-2012, 12:44 AM
Hi,

I'm using a spherical texture mapping, but not sure of the best approach for vertices which lie along the axis of the sphere used for mapping. For such a point the U component of the texture UV coord is undefined.

Ideally I would use a degenerate quad here, duplicating the vertex on the axis, once with the U coord of the previous vertex in the triangle, and once with the U coord of the next vertex. This would ensure that the texture coords interpolate nicely even very close to the axis. Unfortunately most (all?) OpenGL implementations just split the quad into two triangles anyway.

So the best I can do is average the U coord from the other two vertices in the triangle for the vertex on the axis. Problem is that there are always wedges of texture left out at the apex of the mapping, so there's a noticeable split along edges heading to vertices on the axis. If you looked at the triangles mapped into image space, you would see a jagged outline at the top, where triangles reach up to the top of the image, but wedges are missing near the top (parts of the image that don't map onto any triangle).

I guess I can subdivide these triangles for better results, but these missing wedges will always be there. Is this my only approach?

Thanks,
Rob.