turbulentMedium
A billowing cloud density at a point inside the shape.
turbulentMedium(
p: {x: Expr; y: Expr; z: Expr},
opts: {frequency: Expr; drift?: Expr; seed?: Expr; billow?: Expr; hint?: string},
): {density: Expr; mid: Expr; fine: Expr}
Import volume from shaders/std and use volume.turbulentMedium.
frequency sets how many cloud cells fit across the shape. drift is a time value that moves the clouds. seed moves to a different part of the cloud so two instances differ. billow (0–1) folds the clouds over themselves for a cumulus look. density is signed, roughly −1 to 1: threshold it with smoothstep to make clouds with clear gaps. mid and fine are two finer layers of the same cloud, free to use for dust bands or wisps.
Parameters
| Name | Type | Notes |
|---|---|---|
p | {x: Expr; y: Expr; z: Expr} | |
opts | {frequency: Expr; drift?: Expr; seed?: Expr; billow?: Expr; hint?: string} |
Example
const gas = turbulentMedium({x: pos.x, y: pos.y, z}, {frequency: math.mul(u.gasScale, 3), drift: t, billow: math.float(0.4)})
Tip. Inside a
volumeMarch, pass the step number ashintso each step gets its own values.
See also
volumeMarch— Walk a ray through the medium front to back, adding up what glows and what dims.interiorRay— The line of sight through a shape: where it enters, how far it travels inside, and where it is at any depth.