home/ atoms/ pow-contrast-enhancement

Applying pow() with a value slightly above 1.0 to the final color enhances contrast by darkening shadows without affecting highlights

The GLSL pow(x, p) function raises x to the power p. When x is in the [0,1] range and p > 1, the function creates a non-linear curve that accentuates darker values (pushes them darker) while having a smaller effect on values near 1.0 (highlights). pow(color, 1.2) applied to the final color output is a common shader post-processing trick equivalent to a mild ‘gamma darken’ — it visually increases perceived contrast and separates dark detail from near-black, making the composition pop without losing highlights. Taking pow(color, 2.0) would be too aggressive for most cases. This is the same principle as gamma correction (pow(x, 2.2) converts linear to sRGB) but used aesthetically.

Examples

// At end of shader:
fragColor = vec4(pow(finalColor, vec3(1.2)), 1.0);
// Lifts perceived contrast: blacks get darker, mid-tones shift down slightly

Assessment

Sketch or plot pow(x, 1.0), pow(x, 1.2), and pow(x, 2.0) over x=[0,1]. At x=0.5, what is the output of each? Explain what you would see visually when you apply pow(color, 1.2) to a gradient that goes from black to white.

“let's utilize the power function to enhance the overall contrast of the image when the input ranges from 0 to 1 the pow function effectively accentuates the darker colors closer to zero while having a lesser effect on the lighter Shades”
corpus · kishimisu-an-introduction-to-shader-art-coding-video · chunk 3