Tangents and Binormals?

Started by
10 comments, last by mmikkelsen 13 years, 2 months ago
I also used to send tangent/bitangent/normal but sending tangent/normal/determinant is not only lighter with the memory but also the computations in a vertex shader. For instance, if you have some skeletal animation you probably have a lot of matrix multiplications and you have to transform all tangent/bitangent/normal. With the latter approach you can only transform trangent/normal and once all the computations are done, you simply compute bitangent with the cross product. In general, this will save 1/3 of the matrix transformations (since you avoid dealing with bitangent). Assuming that the cross product has negligible cost.
Advertisement
For those interested in an thorough explanation of normal mapping and tangent spaces I suggest you take a look
at this -> http://image.diku.dk...ikkelsen.08.pdf
It's a big file, 50 megs, but at least the server is good.

A clear order independent way to define which triangles are to share tangents (averaged) is given at the end of page 47
Order independence is important because otherwise you risk different tools pipelines creating different tangent spaces
for what is essentially the same mesh but with triangles or vertices in a different order. It's also important for getting perfectly
mirrored tangent spaces for mirrored meshes,
Adjacent triangles must share tangent space if and only if the 4 criteria are met.

The first 3 are trivial. The triangles must share
position, normal and texture coordinate at both end-points of the shared edge.
The fourth rule means that the winding (CW/CCW) of the texture coordinates must be the same on both triangles.
The fourth rule is important in the general case but it also allows us to handle mirroring correctly (a split will be created).


The thesis also shows how most commercial products out there have many problems.
Check pages: 44, 45, 52-56

Using the strategy of the thesis gives a perfect result as shown on page 68 (see the tspaces on 67).

Page 7 gives an explanation of the relation between bump mapping and normal mapping.

Hope someone finds this useful.

Cheers,

Morten

This topic is closed to new replies.

Advertisement