Tangent Space Normal Mapping

I understand tangent normal mapping in principle but have hit a mental block applying it in my model. The problem that I can't seem to figure out is how to resolve the issue when I have one vertex that is shared by multiple faces. The tangents for one face may not be the tangent for the adjacent face. I consider my normal maps "truth" so an incorrect tangent space would introduce errors in the shading. Techniques used to soften normals such as smoothing groups would introduce small, but nonzero errors.
 
Normally the tangent space vectors are going to get interpolated across the faces anyway. The hardware will do that by nature. And you'll get specific tangent/normal/binormal for each pixel which will all be slightly different (and generally need to be renormalized per pixel). The vertex-level tangent space vectors are the sources of this interpolation so you just have an average per vertex. The same way vertex normals are averages of the face normals, you do the same with tangents and binormals (which should really be a bitangent, but whatever).

However, if you have hard sudden changes from one face to the next (e.g. UV mirroring), then it's best to duplicate vertices -- otherwise, you'll get some iffy results on that separating set of faces.
 
From inspection it appears that normal maps in object space are the way to go. I don't see any negatives of object space normal maps such as interpolation errors. It's pretty much WYSIWYG and it basically preprocesses the steps that would normally be done on the pixel shader. The downside is that it will probably take at least 64 bit floating point textures to store the normal instead of regular RGB8. The alpha channel isn't wasted it can store something special like a specular map. I'm not sure what the implications are in terms of bandwith and memory or if DXT can mitigate.

I suspect that tangent space normal maps were developed because of limitations on hardware? The technique I have described depends on FP textures which didn't come into standard until the Geforce 6 series.
 
The big disadvantage of object space normal maps is that they are dependent on the underlying surface. If you use obj. space normal maps you need a different normal map for each object! That's the reason why tangent space normal maps are usually preferred.
The better way to go is probably to duplicate "problem" vertices, as suggested and then use the common tangent space normal mapping. Also normally ;) tangent frame interpolation errors are not an issue, afaik.
 
Animation doesn't work too well with object space normal mapping.

Software that generates a normal map will (hopefully) account for the problem you are describing.
It's the same with the surface normal too, these are highly inaccurate, and will produce exactly the same error you mention. Yet a vertex normal is just as critical as a vertex tangent vector in normal mapping.

At the end of the day, normal mapping is still an approximation, so having small inconsistency in your output isn't going to matter much when the underlying geometry is still an order of magnitude less detailed.
 
Back
Top