colorGrade.shader
- .metadata17 B
- README.md2.3 KB
- properties.yaml354 B
- shader.wgsl1.3 KB
This package holds more than this page lists. See all of its files in its world.
README.md
colorGrade post-process shader
Brightness, saturation and contrast as multipliers around an identity of 1.0.
pp.add(name, "colorGrade", { brightness = 1.1, saturation = 0.8 }) registers it, and
asset.resolve("@builtin::shaders.post.colorGrade", "shader"):getProperties()
reads the knobs below before it is added.
The three run in that order on the sampled frame: brightness scales the light, saturation scales each colour's distance from the grey of its own Rec. 709 luminance along its hue, and contrast scales luminance in log space about middle grey as the picture shows it at the exposure in force. Each is a multiplier, so 1.0 leaves the frame as it was and all three at 1.0 pass it through unchanged.
Contrast holds middle grey where it was and moves every stop above or below it by the same share: at 1.25 a shadow two stops under middle grey shows two and a half stops under it, and a highlight two stops over shows two and a half over. Every pixel carrying light keeps some, so a dark scene graded with contrast above 1 keeps its shadow detail and an exposure change after the grade still lifts it. Saturation stops where a colour's weakest channel reaches no light, so a colour keeps its hue: orange stays orange and skin stays skin.
On the display or all layer, after __display__ has fitted the picture to
the screen, contrast and saturation also hold the picture's white: contrast
moves each stop of a highlight's headroom to white by the same share it moves
a shadow's stops, and saturation stops where a colour's strongest channel
reaches white, so a highlight short of white stays short of it.
Contrast and saturation are @builtin::shaderModules.colorGrading's, which a
grade a world writes includes for the same response.
color_correction grades the same three quantities as ADDITIVE offsets around
0.0 and adds a tint colour, so a look authored for one does not transfer to the
other by copying its numbers.
| Property | Meaning |
|---|---|
brightness | Multiplies the colour. |
saturation | 0 is luminance alone, 1 is the frame's own colour, above 1 more colour along the same hue. |
contrast | Scales each pixel's distance in stops from middle grey (log space): 1 leaves it, above 1 spreads the stops apart, below 1 draws them together. |