Volumetric Noise
TGorillaVolumetricNoise is a ready-to-use cloud / smoke / fog body. It is a subclass of TGorillaVolumetricMesh that fills its own 3D texture with fractal (FBM) Perlin noise and renders it as a physically based emission-absorption medium you can also fly through.
You get a believable volumetric cloud from a handful of properties — no data files, no shader code.
Table of Contents
- Quick Start
- Presets
- Shaping the Noise
- Density & the Emission-Absorption Model
- Flying Through the Body
- Animating Smoke & Clouds
- How It Works
- Best Practices
Quick Start
Like any volumetric mesh, it needs the front/back face passes (see the Volumetric Mesh guide). After that, a cloud is three lines:
uses
Gorilla.Volumetric.Noise,
Gorilla.Controller.Passes.Face;
var Cloud := TGorillaVolumetricNoise.Create(GorillaViewport1);
Cloud.Parent := GorillaViewport1;
Cloud.SetSize(1, 1, 1);
// face passes (see the Volumetric Mesh guide)
Cloud.FrontFaceRenderPass := FFrontFace;
Cloud.BackFaceRenderPass := FBackFace;
FFrontFace.AllowControl(Cloud);
FBackFace.AllowControl(Cloud);
Cloud.ApplyPreset(vnpClouds); // done — a puffy cloud
The component already sets sensible defaults in its constructor: 64³ resolution, RenderInside := True (so you can fly through it), lighting off (fog is an emission-absorption medium, not a lit surface) and the emission-absorption blend.
Presets
ApplyPreset loads a complete set of shaping parameters. You can still fine-tune individual properties afterwards.
TGorillaVolumetricNoisePreset |
Look |
|---|---|
vnpClouds |
Puffy cumulus clouds (billowy noise, rounded blob, medium coverage). Default. |
vnpSmoke |
Denser, more filled smoke body — good base for animated smoke. |
vnpFog |
Thin, evenly distributed haze (smooth noise, low density, little edge fade). |
Cloud.ApplyPreset(vnpSmoke);
Cloud.Density := 2.0; // then tweak to taste
Shaping the Noise
All shaping properties rebuild the 3D texture automatically when changed.
| Property | Type | Description |
|---|---|---|
Frequency |
Single |
Base noise scale — how many noise cycles span the volume. Higher = smaller, more numerous features. |
Octaves |
Integer |
Number of FBM octaves summed for detail. More = finer wisps, slower to generate. |
Persistence |
Single |
Amplitude falloff per octave (0–1). Lower = smoother, higher = rougher. |
Lacunarity |
Single |
Frequency growth per octave (usually ~2.0). |
Coverage |
Single |
Cloud coverage 0–1. 1 keeps the whole body; lower values carve it into separate puffs. |
EdgeFalloff |
Single |
Border fade 0–1. Fades density toward the volume border so the body is a rounded blob, not a filled cube. |
Billowy |
Boolean |
Use abs() noise for the puffy cauliflower cumulus / smoke look (default True). Off = smooth haze. |
Density |
Single |
Overall opacity of the medium (see below). |
Seed |
LongWord |
Random seed of the underlying Perlin generator. |
Cloud.Frequency := 3.0;
Cloud.Octaves := 5;
Cloud.Coverage := 0.6; // fewer, more separated puffs
Cloud.EdgeFalloff := 0.6; // softer border
Cloud.Billowy := True;
Density & the Emission-Absorption Model
Density is not baked into the voxel data — it is the absorption strength of the physically based Beer-Lambert blend, applied at render time. This is what keeps a dense cloud smooth instead of forming hard saturation "shells" / step terraces when you look at it from inside.
Cloud.Density := 2.5; // denser, still smooth
Because Density only rebuilds the (cheap) blend function and not the volume data, it is safe to change every frame — you can even animate it.
The absorption is resolution-independent: a cloud at
vms32x32x32looks comparably dense to one atvms64x64x64for the sameDensity.
Flying Through the Body
RenderInside is True by default, so the camera can move inside the cloud and the medium composites correctly over the rest of the scene. Nothing extra to do — just move the camera in.
Animating Smoke & Clouds
Advance Offset over time and call Regenerate to make the noise drift like moving smoke:
procedure TForm1.OnAnimationTick(Sender: TObject);
begin
FCloud.Offset := FCloud.Offset + Point3D(0, 0.02, 0.05);
FCloud.Regenerate; // re-samples the volume, uploads the new data
end;
Regenerate re-samples the whole volume on the CPU, so it is the expensive part of animation. To keep it affordable:
- Use a smaller resolution for animated bodies (
Cloud.Sizes := vms32x32x32). - Don't update every frame — a timer at ~100 ms is usually enough for slow drift.
- Changing only
Density(opacity) is cheap and does not requireRegenerate.
How It Works
The density stored per voxel is built as:
- FBM —
Octavesof Perlin noise summed withPersistenceandLacunarity, base scaleFrequency.Billowyusesabs(noise). - Coverage — a soft threshold that carves the body into separate puffs.
- EdgeFalloff — a radial fade toward the border so the body is a rounded blob.
The stored voxel value is a smooth 0..1 gradient. Opacity comes at render time from the emission-absorption blend scaled by Density. This separation (gradient data + render-time absorption) is what removes the terracing artifacts that a naïve "bake density into the data + linear blend" approach produces.
Best Practices
- Start from a preset, then fine-tune
Coverage,EdgeFalloffandDensity. Densitycontrols opacity cheaply and safely (no volume rebuild) — use it as your main dial.- For animation, drop to
vms32x32x32and update on a timer, not every frame; the GPU render stays cheap, only the CPU re-sampling is costly. - Leave
RenderInsideon for fly-through fog; keepUseLightingoff (a cloud has no lit surface — lit clouds need light-marching, a separate feature). - The look is grayscale density by default; drive color through the material or a gamut if you need tinted media.
See Also
- Volumetric Mesh — the base component (data loading, blend modes, quality)
- Gorilla.Volumetric.Noise Reference — full class reference