Normal mapping works by replacing the interpolated surface normal by the one evaluated from an RGB texture, where each channel (Red, Green, Blue) corresponds to the X, Y and Z coordinates of the surface normal. It can be faster than bump mapping since bump mapping requires evaluating the shader underneath at least three times.
The map, usually exported from Mudbox or ZBrush.
- Look for vector user data named "tangent" and "bitangent".
- Use the UV derivatives.
- Build its own local frame.
The shader works in tangent space only. If your tangent map was exported in either world or object space, you could instead use the more generic space_transform shader.
Lets you shuffle the input channels order.
If enabled, inverts (1-channel) the x input channel.
If enabled, inverts (1-channel) the y input channel.
If enabled, inverts (1-channel) the z input channel.
For 8-bit maps. If enabled, the input is remapped to the [-1, 1] range.
In general, if you want to use a 16/32 format that can contain negative values, you should avoid the [-1..1] -> [0..1] conversion, and so that map would contain already the normal value, in which case color-to-signing back should be avoided in the shader.
The default values of these parameters (order, invert, color_to_signed) let you correctly import a map generated in Mudbox in Tangent coordinate space.