3D engine that AI agents drive
JavaScript 3d3d-engineagentic-aiai-agentsblenderclaude-codegame-enginegaussian-splattinggltfjavascriptmcpmcp-servermodel-context-protocolpath-tracerpath-tracingpbrrenderingthreejs-alternativewebgl2webgpu
Document how to get exact water ramp colours (#2033)
Nguyen Xuan An0835e0cb3912
diff --git a/docs/agent-scene.md b/docs/agent-scene.mdindex e135e9ab..1aac2373 100644--- a/docs/agent-scene.md+++ b/docs/agent-scene.md@@ -108,6 +108,8 @@ The tag can be `surface`, `unlit`, `liquid`, `foam`, `water`, `foliage` or `gras`liquid` refracts and tints what lies behind it: its color is the light one metre lets through, so `[0.56, 0.84, 0.88]` is clear water. `foam` draws soft blended droplets.`water` is a flat mirror sheet (a plane or thin box). The largest one sets the water level: everything below it fades by `exp(-absorption * depth)` per colour channel (`absorption` is RGB per metre), and its shadows are lifted and softened with depth times `turbidity` (0 clear to 1 murky). `waterPreset` fills both: `lake` (default), `sea` or `river`. A shadow on the surface is faint and never darkens the reflection; give the sheet an `opacity` below one when the bed should show. The sun's leg to a bed is bent at n = 1.33 and absorbed over `depth / cos(theta_t)`, so a clear lake keeps little shadow contrast on a bed 4 m down, and a murky river keeps about a quarter.`waterRamp` (off by default) paints the sea in flat anime tones: `{ colors: [3 to 5 RGB, deep to bright], drivers: { height, facing, sun } (weights 0 to 1, default height 1), heightRange: [low, high] (world y, default -1 to 1), steps: hard (default) or soft, crestTint: { color, strength } }`. A weighted mix of the drivers picks the tone: `height` is world y across `heightRange`, `facing` rises toward the horizon, `sun` is how squarely a wave face meets the key light. The ramp owns the colour, so the sky reflection and the lit shading are not drawn; foam and the sun glint still add on top. `crestTint` colours the folded crests the `foam` group marks, wider than the foam itself. It needs the water tag; depth and a shallow and deep pair are not drivers yet.++Ramp colours are scene radiance (linear), so the view transform, distance haze and bloom change them before they reach the screen. Measured on 640x360 stills, a 3-tone ramp under the default view (ACES, haze and bloom on) came out lighter and greyer: `#19617c` measured `#5b90a4`, `#38aabc` measured `#49c1cc`, `#95edf3` measured `#b0e0e2`. `environment.viewTransform: "neutral"`, `environment.fogDensity: 0` and `effects.bloom.strength: 0` remove the haze, the bloom and the ACES shift, but Khronos Neutral still subtracts an offset from every channel (`min(channel) - 6.25 * min(channel)^2` below 0.08, else 0.04) and compresses a peak above 0.8, so the red of a dark tone drops most (`#19617c` measured `#095e78`). To see a colour exactly, add the offset to the colour you pass: raise every channel by `0.4 * sqrt(lowest) - lowest` when the lowest channel is under 0.04, else by 0.04, and keep the largest channel under 0.8. A 4-tone ramp built that way (requested linear 0.01,0.12,0.2 / 0.04,0.4,0.5 / 0.3,0.7,0.75 / 0.55,0.75,0.7, passed as 0.04,0.15,0.23 / 0.08,0.44,0.54 / 0.34,0.74,0.79 / 0.59,0.79,0.74) measured within 3 per channel on the three larger bands and within 6 on the small deep band, under `neutral`, no fog, no bloom.Any `opacity` below one draws the material blended after opaque geometry, which suits glass, windows and visors. `alphaMode` accepts `opaque`, `blend` or `add` (additive light for sparks, trails and glow); cutout masking needs a texture and is not available in procedural recipes.`doubleSided` draws and lights both faces of thin sheets.Changing the tag, opacity, blending, sidedness or pattern replaces the affected parts in the renderer; color, metallic, roughness and emission edits keep them.