Calculate Smoothing Tangent Space for Meshes

TBNwithMirroredUV-300x226

Some ideas about calculating tangent space for meshes are cleaned here. It is very easy to calculate the tangent basis vectors if the vertex normal and diffuse uv sets were provided for each triangles.
Some problems may appear when several triangles are sharing the same vertex position. For each triangle they have same position, but they may have different uv values, different tangent space go though. So you could not simply add tangent vector together which comes from different triangles and average them later. Because they are different tangent values for each triangle.

The best way to address this problem is separate this vertex into several groups. Here are some criterion list here:

1) Do they belong to the same coordinate system, left hand or right hand? You could check it by whether (TxBN)*N bigger than ZERO or not.

2) Do they have the same uv values? Different uv values means they may have different tangent normal in the normal map. After such separation or grouping, you could do add and average option to find the correct result.

So at last, you may find that the vertex number will increase a lots. And take it easy, it is very normal.

posted @ 2012-08-24 07:57  opencoder  阅读(281)  评论(0编辑  收藏  举报