Lighting in computer graphics

Now, we introduce the constructs needed to add lighting to a scene. Like many topics in the wide world of computer graphics, lighting is quite complex, and many different approaches have been taken by artists and engineers seeking to achieve specific styles and aesthetics.

The simplest kind of lighting is purely emissive lighting. With this lighting model, the polygons of objects are self-lighting and do not interact with external materials at all. They appear the same regardless of the view angle, their position in the world, or occlusions from other nearby objects. The shading process simply takes the diffuse appearance of the polygon and renders it to the camera. However, emissive lighting is also referred to as unlit shading since no actual lighting is involved. Historically, this technique has been used in real-time rendering contexts such as video games from the 1990s. It is highly performant but quite unrealistic in appearance.

A brief introduction to light physics

What we call visible light is a specific band of wavelengths in the electromagnetic spectrum. This band consists of radiation with roughly the wavelength of 400700400-700 nanometers, with deep violets at the lower 400400 range and deep reds at the upper 700700 range. Wavelength and frequency are inversely related, so low-wavelength light, such as violet, is also called high-frequency light. A single quantum of light is called a photon and we can think of light as consisting of a stream of many photons moving at the speed of light or 299,792,458299,792,458 meters per second in a vacuum.

All light sources contain a mixture of light of different wavelengths. Full spectrum light contains light spanning all wavelengths of the visible spectrum. Lights can also appear to have a tint of blue, green, yellow, red, or any other color, depending on which range of the visible spectrum it emits most strongly.

Types of lighting

PyTorch3D supports the most common forms of lighting (with the exception of spotlights and emissive materials). This includes the following types of lights:

  • Ambient lighting

  • Directional lighting

  • Point lighting

All of these lights possess a color, but they differ in how they govern the transport of their light through a scene.

Ambient lighting

Ambient lighting is light that has scattered throughout a scene so much that it travels equally in all directions. For this reason, it is also called a non-directional light source. It is often used as a fill light to cast scenes in a specific appearance or to lift the overall exposure of a scene. Because it travels in all directions equally, it doesn’t have a specular component. This kind of lighting is like the ambient light that fills up a cloudy day and does not cast hard shadows.

Get hands-on with 1200+ tech skills courses.