displayCurves.shaderModule
- README.md4.3 KB
- module.wgsl14.7 KB
This package holds more than this page lists. See all of its files in its world.
README.md
displayCurves
The display curves: how a stimulus in light becomes the share of a display's
peak light that shows it. The chain's display transform __display__ draws
with them, and a shader that needs the same mapping (a pass baking a grading
LUT, a preview of the display) includes them rather than restating one.
| Number | Name | Curve |
|---|---|---|
| 0 | clamp | The light clipped to 0..1, each channel on its own: the identity below the peak, a flat clip at it. |
| 1 | reinhard | Reinhard, L / (1 + L), on luminance. |
| 2 | aces | The ACES 1.x RRT + sRGB ODT tone scale (Stephen Hill's fit) on luminance. |
| 3 | pbrNeutral | Khronos PBR Neutral. |
| 4 | agx | AgX, the base look (the default), at the stimulus's hue. |
| 5 | agxPunchy | AgX with the Punchy look, at the stimulus's hue. |
| 6 | tony | Tony McMapface, a 48x48x48 LUT; the module states where a stimulus reads it. |
| 7 | gt | The Gran Turismo (Uchimura) curve on luminance. |
Hue and highlights
Every curve but clamp and tony keeps a brightening colour's hue, and every
curve but clamp carries light too bright for its colour toward white, each
step brighter still showing: fire stays orange on its way to white, a blue sky
stays blue, a violet light whitens with its form rather than holding one
channel at the peak.
zero_curve_on_luminance(light, shown, peak)shows a colour at the luminanceshown: the colour is scaled to it, so every channel keeps its share, and where a channel would pass the peak the colour moves toward the grey of the same luminance until its brightest channel fits.reinhard,acesandgtare their tone scale on the colour's luminance through it, so a grey reads what the published curve reads.zero_curve_keep_hue(shown, light)hands a curve's output back at the stimulus's hue: its brightest and darkest channels stay where the curve put them and the middle channel stands between them where the stimulus's middle channel stands.agxandagxPunchydraw through it, keeping AgX's tone and its own path to white.pbrNeutralcompresses the brightest channel and desaturates with it.clampclips each channel on its own: a colour with a channel past the peak turns toward the primary or secondary its clipped channels make, and light past the peak reads one flat value. It is the curve for reading a picture's light as code values.tonyturns a bright colour's hue the way the eye sees it turn (the Bezold-Brucke shift), by design of its LUT.
Every curve returns light (0..1), never code values: the surface's encode
(zero_display_encode for an sRGB surface) runs after it.
HDR forms
On an HDR display the picture passes SDR white, up to the display's peak.
zero_display_curve_hdr(light, curve, peak) draws a curve for a display whose
peak is peak SDR whites; the display transform draws it when the output is
HDR, and draws the SDR function above when the peak is 1.
| Curve | HDR form |
|---|---|
clamp | The light clipped to 0..peak. |
gt | The Gran Turismo curve with the peak as its P parameter, on luminance: the same toe and linear section, the shoulder toward the peak, the colour carried there by zero_curve_on_luminance with the peak as its limit. |
reinhard, aces, pbrNeutral, agx, agxPunchy, tony | The SDR output carried to the peak by zero_curve_to_peak. |
zero_curve_to_peak(shown, white, peak) keeps a colour whose brightest
channel is at or below the knee (0.76 of SDR white) as the curve shows it.
Above the knee the brightest channel, t of the way from the knee to the
curve's white (what it shows for a stimulus past its range), is lifted by
(peak - white) * t^2, and the colour is scaled with it: the curve's slope at
the knee, its hue and its path toward white hold, and its white reaches the
peak. It takes the output of any SDR curve, a sampled LUT's included: the
display transform carries Tony McMapface's cube with it, its white the cube's
brightest corner.
#include "@builtin::shaderModules.displayCurves"
let shown = zero_display_curve(light, ZERO_CURVE_AGX);
postprocess.setProperty("__display__", "curve", "agx") picks the curve the
frame is drawn with; postprocess.displayCurves() lists the names in number
order.