92 3D: Colour space and final output
3D reference map · First 3D picture
Semantic rgba-color values are sRGB: RGB channels use the ordinary 0 through 255 display encoding and alpha is linear coverage. Before interpolation, lighting, or source-over composition, an opaque 3D renderer converts RGB into linear light. It keeps a separate linear-rgba3d value internally because material emission or specular terms may exceed one without being clipped. At the final output boundary RGB is tone-mapped, converted back to sRGB, and stored; alpha is preserved unchanged.
struct
(struct linear-rgba3d (red green blue alpha) #:transparent) red : nonnegative-real? green : nonnegative-real? blue : nonnegative-real? alpha : (and/c real? (between/c 0 1))
procedure
(srgb-channel->linear channel) → real?
channel : (and/c real? (between/c 0 1))
procedure
(linear-channel->srgb channel) → real?
channel : (and/c real? (between/c 0 1))
procedure
(rgba-srgb->linear color) → linear-rgba3d?
color : rgba-color?
procedure
(rgba-linear->srgb color) → rgba-color?
color : linear-rgba3d?
procedure
(linear-rgba3d-over source destination) → linear-rgba3d?
source : linear-rgba3d? destination : linear-rgba3d?
struct
(struct tone-map3d (mode exposure white-point) #:transparent) mode : (or/c 'clamp 'reinhard) exposure : nonnegative-real? white-point : positive-real?
value
procedure
(tone-map3d-apply policy color) → linear-rgba3d?
policy : tone-map3d? color : linear-rgba3d?
Limitations. The colour contract covers opaque 3D rendering and its 3D strokes, markers, and billboards. It does not provide ICC profiles, wide-gamut or display-HDR export, texture colour-space metadata, or guaranteed linear composition between a rendered view3d and arbitrary outer two-dimensional Picts. Transparency remains order-sorted rather than order-independent.
The runnable comparison is "examples/3d/tone-map-emission.rkt"; it uses strong emission to show the visible difference between the default clamp policy and Reinhard output.