Lighting

Once in a while you get shown the light
In the strangest of places if you look at it right

— Scarlet Begonias, Grateful Dead

The shapes we’ve modeled in our programs consist of straight lines and flat triangles. Yet they often appear to be formed of curves and curved surfaces. We model a sphere as a mesh of triangles but we see it as the surface of a smooth ball. The transformation from flat to round depends on lighting. We might say, light makes the world go round.

There are a number of different kinds of lights provided by three.js. These include point lights, spot lights, and directionless ambient light. When added to the scene graph, they light up the scene. These lights have properties such as position, direction, color, and brightness, depending on the type. Their interaction with the meshes in the scene — involving material, geometry, position, and orientation — as well as the position of the viewer, accounts for illumination of the scene.