From af2e8eb05cb198161c6b355345b04b0c73eb2cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Thu, 5 Oct 2017 11:47:33 +0200 Subject: [PATCH] Color grading stuff - test (hardcoded) --- shaders/combine.f.glsl | 8 +++++++- shaders/lib/utils.glsl | 2 +- shaders/scene.f.glsl | 8 ++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/shaders/combine.f.glsl b/shaders/combine.f.glsl index 58cdcab..f41c99d 100644 --- a/shaders/combine.f.glsl +++ b/shaders/combine.f.glsl @@ -41,6 +41,12 @@ 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; + // Vignette vec2 vShape = pow( abs( pos * 2 - 1 ) * uVigShapeMul , vec2( uVigShapePow ) ); @@ -54,5 +60,5 @@ void main( void ) o_Color = o_Color / ( o_Color + 1. ); // Gamma - o_Color = pow( o_Color , vec3( 1.0 / 2.2 ) ); + o_Color = pow( o_Color , vec3( 1 ) / ( uColorGamma + 2.2 ) ); } diff --git a/shaders/lib/utils.glsl b/shaders/lib/utils.glsl index 2002da0..3ef367d 100644 --- a/shaders/lib/utils.glsl +++ b/shaders/lib/utils.glsl @@ -19,7 +19,7 @@ float M_Hash( float M_Luminosity( in vec3 color ) { - return dot( color , vec3( .3 , .6 , .1 ) ); + return dot( color , vec3( .299 , .587 , .114 ) ); } vec3 M_NormalizeColor( diff --git a/shaders/scene.f.glsl b/shaders/scene.f.glsl index 10bc448..285e1d4 100644 --- a/shaders/scene.f.glsl +++ b/shaders/scene.f.glsl @@ -14,16 +14,16 @@ T_BPMaterial BPMaterials[1] = { T_PBRMaterial PBRMaterials[1] = { { // Albedo color - vec3( 1 , 1 , .4 ) , + vec3( 1 , 1 , 1 ) , // Roughness , metallic , subsurface , anisotropy - .4 , .7 , 1 , .1 , + .5 , .5 , 0 , 0 , // Specular strength / tint% .5 , .5 } }; vec3 Glow[1] = { - vec3( 2 , .4 , 5 ) * 4 + vec3( .95 , .8 , 1 ) * 5 }; void mapMaterial( @@ -65,7 +65,7 @@ void main( ) int( u_Render.x ) , u_Render.y , u_Render.z , .001 , u_Render.w ); vec3 hitPos = u_CamPos + rayDir * r.x; - const vec3 background = vec3( .01 ); + const vec3 background = vec3( .005 ); vec3 bc = background; if ( r.y >= 0. ) {