Contents

MDLLightProbe

A light source described in terms of the variations in color and intensity of its illumination in all directions.

Declaration

class MDLLightProbe

Overview

A light probe represents this variation either as a cube map texture or as a set of spherical harmonic coefficients. In addition to describing such light sources, the MDLLightProbe class provides methods for generating light probe textures based on the contents of a scene and for generating spherical harmonic coefficients from a texture.

A light probe consists of two cube map textures, where each texel represents the color and intensity of light in a particular direction from the cube’s center:

Using cube map textures for light-probe-based rendering offers great visual fidelity, but adversely affects performance due to the cost of texture lookups during rendering. In addition, a cube map texture often contains more detail than is necessary for lighting. A set of spherical harmonic coefficients can represent the same information with less detail, and can be used in shader calculations with much less performance cost. To use spherical harmonics, call the generateSphericalHarmonics(fromIrradiance:) method, then access the generated data in the sphericalHarmonicsCoefficients property.

Topics

Creating a Light Probe

Working with Textures

Working with Spherical Harmonics

Generating Light Probes from Scene Contents

See Also

Lights