<sk-color-map-source>

← prev index next →

Paints a material's base color from a color-map driven by a field's spatial weight — the spatial twin of the tonemap, letting where a point is choose its color instead of how much light it receives.

Remarks

This is the map-driven member of the ColorSource family: like every color-source it gives a material a base color that varies across the surface, and it does so by reusing the whole ColorMap machinery — a field's [0,1] weight is the driver t, and the color-map turns t into the color. It is the symmetric sibling of sk-tonemap: the tonemap drives a color-map with light, this source drives the same color-map with space.

Key attributes. Three independent references, never conflated: color-map (REQUIRED) names the color-evaluation node; intensity-field is the DRIVER whose [0,1] weight becomes the t handed to the color-map; and field (from the ColorSource base) is the APPLICABILITY mask — where the source shows versus the flat base-color — which composes multiplicatively with the color-map's own field. Both fields follow the same absence convention: an omitted intensity-field drives t = 1 everywhere (the color-map's last stop), and an omitted field applies the source at full weight everywhere.

Because intensity-field DRIVES the color-map (it picks t) rather than masking it, a color-map with a single flat colour paints that one colour wherever the field is non-zero — the weight only chooses which stop, and every stop is the same. To make the field fade an effect in (e.g. an edge highlight that appears only where the weight is high), put the variation in the color-map itself — a ramp from transparent to the colour, so the weight sweeps t through the alpha. If instead you want to gate a single flat colour by the field, use it as the field APPLICABILITY mask, not intensity-field.

Related. It reuses any color-map — sk-ramp-color-map, a dither map, or a sk-composite-color-map (a stack of field-masked layers, driven from space here exactly as sk-tonemap drives it from light). A material selects it with base-color-source="#id" (see sk-plain-material). Its light-driven counterpart is sk-tonemap; to layer several sources, use sk-composite-color-source.

Serve these docs to run the live example. WebGPU needs a secure context — open this page via grunt serve rather than double-clicking the file. The Markup tab works from disk.

Attributes

AttributeTypeDefaultDescription
id <id> The element's unique identifier — the standard HTML global id attribute.
color-maprequired <id-ref> The referenced color-map, or null when unresolved. Setting it reference by id
intensity-fieldanimatable <id-ref> Gets the driver field feeding the [0,1] scalar the concrete source turns reference by id
fieldanimatable <id-ref> Gets the optional applicability field that masks where this source reference by id
xanimatable <number> 0 Gets the X position component.
yanimatable <number> 0 Gets the Y position component.
zanimatable <number> 0 Gets the Z position component.
hanimatable <angle> 0 Gets the heading (Y-axis) rotation in radians.
panimatable <angle> 0 Gets the pitch (X-axis) rotation in radians.
banimatable <angle> 0 Gets the bank (Z-axis) rotation in radians.
visualize <boolean> false Whether the visualization is visible (wireframe splines + center marker).
interactive-controls <boolean> false Whether interactive controls are shown (draggable markers for adjusting parameters).