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, ShaderMaterial>

    ↳ VolumetricClouds

Constructors​

constructor​

• new VolumetricClouds(options?, shared?): VolumetricClouds

Parameters​

NameType
optionsPartial<VolumetricCloudsOptions>
sharedVolumetricCloudsSharedUniforms

Returns​

VolumetricClouds

Overrides​

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

Properties​

isInitialized​

• isInitialized: boolean = false


options​

• options: VolumetricCloudsOptions

Methods​

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


drawBehindBlended​

▸ drawBehindBlended(renderer, scene, 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 render is the front half.

Parameters​

NameType
rendererWebGLRenderer
sceneScene<Object3DEventMap>
cameraCamera
layersTexture<unknown>

Returns​

void


onBeforeRender​

▸ onBeforeRender(renderer, _scene, camera): void

Parameters​

NameType
rendererWebGLRenderer
_sceneunknown
cameraCamera

Returns​

void

Overrides​

Mesh.onBeforeRender


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