Type Method

irradianceTextureCubeWithTexture:name:dimensions:

Generates an irradiance texture from the specified reflectance cube texture.

Declaration

+ (instancetype)irradianceTextureCubeWithTexture:(MDLTexture *)texture name:(NSString *)name dimensions:(vector_int2)dimensions;

Parameters

texture

The reflective (environment map) cube texture from which to generate an irradiance texture.

name

The name property for the newly generated texture.

dimensions

The size (width and height in texels) of each cube face for the newly generated texture.

Return Value

A new cube texture object.

Discussion

Irradiance and reflectance textures are used in realistic lighting:

  • A reflectance texture, also known as an environment map, contains a rendering of a scene as seen from a specific position. A renderer can use this texture to create reflections on surfaces with metallic materials.

  • An irradiance contains samples of the total light arriving at the a specific position from every direction. A renderer can use this texture to create diffuse lighting effects.

Typically, an irradiance texture is derived from a reflective texture. For example, consider a reflective texture that is red in all directions above its position and blue in all directions below that point. The side of an object rendered with a reflective material would show a hard line between red and blue, but a diffuse material should appear purple, because the side of the object receives a blend of the red light from above and the blue light from below. Therefore, this method generates an irradiance texture that is red directly above, is blue directly below, and contains gradations of purple on all sides.

Calling this method is equivalent to calling the irradianceTextureCubeWithTexture:name:dimensions:roughness: method with the roughness value automatically varying from 0.0 at the largest mip level to 1.0 at the smallest.

You can use reflective and irradiance textures with the MDLLightProbe class.

See Also

Creating Irradiance Textures

+ irradianceTextureCubeWithTexture:name:dimensions:roughness:

Generates an irradiance texture from the specified reflectance cube texture, assuming a surface of the specified roughness.