• Create Account

# Baking tangent space normal maps

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

### #1B_old  Members   -  Reputation: 649

Like
0Likes
Like

Posted 05 September 2012 - 02:27 AM

I have a mesh with normals. During shading the tangent/bitangent is calculated from the normal and UVs on the fly, for usage of an existing normal map. The mesh can use any number of different normal maps and I want to generate a single tangent space normal map that covers the entire mesh.
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

Tangents

Tangent space normals

Any ideas how I could generate a smooth normal map?

### #2Ashaman73  Crossbones+   -  Reputation: 6859

Like
0Likes
Like

Posted 05 September 2012 - 03:51 AM

The problem is, that the tangent/bitangents sometimes "jump" between neighboring triangles although the mesh normals are smooth.

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.

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.

### #3B_old  Members   -  Reputation: 649

Like
0Likes
Like

Posted 05 September 2012 - 04:33 AM

I think I figured it out. The tangentspace calculation was a bit whacky. Changing that seems to solve the problem.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS