Sign in to follow this  
EnochDagor

Sphere Texture Mapping Issue

Recommended Posts

Ok, I have this problem. I have a sphere that I generate in run-time... I use the following formula: phi = Acos(pn.Normal.z) pnt.Tv = (phi / PI) u = Acos(Max(Min(pnt.Normal.y / Sin(phi), 1.0), -1.0)) / (2.0 * PI) If pnt.Normal.x > 0 Then pnt.Tu = u Else pnt.Tu = 1 - u End If Now, this sphere works perfectly in Fixed Function. It also works perfectly when running in a shader... but only on nVidia cards. On an ATI card, I get a horrible seam at the 0-1 border. I have set Wrap0 = WrapCoordinates.Zero which fixed the problem on nVidia, but the problem still exists on ATI. Here is an example of the Fixed Function image that shows it without normal mapping, etc... and without the seam. No Normal Map, No Seam Here is the image with the ATI seam bug: Normal Map with Seam Let me know what I am missing. The next step would be to make a sphere mesh by hand to see if it resolves the problem. Was hoping not to resort to that. Enoch Dagor Lead Programmer Dark Sky Entertainment Beyond Protocol

Share this post


Link to post
Share on other sites
I'd suggest doing a single frame capture in PIX to find out what's going on.

It might also be worth trying the reference rasterizer to see if it's a driver bug, and if so which card is doing the right thing.

You could also try making use of frac() in the pixel shader to wrap the UVs there.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this