Baking tangent space normal maps
Members - Reputation: 513
Posted 05 September 2012 - 02:27 AM
In theory this is working. I transform the final world space normal that is usually used for shading (normal mapping + some optional normal trickery) into the calulated tangent space.
The problem is, that the tangent/bitangents sometimes "jump" between neighboring triangles although the mesh normals are smooth. This looks bad when the baked normal map is used later.
To illustrate my problem I have attached images that show the world space normal, the tangent, and the tangent space normal. While the world space normals are smooth, the tangent space normals are not. Especially on the left side of that image.
World space normals
Tangent space normals
Any ideas how I could generate a smooth normal map?
Crossbones+ - Reputation: 4972
Posted 05 September 2012 - 03:51 AM
The problem is, that normal/tangent/bitangents costruct a space which depends on the uv coords of the texture. If you always want to keep the classic normal (which points away from the surface), then your tangent spaces will flip the handness sometimes (handness= right hand or left hand coordination system ). This is very annoying and you need either to flip the normal to correct the handness or you need to store the handness and correct it on-the-fly.
The problem is, that the tangent/bitangents sometimes "jump" between neighboring triangles although the mesh normals are smooth.
Best example are mirrored textures, the tangent space flips at the mirror-edge, but the vertices can either save one or the other tangent space. In this case you need to split the vertex to get it right. It is similar to uv-splits.
Edited by Ashaman73, 05 September 2012 - 03:54 AM.
My game: Gnoblins
Developer journal about Gnoblins
Small goodies: Simple alpha transparency in deferred shader