Creating surfaces – depth, non-smooth, natural, and realistic with normal maps

Few things in life are smooth and reflect light predictably, such as plastic—a modern invention—and a glass-smooth lake. We know how to render such smooth meshes based on the angle between the light source at that pixel and the normal using the dot product. The dot product is calculated by multiplying the two normalized vectors (each having a length of 1 unit), Nx * Lx + Ny * Ly + Nz * Lz, where N is the vertex normal (Nx, Ny, Nz) and L is the light direction (Lx, Ly, Lz).

However, most objects in nature have a bumpy, irregular surface, for example, oranges, tree bark, or a choppy lake. Man-made objects also have rough surfaces, for example, fabric or brick walls. Early ...

Get WebGL HOTSHOT now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.