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 specular and diffuse textures using two separate ComputePass.

Especially useful for IBL shading with glTF.

Example

// 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.

sampler: Sampler

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

hdrLoader: HDRLoader

HDRLoader used to load the .hdr file.

Options used to generate the lutTexture, specularTexture and diffuseTexture.

rotation: Mat3

Define the default environment maps rotation.

lutTexture: Texture

BRDF GGX LUT Texture used for IBL shading.

diffuseTexture: Texture

Diffuse environment cube map Texture.

specularTexture: Texture

Specular environment cube map Texture.

Methods