Skip to content

NgtsCloud

NgtsCloud components are ports of Drei’s Cloud which render volumetric clouds using instanced billboarded sprites. The clouds consist of depth-sorted particles that face the camera.

Components

NgtsClouds

Container component that manages multiple cloud instances using instanced mesh rendering for performance.

PropertyTypeDescriptionDefault
texturestringURL to the cloud texture imageCLOUD_URL (hosted CDN)
limitnumberMaximum number of cloud segments. Keep tight to save memory200
rangenumberNumber of segments to render. If undefined, renders all-
materialtypeof THREE.MaterialMaterial class to use for cloud renderingTHREE.MeshLambertMaterial
frustumCulledbooleanWhether to enable frustum cullingtrue

NgtsCloudInstance

Individual cloud formations placed inside a NgtsClouds container.

NgtsCloud

Convenience component that renders a single cloud. Automatically wraps itself in a NgtsClouds container if not already inside one.

Usage

Multiple Clouds with Container

<ngts-clouds [options]="{ limit: 400 }">
<ngts-cloud-instance
[options]="{
segments: 40,
color: '#f0f0f0',
speed: 0.4,
bounds: [6, 2, 2],
position: [0, 2, 0]
}"
/>
<ngts-cloud-instance
[options]="{
segments: 20,
color: 'white',
position: [5, 0, 0],
opacity: 0.8
}"
/>
</ngts-clouds>

Single Cloud (Auto-wrapped)

<ngts-cloud
[options]="{
segments: 20,
bounds: [5, 1, 1],
color: 'white',
fade: 10
}"
/>

Animated Clouds

<ngts-clouds [options]="{ limit: 200 }">
<ngts-cloud-instance
[options]="{
segments: 30,
speed: 0.2,
growth: 4,
color: '#ffe0e0',
fade: 25
}"
/>
</ngts-clouds>

Options

options input accepts any properties from THREE.Group in addition to the following:

Properties

name type description
seed number Random seed for consistent cloud generation. Default: Math.random()
segments number Number of segments/particles in the cloud. Default: 20
bounds [number, number, number] Bounding box dimensions for cloud distribution. Default: [5, 1, 1]
concentrate 'inside' | 'outside' | 'random' How segments are distributed within bounds. Default: 'inside'
volume number Volume/thickness of the segments. Default: 6
smallestVolume number Minimum volume when distributing clouds. Default: 0.25
distribute function Custom distribution function for precise control over particle placement.
growth number Growth factor for animated clouds (when speed > 0). Default: 4
speed number Animation speed factor. Set to 0 to disable animation. Default: 0
fade number Camera distance at which segments start fading. Default: 10
opacity number Opacity of the cloud. Default: 1
color THREE.ColorRepresentation Color of the cloud. Default: '#ffffff'