How Lighting Works and Light Sources

Lighting requires a lot of complicated mathematics, primarily matrix multiplication. These are usually performed for each mesh, but for improved performance, these calculations can be done on a per-vertex basis and then interpolated.

There are other additional calculations that can be done, such as occlusion, multiple light sources, and so forth, but these are often computationally expensive and so are not feasible for real-time rendering.

There are three types of light commonly used in 3D graphics – Directional Light, Point Light, and Spot Light. Directional lighting is when the light has one direction and no source in the world. It is most often used in pictures, which aren’t dynamic. A similar analogue in the real world is light from the sun; it’s far enough away that we can abstract its light as a large, straight beam with only one singular direction vector.

Point lighting is when the light is sourced from a single point which acts similar a light bulb shedding light in all directions. Finally, there is Spot Lighting, which is when the light source is directed in one way – just like a spotlight or a torch. In video games, Point Lighting and Spot Lighting are most often used.