Primitive color grading controls

This commit is contained in:
Emmanuel BENOîT 2017-10-05 12:56:52 +02:00
parent af2e8eb05c
commit 63561039c8
3 changed files with 49 additions and 27 deletions

View file

@ -6,16 +6,11 @@ layout( location = 0 ) uniform sampler2D u_MainInput;
layout( location = 1 ) uniform sampler2D u_BlurInput;
layout( location = 2 ) uniform vec2 u_OutputSize;
layout( location = 3 ) uniform vec2 u_Bloom;
// Vignette parameters
// 1.x = shape multiplier
// 1.y = shape power
// 1.z = aspect ratio
// 1.w = reverse power multiplier
// 2.x = apply base
// 2.y = apply max
layout( location = 4 ) uniform vec4 u_Vignette1;
layout( location = 5 ) uniform vec2 u_Vignette2;
layout( location = 6 ) uniform vec3 u_ColorLift;
layout( location = 7 ) uniform vec3 u_ColorGain;
layout( location = 8 ) uniform vec3 u_ColorGamma;
#define uVigShapeMul (u_Vignette1.x)
#define uVigShapePow (u_Vignette1.y)
@ -41,11 +36,8 @@ void main( void )
}
o_Color = o_Color + bloom / 2.2;
// Color grading test
vec3 uColorGain = vec3( .95 , 1.1 , 1.4 ) ,
uColorLift = vec3( 0 , 0 , .003 ) ,
uColorGamma = vec3( -.2 , 0.1 , .1 );
o_Color = ( o_Color * ( uColorGain - uColorLift ) ) + uColorLift;
// Color grading
o_Color = ( o_Color * ( u_ColorGain - u_ColorLift ) ) + u_ColorLift;
// Vignette
vec2 vShape = pow( abs( pos * 2 - 1 ) * uVigShapeMul ,
@ -60,5 +52,5 @@ void main( void )
o_Color = o_Color / ( o_Color + 1. );
// Gamma
o_Color = pow( o_Color , vec3( 1 ) / ( uColorGamma + 2.2 ) );
o_Color = pow( o_Color , vec3( 1 ) / ( u_ColorGamma + 2.2 ) );
}