purkinje tweak (fix color clamping)

This commit is contained in:
Xonk 2023-10-08 18:02:07 -04:00
parent c39a3fadb4
commit 63e7669f8f
3 changed files with 11 additions and 14 deletions

View File

@ -107,26 +107,20 @@ void main() {
float lightScat = clamp(BLOOM_STRENGTH * 0.05 * pow(exposure.a, 0.2) ,0.0,1.0)*vignette; 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 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 float purkinje = rodExposureDepth.x/(1.0+rodExposureDepth.x)*Purkinje_strength;
// col *= exposure.rgb; 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; col = (mix(col, bloom, VL_abs) + bloom * lightScat) * exposure.rgb;
//Purkinje Effect //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 lum2 = dot(col,vec3(0.85,0.7,0.45))/2;
float rodLum = lum2*400.; float rodLum = lum2*400.;
float rodCurve = mix(1.0, rodLum/(2.5+rodLum), purkinje); 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 #ifndef USE_ACES_COLORSPACE_APPROXIMATION
col = LinearTosRGB(TONEMAP(col)); col = LinearTosRGB(TONEMAP(col));

View File

@ -1,9 +1,11 @@
#include "/lib/settings.glsl" #include "/lib/settings.glsl"
varying vec2 texcoord; varying vec2 texcoord;
uniform sampler2D colortex4;
flat varying vec4 exposure; flat varying vec4 exposure;
flat varying vec2 rodExposureDepth; flat varying vec2 rodExposureDepth;
uniform sampler2D colortex4;
//////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN//////////////////////////////

View File

@ -151,7 +151,7 @@ void main() {
#ifdef HURT_AND_DEATH_EFFECT #ifdef HURT_AND_DEATH_EFFECT
PlayerDamagedEffect(col); PlayerDamagedEffect(col);
#endif #endif
vec3 FINAL_COLOR = clamp(int8Dither(col,texcoord),0.0,1.0); vec3 FINAL_COLOR = clamp(int8Dither(col,texcoord),0.0,1.0);
#ifdef COLOR_CURVE #ifdef COLOR_CURVE
@ -160,6 +160,7 @@ void main() {
applyContrast(FINAL_COLOR, CONTRAST); // for fun applyContrast(FINAL_COLOR, CONTRAST); // for fun
gl_FragColor.rgb = FINAL_COLOR; gl_FragColor.rgb = FINAL_COLOR;