Create a new ProbeVolumeBaker instance.
The application, whose scene is baked.
Optionalvolume: ProbeVolume
The probe volume.
Optionaloptions: {The options.
Optionalemissive?: booleanWhether the geometry includes the emission of the surfaces. Defaults to false.
OptionalfaceSize?: numberThe number of texels along a side of a face of a probe. Defaults to 8.
OptionalfarClip?: numberThe far clip distance of the capture cameras. Defaults to 1000.
Optionallayers?: number[]The ids of the layers the probes capture. Defaults to the world and skybox layers.
OptionalnearClip?: numberThe near clip distance of the capture cameras. Defaults to 0.05.
OptionalprobesPerFrame?: numberThe number of probes captured each frame. Defaults to 32.
The number of probes captured each frame. A change applies from the next capture or bake.
Whether a capture or a bake is in progress.
Whether the geometry includes the emission of the surfaces, see the constructor.
The number of texels along a side of a face of a probe, see the constructor.
Whether the geometry of the probes has been captured.
The ids of the layers the probes capture, see the constructor. Do not modify it.
The probe volume the baker bakes.
Bakes the lighting of the probes, and sets the data of the volume. Captures the geometry first, if it was not captured yet.
Optionaloptions: {The options.
Optionalbounces?: numberThe number of indirect bounces after the direct lighting. Defaults to 1.
Optionaldilation?: booleanWhether to fill the invalid probes from their valid neighbors. Defaults to true.
Optionalindex?: numberThe index of the lighting of the volume to set, up to ProbeVolume#lightingCount, which adds a lighting, see ProbeVolume#setData. Defaults to 0.
OptionalonProgress?: FunctionCalled with the progress, from 0 to 1.
OptionalshadowBounds?: BoundingBox | nullThe shadow bounds of the directional lights while baking, see LightComponent#shadowBounds. Defaults to the box of the volume, expanded by its blend distance.
Optionalsource?: stringThe source of the lighting: PROBESOURCE_GBUFFER to light the captured geometry, or PROBESOURCE_SCENE to render the scene lit from each probe. Defaults to PROBESOURCE_GBUFFER.
The result of the bake.
Captures the geometry each probe sees, and sets the validity, the virtual offsets and the visibility of the volume. The capture takes a number of frames.
Optionaloptions: {The options.
OptionalonProgress?: FunctionCalled with the progress, from 0 to 1.
Optionalvalidity?: booleanWhether to find the invalid probes, which see more back faces than the validity threshold. Defaults to true.
OptionalvalidityThreshold?: numberThe fraction of the sphere around a probe covered by back faces above which the probe is invalid. Defaults to 0.25.
OptionalvirtualOffset?: booleanWhether to capture the invalid probes at a position moved out of the geometry, through the closest back face, by up to 0.45 of a cell. The probes are still interpolated at their positions in the grid, but the leak reduction and the visibility use the positions they were captured at. Defaults to true.
Optionalvisibility?: booleanWhether to compute the visibility of the probes. Defaults to true.
OptionalvisibilitySize?: numberThe number of texels along a side of the octahedral map of the visibility of each probe. Defaults to 16.
The result of the capture.
Destroys the resources of the baker: the geometry, the atlases and the cameras.
StaticisReturns whether a graphics device can bake probes. Baking renders the scene to half float or float textures. WebGPU devices always support them. WebGL2 devices need the float color buffer extensions (EXT_color_buffer_float or EXT_color_buffer_half_float), which some older or low-end mobile devices do not support. On those devices, the probes can still be baked ahead of time and loaded with ProbeVolume.deserialize; only baking is not supported. The null graphics device, which renders nothing, cannot bake either.
The graphics device.
True if the device can bake probes.
Bakes the light probes of a ProbeVolume in two steps.
ProbeVolumeBaker#captureGeometry captures, for each probe, the geometry it sees: the scene is rendered from the probe into the six square faces of its tile of an atlas, with the lit materials writing their albedo, normal, distance and emission instead of a color. The geometry gives the validity of the probes, their virtual offsets and their visibility, and is kept for the lighting.
ProbeVolumeBaker#bakeLighting computes the lighting of the probes, from one of two sources:
Each bounce lights the scene with the probes of the previous one. The radiance of the faces is then projected onto the spherical harmonics of the probes.
The geometry stays in memory until the baker is destroyed, for the lighting to be baked again.
Baking needs a device which renders to half float or float textures, see ProbeVolumeBaker.isSupported: all WebGPU devices, and the WebGL2 devices with the float color buffer extensions. Probes baked ahead of time load on any device.
Example