Documentation / @ripl/3d / composeSurfaceColor
Function: composeSurfaceColor() ​
composeSurfaceColor(
baseColor,illumination,fog?,distance?):string
Defined in: 3d/src/core/shading.ts:299
Composes a shaded CSS colour from a surface's base colour and the light reaching it.
With no additive term this is exactly round(channel * brightness) — the expression the single-light model used — so an unlit-by-anything-new scene keeps its original pixels.
Parameters ​
| Parameter | Type | Default value | Description |
|---|---|---|---|
baseColor | ColorRGBA | undefined | The surface's own colour, in 0–255 channels. |
illumination | SurfaceIllumination | undefined | The light arriving at the surface. |
fog? | ResolvedFog | null | undefined | The resolved fog to blend towards, or null for none. |
distance? | number | 0 | Distance from the camera to the surface, used only when fog is given. |
Returns ​
string
The shaded colour as a CSS rgba() string.