# The math of normal mapping without a dot product

As far as I understand the technical details about a good normal mapping they go like this:

• everything gravitates around the concept of vertex
• the artist provides an RGB image and an UV map, the UV map maps the 3D vertexes of the object to the 2D surface of said image
• the image represents the information about 3 vectors/axis/directions, U and V, and the color in a point P of the normal map is carrying the information about the magnitude of the normal, the tangent and the bitangent
• you are basically interpolating real vertex realV on the 3D geometry with vertex fakeV that you create by interpreting the normal map and the uv map
• people that use a dot product assume that the vertex fakeV that you create/compute has a normal fakeV_N that is orthogonal to both the tangent fakeV_T and the bitangent fakeV_B, the tuple (fakeV_N,fakeV_T, fakeV_B) can be basically seen as a new set of cartesian axis in the local space of the vertex since they form a 90 ° angle with each other.
• Since there is an infinite amount of vectors that are orthogonal to fakeV_N the orientation of fakeV_T and fakeV_B is determined by the coordinates of UV values on the map

Now the part that I don't get

If you are going to say that said tuple is not orthonormal, where do you get the information about which angles the algorithm is supposed to create between each pair of vectors ? The informations that I get from the artists are the RGB at a specific point, the UV location relative to the 3D vertex on the geometry and the 2D coordinate system on the image that is the normal map, basically the values of U and V . Where do I get the accurate angles for tangent and the bitangent ?

• "people that use a dot product " what does that mean? what's realV and what's fakeV? The tuple (it's a basis really) does not need to be orthonormal – Babis Oct 31 '14 at 16:31
• It doesn't have to be orthonormal, if your texture coordinates are skewed it certainly won't be. But the thing is, a lot of modeling software can be configured to orthogonalize the basis vectors (normal, tangent, bi-tangent) to satisfy this assumption. Thus you only need to store two of the three vectors and the third is merely the cross-product between the other two. – Andon M. Coleman Oct 31 '14 at 23:50

• The tangent and bi-tangent are contained in each vertex I'm afraid I don't understand your statement. What do you mean with "vertex" ? Could you expand your explanation in a list of steps and mention the input and the outputs as I did in my question ? I think that in the last part of your answer you are assuming that the (fakeV_N,fakeV_T, fakeV_B) triplet is basically starting as an orthonormal tuple but I'm supposed to alter their orientation based on some factor related to this "vertex" ? I can't find any good example in terms of code on the internet, even GPU shaders. – user2485710 Oct 31 '14 at 19:26
• In 3D rendering, vertices are used to define primitives, and can contain multiple properties, which are usually interpolated across the primitive. An example vertex struct might be {float3 pos; float3 tangent; float3 bitangent; float2 texcoord; uint bones[2]; float boneWeights[2];} The data for each vertex is defined by the mesh data. If this is not familiar to you, I would recommend learning simpler rendering approaches first, then moving on to normal mapping once you have a good grasp of the basics. – MooseBoys Oct 31 '14 at 19:46