A light source whose shape, direction, and intensity of illumination are determined by a photometric profile.
- iOS 9.0+
- macOS 10.11+
- UIKit for Mac 13.0+Beta
- tvOS 9.0+
- Model I/O
You create a photometric light from a file in the IES format, containing physical measurements of a light source. Many manufacturers of real-world light fixtures publish such files describing the lighting characteristics of their products. This photometry data measures the light web surrounding a light source—measurements of the light’s intensity in all directions around the source.The
MDLPhotometric provides two ways to interpret a light web:
As a cube map texture. Use the
generatemethod to generate a texture, then use the
lightproperty to access the texture. In this texture, each texel represents the light’s intensity in the direction from the cube’s center to the texel’s position on the cube.
As spherical harmonics. Use the
generatemethod to generate a set of spherical harmonic coefficients, and then use the
Spherical Harmonics(from Light:)
sphericalproperties to access these coefficients. Spherical harmonic coefficients provide a more compact representation of the same information as the cube map texture, so you can use them during shading without the performance cost of a texture lookup.
MDLArea classes can describe lights with interesting shapes—an area light offers a simpler design that can be implemented with better rendering performance, and a photometric light offers design that better models real-world light fixtures at the cost of higher computational complexity.