Skip to main content

Class: VolumetricClouds

Clouds marched through a tileable noise volume instead of meshed. Drawn as one screen-covering triangle after the scene's transparency composites, reading a copy of the scene's depth so a slab wraps around the terrain that rises through it: a low layer becomes a sea of cloud with the peaks standing out of it.

The voxel style steps cell by cell (each texel is one cloud cube, shaded by the face the ray crossed into it); the soft style marches evenly through a filtered volume.

Hierarchy​

  • Mesh<BufferGeometry, NodeMaterial>

    ↳ VolumetricClouds

Constructors​

constructor​

• new VolumetricClouds(options?, shared): VolumetricClouds

Parameters​

NameType
optionsPartial<VolumetricCloudsOptions>
sharedVolumetricCloudsSharedInputs

Returns​

VolumetricClouds

Overrides​

Mesh&lt;BufferGeometry, NodeMaterial&gt;.constructor

Properties​

isInitialized​

• isInitialized: boolean = false


options​

• options: VolumetricCloudsOptions

Methods​

borrowDepth​

▸ borrowDepth(renderer, depth): void

Hands the deck a copy of the frame's depth that already exists this render (the world's, made as its blended layers open: nothing after it writes depth), so the deck makes none of its own. Without one it copies the bound target's depth itself.

Parameters​

NameType
rendererRenderer
depthTexture<unknown, TextureEventMap>

Returns​

void


configure​

▸ configure(options): void

Change the style or the layers in place; the noise is kept.

Parameters​

NameType
optionsPartial<VolumetricCloudsOptions>

Returns​

void


dispose​

▸ dispose(): void

Returns​

void

Overrides​

Mesh.dispose


drawBehindBlended​

▸ drawBehindBlended(renderer, camera, layers): void

Draws the half of the deck behind the scene's blended layers, under their composite: layers is the accumulation's weight target, read for where they stand. Called with the scene's target bound, just before the composite; the deck's own draw later this frame is the front half.

Parameters​

NameType
rendererRenderer
cameraCamera
layersTexture<unknown, TextureEventMap>

Returns​

void


onBeforeRender​

▸ onBeforeRender(renderer, _scene, camera): void

Parameters​

NameType
rendererunknown
_sceneunknown
cameraCamera

Returns​

void

Overrides​

Mesh.onBeforeRender


prepare​

▸ prepare(renderer, camera): void

Marches the deck at half the size of the bound target, for the draw into it that follows this frame. Call it between renders, with the frame's target bound and its depth final: the world does, before the deck draws (drawBehindBlended does for a frame with see-through layers). A frame that skips it marches every pixel in the deck's own draw, as does the soft style, whose grain is per pixel.

Parameters​

NameType
rendererRenderer
cameraCamera

Returns​

void


setHidden​

▸ setHidden(hidden): void

Hide the deck without dropping it (the camera under water).

Parameters​

NameType
hiddenboolean

Returns​

void


setSeed​

▸ setSeed(seed): void

Parameters​

NameType
seednumber

Returns​

void


update​

▸ update(driftClock): void

Drift the deck with a clock every viewer shares, so two clients see the same cloud in the same place. Pass a slewed clock (World.shaderClock): the shared clock itself snaps on every server correction, and the deck would jump with it.

Parameters​

NameType
driftClocknumber

Returns​

void