Game Development

Why are Normal Textures purple?

May 18, 2019

If you have spent any time with game engines like Unity or Unreal, or rendering engines like Blender, you have probably seen a purple texture called a Normal Texture. But have you ever wondered why it’s that eye-bleed-triggering shade of purple?

A normal map is 3D

A normal map isn’t just one shade of purple, it’s actually many different colors. Each RGB component references the X, Y and Z axis’. A normal map can go from -1 to 1 on any axis. An RGB channel can go from 0 to 255 on any axis, with the exception of blue (it has a range of 128 to 255). So if an axis has a value of 0, the corresponding color value is 128 (half way between 0 and 255) for red and green, and 191 for the blue channel (this is a design choice of Normal Maps).

Since a normal map will be mapped according to an objects UV, the only axis we need data from is the Z-axis. This gives us the “depth” effect.

Thus, if we are only concerned about the Z-axis, the only relevant RGB channel is blue. All the other axis’ can be set to 0, meaning the color value of the R and G channels are 128.

So an RGB color value of (128, 128, 255) will translate to (0, 0, 1) on the XYZ axis. And look! It’s that horrible shade of purple!