DirectX Sphere Texture Coordinates

Posted by Rushyo on Stack Overflow See other posts from Stack Overflow or by Rushyo
Published on 2009-12-20T13:55:04Z Indexed on 2010/04/23 16:43 UTC
Read the original article Hit count: 388

Filed under:
|
|
|
|

I have a sphere with per-vertex normals and I'm trying to derive the texture coordinates for the object using the algorithm:

U = Asin(Norm.X) / PI + 0.5
V = Asin(Norm.Y) / PI + 0.5

With a polka dot texture, I get:

Misaligned textures

Here's the same object without the texture applied:

No textures

The issue I'm particuarly looking at (I know there's a few) is the misalignment of the textures.

I am inclined to believe the issue resides in my use of those algorithms, as the specular highlighting (which doesn't utilise any textures but does rely on the normals being correct) appears to have no artifacts.

Any ideas?

© Stack Overflow or respective owner

Related posts about hlsl

Related posts about textures