Sunday, April 12, 2009

Fast Normals .. Or Not

Well, I spoke too soon about the fast normals. They almost work. The normals do not line up exactly at the corners of the cube so there are visible seams. I spent some time trying to come up with some extra rotation to compensate for this distortion but was not successful and have decided to revert to calculating the normals the old way, which is by calculating triangle normals and then smoothing.

I believe to fix the cube to sphere mapping you need to rotate the normals about their vertical axis as they approach the corners, but I have not come up with a good method yet, if anyone has any ideas I'd love to hear them.

Normal Map Error Image

(click the above image to see the normal map corner distortion)

1 comment:

Filipe said...

Hi! Have you solved this yet? I think your patches are the problem. Your sobel kernel is probably sampling vertices which belong to the adjacent tile, hence returning undefined values and messing up your normals.

This should only happen at one end of each patch. I assume you're using 33x33 to extend each patch to the beginning of the next one.

BTW, you should have this exact same problem with your dot product CPU approach. How did you solve that one?