fix underwater fog

This commit is contained in:
Xonk
2023-04-26 00:28:18 -04:00
parent b12c2491cf
commit 3b375c2b75
7 changed files with 102 additions and 89 deletions

View File

@ -103,7 +103,7 @@ void main() {
#ifndef WEATHER
gl_FragData[1].a = 0.0; // for bloomy rain
gl_FragData[0] = TEXTURE;
gl_FragData[0] = TEXTURE;
vec3 Albedo = toLinear(gl_FragData[0].rgb);
vec2 tempOffset = offsets[framemod8];
@ -112,7 +112,7 @@ void main() {
vec3 np3 = normVec(p3);
float Shadows = 0.0;
float Shadows = 1.0;
vec3 p3_shadow = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz;
vec3 projectedShadowPosition = mat3(shadowModelView) * p3_shadow + shadowModelView[3].xyz;
projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
@ -126,7 +126,7 @@ void main() {
float diffthresh = 0.0002;
projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5,0.5,0.5);
Shadows += shadow2D_bicubic(shadow,vec3(projectedShadowPosition + vec3(0.0,0.0,-diffthresh*1.2)));
Shadows = shadow2D_bicubic(shadow,vec3(projectedShadowPosition + vec3(0.0,0.0,-diffthresh*1.2)));
}
#ifdef CLOUDS_SHADOWS
@ -134,7 +134,7 @@ void main() {
#endif
float lightleakfix = clamp(eyeBrightnessSmooth.y/240.0,0.0,1.0);
float phase = phaseg(clamp(dot(np3, WsunVec),0.0,1.0), 0.7) + 1.0 ;
float phase = phaseg(clamp(dot(np3, WsunVec),0.0,1.0),(1.0-gl_FragData[0].a) * 0.8 + 0.1) + 1.0 ;
vec3 Direct_lighting = DoDirectLighting(lightCol.rgb/80., Shadows, 1.0, 0.0) * phase * lightleakfix;
vec3 Indirect_lighting = DoAmbientLighting(avgAmbient, vec3(TORCH_R,TORCH_G,TORCH_B), lmtexcoord.zw, 5.0);