Jump to content
  • Advertisement
Sign in to follow this  

Precision errors when calculating normal map for planet

This topic is 830 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You can see I'm calculating a normal map for a sphere (planet) in world space.. all looks good, except towards the poles there are some grey pixels caused by I assume lack of precision or something... I'm doing this on CPU using floats
given three points on an ideal sphere, I normalize to a given radius and add the appropriate precalulated heightmap value... 
where the points represent an arbitrary point wpos and its two neighbors... vx, vy, vz are the heightmap values for those points..I multiply by 1000 and then add the heightmap value to lower the overall difference between the heightmap values... and thus making the normal less strong;   
then simply:
As you can see in the picture, all seems to work fine except for the poles... seems there isn't enough precision (or something)  to handle this area... any suggestions?


Share this post

Link to post
Share on other sites
With the parametrization you have used, the samples at the poles are very close together. Try using doubles for the computation, but even that might not fix the very last line, because all those points map to the same point on the pole and you are then looking at degenerate triangles.

A clean solution would be to use a cubemap instead of spherical coordinates.

Share this post

Link to post
Share on other sites

You are right about the sampling distance being too close.. when I tried increasing the sampling distance near the poles it looks better.. though its hard to get it exactly right...


Yes a cubemap is probably better..although the poles aren't so important as they will be flatter... I can fix the normal in the pixel shaders...

Still I will think about a cubemap...




Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!