Normal Mapping - Calculating Tangent Space

Calculating Tangent Space

In order to find the perturbation in the normal the tangent space must be correctly calculated. Most often the normal is perturbed in a fragment shader after applying the model and view matrices. Typically the geometry provides a normal and tangent. The tangent is part of the tangent plane and can be transformed simply with the linear part of the matrix (the upper 3x3). However, the normal needs to be transformed by the inverse transpose. Most applications will want cotangent to match the transformed geometry (and associated uv's). So instead of enforcing the cotangent to be perpendicular to the tangent, it is generally preferable to transform the cotangent just like the tangent. Let t be tangent, b be cotangent, n be normal, M3x3 be the linear part of model matrix, and V3x3 be the linear part of the view matrix.

Read more about this topic:  Normal Mapping

Famous quotes containing the words calculating and/or space:

    “What our children have to fear is not the cars on the highways of tomorrow but our own pleasure in calculating the most elegant parameters of their deaths.”
    —J.G. (James Graham)

    “Shall we now
    Contaminate our fingers with base bribes,
    And sell the mighty space of our large honors
    For so much trash as may be grasped thus?
    I had rather be a dog and bay the moon
    Than such a Roman.”
    —William Shakespeare (1564–1616)