A light source described in terms of the variations in color and intensity of its illumination in all directions.
- iOS 9.0+
- macOS 10.11+
- UIKit for Mac 13.0+Beta
- tvOS 9.0+
- Model I/O
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
MDLLight 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:
reflectivecube map, also known as an environment map, contains a rendering of a scene as seen from the light probe’s position. A renderer can use this texture to create reflections on surfaces with metallic materials.
irradiancecube map contains samples of the total light arriving at the light probe’s position from every direction. A renderer can use this texture to create diffuse lighting effects. You can derive an irradiance map from an environment map with methods on the
MDLTextureclass, or when creating a light probe with the
Size: for Location: lights To Consider: objects To Consider: reflective Cubemap: irradiance Cubemap:)
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
generate method, then access the generated data in the