Hello!
As some of you might know, I'm working on a procedural planet experiment in WebGL.
I would like to ask a few questions on normal mapping, about in which space it's best to calculate the normal map for better precision. I've noticed a lot of people run into precision problems because they calculate the normal map in either world space or object space. I know it's probably best to do it in tangent space, but that's where I get confused.
Currently, I'm generating a position map for each patch, which is basically the height map in the planet's object space (assuming the planet is always located at (0, 0, 0)). I'm aware that I will lose a lot of precision that way, so I'm trying to find a better solution.
I've found one neat solution from Acko's blog,
http://acko.net/blog/making-worlds-3-thats-no-moon/The source code behind the normal map shader:
https://github.com/unconed/NFSpace/blob/master/Resources/Media/Planet/Materials/normalMapper_FP.glslThe normal map is basically calculated in tangent space using Jacobian matrix. I think I understand most of the math explanation but the implementation part looks confusing, specifically the face transforms and the two coordinate systems, xy and st.
I would love to hear from others on how they solved generating the height map in tangent space. I've seen so many people say it's really hard because of seams between cube faces. Is it really that problematic?
Thanks!