cdl
Implements the film industry standard ASC CDL for primary color correction, enabling professional-grade grading by independently controlling Slope, Offset, Power, and Saturation.
Core Advantages
It adheres to an industry standard, allowing developers to directly use parameters set by artists in professional grading software (e.g., DaVinci Resolve) to perfectly replicate cinematic looks, dramatically simplifying professional workflows and encapsulating complex safe-power and color-space-correct math.
Common Uses
As a full-screen post-processing effect to set the overall cinematic mood and artistic tone of a scene.
To accurately replicate color grading schemes in-engine by using CDL parameters exported from professional software.
To simulate environmental changes, like a smooth day-to-night transition, by dynamically adjusting its parameters.
To apply local color adjustments, such as creating a vignette effect, by using a mask.
How to adjust
Color grading is done by adjusting four core parameters: `offset` (brightness/lift) primarily affects the shadows; `slope` (contrast) primarily affects the highlights; `power` (gamma) adjusts the mid-tones without changing the black and white points; and `saturation` controls color vibrancy. Combining these allows for complex, cinematic color grades.
Code Examples
1// Apply the full CDL transformation
2const finalColor = cdl(
3 sceneTexture( uv ), // Input color from the scene texture
4 slope, // (vec3) for contrast
5 offset, // (vec3) for brightness/lift
6 power, // (vec3) for gamma/mid-tones
7 saturation // (float) for vibrance
8);