Utility to create environment maps specular, diffuse and LUT textures using an HDR file.

Create a LUT texture on init using a ComputePass. Can load an HDR file and then create the cubemap and diffuse textures using two separate ComputePass and the PMREM texture using custom mips.

Especially useful for IBL shading with LitMesh.

// assuming 'renderer' is a valid renderer or curtains instance
const environmentMap = new EnvironmentMap(renderer)
await environmentMap.loadAndComputeFromHDR('path/to/environment-map.hdr')

Constructors

Properties

renderer: Renderer

The Renderer used.

uuid: string

The universal unique id of the EnvironmentMap.

sampler: Sampler

The Sampler used in both the ComputePass and in IBL shading from the getPBRFragmentShaderCode utility function.

hdrLoader: HDRLoader

HDRLoader used to load the .hdr file.

Options used to generate the lutTexture, specularTexture and diffuseTexture.

rotationMatrix: Mat3

Define the default environment maps rotation Mat3.

lutTexture: Texture

LUT Texture used for IBL shading, containing BRDF GGX in the RG channels and BRDF "Charlie" sheen in the B channel.

cubemapTexture: Texture

Environment cube map Texture.

diffuseTexture: Texture

Diffuse environment cube map Texture.

specularTexture: Texture

Specular/PMREM environment cube map Texture.

Accessors

Methods