Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
34 views1 page

Vibrance H

The document describes a Vibrance function that enhances pixel saturation based on their color intensity, ensuring that less saturated pixels receive a greater boost than already saturated ones. It includes a code snippet that calculates the luma of a color and adjusts its RGB values accordingly. The function aims to prevent oversaturation while improving overall image vibrancy.

Uploaded by

Mohamed Ouattara
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views1 page

Vibrance H

The document describes a Vibrance function that enhances pixel saturation based on their color intensity, ensuring that less saturated pixels receive a greater boost than already saturated ones. It includes a code snippet that calculates the luma of a color and adjusts its RGB values accordingly. The function aims to prevent oversaturation while improving overall image vibrancy.

Uploaded by

Mohamed Ouattara
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

/*-----------------------------------------------------------.

/ Vibrance /
'-----------------------------------------------------------*/
/*
by Christian Cann Schuldt Jensen ~ CeeJay.dk

Vibrance intelligently boosts the saturation of pixels


so pixels that had little color get a larger boost than pixels that had a lot.

This avoids oversaturation of pixels that were already very saturated.


*/

float4 VibrancePass( float4 colorInput )


{
float4 color = colorInput; //original input color
float3 lumCoeff = float3(0.212656, 0.715158, 0.072186); //Values to calculate
luma with

float luma = dot(lumCoeff, color.rgb); //calculate luma (grey)

float max_color = max(colorInput.r, max(colorInput.g,colorInput.b)); //Find


the strongest color
float min_color = min(colorInput.r, min(colorInput.g,colorInput.b)); //Find
the weakest color

float color_saturation = max_color - min_color; //The difference between the


two is the saturation

//color.rgb = lerp(luma, color.rgb, (1.0 + (Vibrance * (1.0 -


color_saturation)))); //extrapolate between luma and original by 1 + (1-saturation)
- simple

color.rgb = lerp(luma, color.rgb, (1.0 + (Vibrance * (1.0 - (sign(Vibrance) *


color_saturation))))); //extrapolate between luma and original by 1 + (1-
saturation) - current

//color.rgb = lerp(luma, color.rgb, 1.0 + (1.0-pow(color_saturation, 1.0 -


(1.0-Vibrance))) ); //pow version

return color; //return the result


//return color_saturation.xxxx; //Visualize the saturation
}

You might also like