AbstractTonemap

← prev index next →

The base concept for a tonemap: the rule that turns how much light a surface receives into a color.

Remarks

A tonemap maps the lighting parameter — 0 for full shadow, 1 for full light — to a color, so a surface's shading is authored rather than physically fixed. It is the light-driven half of shading: the tonemap supplies the driver value, and the ColorMap it references turns that value into the pixel color.

How a tonemap is used. A tonemap is a standalone scene resource referenced by id from a material's tonemap="#id". It names the color-map to look up with color-map="#id", and may carry an optional applicability field="#id" that modulates the tonemap weight per fragment (the same field model used on sk-plain-material). The material, the tonemap, the color-map, and the field are all separate resources wired together by id.

Member elements: sk-tonemap is the concrete tonemap — a color-map reference plus the light-intensity driver and an optional field. sk-color-stop is one stop of a ramp color-map (a child of <sk-ramp-color-map>), grouped here because stops define the colors a tonemap ultimately shows.

The example maps light to a dark-red→gold ramp and applies it to a lit sphere: shadowed areas read dark red, lit areas gold.

Abstract base class — not instantiated directly. Construct one of its concrete subclasses; this class contributes the members below to them.

Properties

Other Properties

PropertyTypeDefaultDescriptionDeclared by
fieldanimatable Field | null Gets the optional field that modulates this tonemap's weight per-fragment. AbstractTonemap
sceneread-only any Gets the Scene this animatable belongs to, if any. SkenraAnimatable
animationsread-only SkenraAnimation[] Public getter for the animations affecting this target. SkenraAnimatable

Methods

MethodDescriptionDeclared by
animate(firstArg: TypedKeyframe<this>[] | TypedPropertyIndexedKeyframes<this> | Record<string, any> | globalThis.Keyframe[] | globalThis.PropertyIndexedKeyframes | null, secondArg?: number | KeyframeAnimationOptions | globalThis.KeyframeAnimationOptions): SkenraAnimation & Animation Creates a new SkenraAnimation for this target per Web Animations API. SkenraAnimatable
removeAnimation(animation: SkenraAnimation): boolean Removes a specific animation from this object. SkenraAnimatable
constrain(type: K, config: ConstraintConfigMap[K]): ConstraintReturnMap[K] Creates a constraint on this Animatable using a fluent API. SkenraAnimatable

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.