From 63e7669f8f60c7e5827faef02fbd0a91bcadf156 Mon Sep 17 00:00:00 2001 From: Xonk Date: Sun, 8 Oct 2023 18:02:07 -0400 Subject: [PATCH] purkinje tweak (fix color clamping) --- shaders/dimensions/composite11.fsh | 18 ++++++------------ shaders/dimensions/composite11.vsh | 4 +++- shaders/dimensions/final.fsh | 3 ++- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/shaders/dimensions/composite11.fsh b/shaders/dimensions/composite11.fsh index f2f164b..68cce22 100644 --- a/shaders/dimensions/composite11.fsh +++ b/shaders/dimensions/composite11.fsh @@ -107,26 +107,20 @@ void main() { float lightScat = clamp(BLOOM_STRENGTH * 0.05 * pow(exposure.a, 0.2) ,0.0,1.0)*vignette; float VL_abs = texture2D(colortex7,texcoord*RENDER_SCALE).r; - float purkinje = rodExposureDepth.x/(1.0+rodExposureDepth.x)*Purkinje_strength; - - VL_abs = clamp( (1.0-VL_abs)*BLOOMY_FOG*0.75*(1.0-purkinje),0.0,1.0)*clamp(1.0-pow(cdist(texcoord.xy),15.0),0.0,1.0); - - // bloom *= lightScat; - // apply bloom and bloomy fog - // col = mix(col, bloom, VL_abs); - // col += bloom*lightScat; - // // apply exposure - // col *= exposure.rgb; + float purkinje = rodExposureDepth.x/(1.0+rodExposureDepth.x)*Purkinje_strength; + VL_abs = clamp((1.0-VL_abs)*BLOOMY_FOG*0.75*(1.0-purkinje*0.3)*(1.0+rainStrength),0.0,1.0)*clamp(1.0-pow(cdist(texcoord.xy),15.0),0.0,1.0); + col = (mix(col, bloom, VL_abs) + bloom * lightScat) * exposure.rgb; //Purkinje Effect - float lum = dot(col,vec3(0.15,0.3,0.55)); + float lum = dot(col,vec3(0.15,0.3,0.55)); float lum2 = dot(col,vec3(0.85,0.7,0.45))/2; float rodLum = lum2*400.; float rodCurve = mix(1.0, rodLum/(2.5+rodLum), purkinje); - col = mix(clamp(lum,0.0,0.05)*Purkinje_Multiplier*vec3(Purkinje_R, Purkinje_G, Purkinje_B)+1.5e-3, col, rodCurve); + + col = mix(lum*Purkinje_Multiplier*vec3(Purkinje_R, Purkinje_G, Purkinje_B)+1.5e-3, col, rodCurve); #ifndef USE_ACES_COLORSPACE_APPROXIMATION col = LinearTosRGB(TONEMAP(col)); diff --git a/shaders/dimensions/composite11.vsh b/shaders/dimensions/composite11.vsh index 3763c38..7bc787d 100644 --- a/shaders/dimensions/composite11.vsh +++ b/shaders/dimensions/composite11.vsh @@ -1,9 +1,11 @@ #include "/lib/settings.glsl" varying vec2 texcoord; + +uniform sampler2D colortex4; + flat varying vec4 exposure; flat varying vec2 rodExposureDepth; -uniform sampler2D colortex4; //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// diff --git a/shaders/dimensions/final.fsh b/shaders/dimensions/final.fsh index 2f294f5..17fa87b 100644 --- a/shaders/dimensions/final.fsh +++ b/shaders/dimensions/final.fsh @@ -151,7 +151,7 @@ void main() { #ifdef HURT_AND_DEATH_EFFECT PlayerDamagedEffect(col); #endif - + vec3 FINAL_COLOR = clamp(int8Dither(col,texcoord),0.0,1.0); #ifdef COLOR_CURVE @@ -160,6 +160,7 @@ void main() { applyContrast(FINAL_COLOR, CONTRAST); // for fun + gl_FragColor.rgb = FINAL_COLOR;