From adaa2db9e669247348fd3eed9a13f1a79232f7d9 Mon Sep 17 00:00:00 2001 From: Xonk Date: Wed, 2 Aug 2023 18:31:56 -0400 Subject: [PATCH] Fix water exploding on iris. tweak RTAO / SSGI's AO to look more like it used to in bliss v2 --- shaders/composite1.fsh | 23 +++++++++++++++++------ shaders/composite10.fsh | 3 +++ shaders/composite11.fsh | 17 +++++++++++++---- shaders/composite2.fsh | 6 ++---- shaders/composite3.fsh | 4 ++-- shaders/gbuffers_all_solid.fsh | 2 +- shaders/lib/diffuse_lighting.glsl | 2 +- 7 files changed, 39 insertions(+), 18 deletions(-) diff --git a/shaders/composite1.fsh b/shaders/composite1.fsh index b92cf20..19db627 100644 --- a/shaders/composite1.fsh +++ b/shaders/composite1.fsh @@ -590,7 +590,10 @@ void ApplySSRT(inout vec3 lighting, vec3 normal,vec2 noise,vec3 fragpos, vec2 li skycontribution = (skyCloudsFromTex(rayDir, colortex4).rgb / 15.0) * skyLM + torchlight; #else if(isGrass) rayDir.y = clamp(rayDir.y + 0.25,-1,1); - skycontribution = skylightcolor * max(rayDir.y * min(AO_Strength,1.0), 0.05) + torchlight; + + float SkyLightDir = rayDir.y > 0.0 ? 1.0 : max(rayDir.y,0.25); // the positons where the occlusion happens + + skycontribution = skylightcolor * SkyLightDir + torchlight; #endif if (rayHit.z < 1.){ @@ -599,9 +602,10 @@ void ApplySSRT(inout vec3 lighting, vec3 normal,vec2 noise,vec3 fragpos, vec2 li vec3 previousPosition = mat3(gbufferModelViewInverse) * toScreenSpace(rayHit) + gbufferModelViewInverse[3].xyz + cameraPosition-previousCameraPosition; previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz; previousPosition.xy = projMAD(gbufferPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5; + if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0){ radiance += (texture2D(colortex5,previousPosition.xy).rgb + skycontribution) * GI_Strength; - }else{ + } else{ radiance += skycontribution; } @@ -610,6 +614,7 @@ void ApplySSRT(inout vec3 lighting, vec3 normal,vec2 noise,vec3 fragpos, vec2 li #endif occlusion += skycontribution * GI_Strength; + } else { radiance += skycontribution; @@ -618,7 +623,14 @@ void ApplySSRT(inout vec3 lighting, vec3 normal,vec2 noise,vec3 fragpos, vec2 li occlusion *= AO_Strength; - lighting = max(radiance/nrays - occlusion/nrays, 0.0); + lighting = radiance/nrays - occlusion/nrays; + + + + // lighting = GI ; + // radiance = radiance/nrays - (skycontribution + occlusion/nrays); + // lighting = skycontribution - occlusion/nrays + radiance; + } @@ -853,7 +865,7 @@ void main() { bool lightningBolt = abs(dataUnpacked1.w-0.50) <0.01; bool entities = abs(dataUnpacked1.w-0.45) < 0.01; bool hand = abs(dataUnpacked1.w-0.75) < 0.01; - bool blocklights = abs(dataUnpacked1.w-0.8) <0.01; + // bool blocklights = abs(dataUnpacked1.w-0.8) <0.01; bool isGrass = abs(dataUnpacked1.w-0.60) < 0.01; float vanilla_AO = normalAndAO.a; @@ -1129,7 +1141,6 @@ void main() { //////////////////////////////// UNDER WATER SHADING //////////////////////////////// //////////////////////////////// //////////////////////////////// - vec3 waterabsorb_speculars = vec3(1); if ((isEyeInWater == 0 && iswater) || (isEyeInWater == 1 && !iswater)){ vec3 fragpos0 = toScreenSpace(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z0)); @@ -1153,7 +1164,7 @@ void main() { // Indirect_lighting *= 0.5 + max(pow(Ambient_Caustics, 2.0),0.0); DirectLightColor *= Absorbtion; - Indirect_lighting = (Indirect_lighting/exp2(-estimatedDepth*0.5)) * Absorbtion; + if(isEyeInWater == 1 ) Indirect_lighting = (Indirect_lighting/exp2(-estimatedDepth*0.5)) * Absorbtion; if(isEyeInWater == 0) DirectLightColor *= max(eyeBrightnessSmooth.y/240., 0.0); DirectLightColor *= cloudShadow; diff --git a/shaders/composite10.fsh b/shaders/composite10.fsh index b0ffc65..dcf701b 100644 --- a/shaders/composite10.fsh +++ b/shaders/composite10.fsh @@ -85,6 +85,7 @@ void main() { /* DRAWBUFFERS:3 */ vec2 resScale = vec2(1920.,1080.)/(max(vec2(viewWidth,viewHeight),vec2(1920.0,1080.))/BLOOM_QUALITY); vec2 texcoord = ((gl_FragCoord.xy)*2.+0.5)*texelSize; + vec3 bloom = texture2D_bicubic(colortex3,texcoord/2.0).rgb; //1/4 res bloom += texture2D_bicubic(colortex6,texcoord/4.).rgb; //1/8 res @@ -94,7 +95,9 @@ bloom += texture2D_bicubic(colortex6,texcoord/8.+vec2(0.25*resScale.x+2.5*texelS bloom += texture2D_bicubic(colortex6,texcoord/16.+vec2(0.375*resScale.x+4.5*texelSize.x,.0)).rgb; //1/32 res bloom += texture2D_bicubic(colortex6,texcoord/32.+vec2(0.4375*resScale.x+6.5*texelSize.x,.0)).rgb*1.0; //1/64 res + bloom += texture2D_bicubic(colortex6,texcoord/64.+vec2(0.46875*resScale.x+8.5*texelSize.x,.0)).rgb*1.0; //1/128 res + bloom += texture2D_bicubic(colortex6,texcoord/128.+vec2(0.484375*resScale.x+10.5*texelSize.x,.0)).rgb*1.0; //1/256 res //bloom = texture2D_bicubic(colortex6,texcoord).rgb*6.; //1/8 res diff --git a/shaders/composite11.fsh b/shaders/composite11.fsh index dd736cb..37e6541 100644 --- a/shaders/composite11.fsh +++ b/shaders/composite11.fsh @@ -104,18 +104,27 @@ void main() { - vec3 bloom = texture2D(colortex3,texcoord/clampedRes*vec2(1920.,1080.)*0.5*BLOOM_QUALITY).rgb/2./7.0; + // vec3 bloom = (texture2D(colortex3,texcoord/clampedRes*vec2(1920.,1080.)*0.5*BLOOM_QUALITY).rgb)/2./7.0; - float lightScat = clamp(BLOOM_STRENGTH * 0.05 * pow(exposure.a ,0.2) ,0.0,1.0)*vignette; + vec3 bloom = texture2D(colortex3, texcoord/clampedRes*vec2(1920.,1080.)*0.5*BLOOM_QUALITY).rgb / 2.0 / 7.0; + + + 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); - float lightleakfix = clamp(eyeBrightnessSmooth.y/240.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; - col = (mix(col,bloom,VL_abs)+bloom * lightScat) * mix(exposure.rgb,min(exposure.rgb,0.01), 0); + col = (mix(col,bloom,VL_abs)+bloom * lightScat) * exposure.rgb; //Purkinje Effect float lum = dot(col,vec3(0.15,0.3,0.55)); diff --git a/shaders/composite2.fsh b/shaders/composite2.fsh index 2766b87..b9610d1 100644 --- a/shaders/composite2.fsh +++ b/shaders/composite2.fsh @@ -344,8 +344,6 @@ void main() { #endif if (isEyeInWater == 0){ - - vec3 fragpos = toScreenSpace(vec3(tc/RENDER_SCALE,z)); #ifdef Cumulus @@ -372,9 +370,9 @@ void main() { gl_FragData[0] = clamp(VL_Fog,0.0,65000.); #endif + } - - } else { + if (isEyeInWater == 1){ float dirtAmount = Dirt_Amount; vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B); diff --git a/shaders/composite3.fsh b/shaders/composite3.fsh index 9ac05ec..161d80a 100644 --- a/shaders/composite3.fsh +++ b/shaders/composite3.fsh @@ -311,8 +311,8 @@ void main() { } // apply VL fog to the scene - color *= vl.a; - color += vl.rgb; + // color *= vl.a; + // color += vl.rgb; // bloomy rain effect float rainDrops = clamp(texture2D(colortex9,texcoord).a, 0.0,1.0); diff --git a/shaders/gbuffers_all_solid.fsh b/shaders/gbuffers_all_solid.fsh index 3e3b8c1..a5597fc 100644 --- a/shaders/gbuffers_all_solid.fsh +++ b/shaders/gbuffers_all_solid.fsh @@ -425,7 +425,7 @@ void main() { #endif #ifdef WhiteWorld - Albedo.rgb = vec3(1.0); + Albedo.rgb = vec3(0.5); #endif #ifdef AEROCHROME_MODE diff --git a/shaders/lib/diffuse_lighting.glsl b/shaders/lib/diffuse_lighting.glsl index 3c6c5fd..d7c7a01 100644 --- a/shaders/lib/diffuse_lighting.glsl +++ b/shaders/lib/diffuse_lighting.glsl @@ -11,7 +11,7 @@ void DoRTAmbientLighting (vec3 TorchColor, vec2 Lightmap, inout float SkyLM, ino SkyLM = (pow(Lightmap.y,15.0)*2.0 + pow(Lightmap.y,2.5))*0.5; - SkyLight = (SkyLight * ambient_brightness) / 10.0; + SkyLight = (SkyLight * ambient_brightness) / 30.0; SkyLight = max(SkyLight * SkyLM, vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.025 + nightVision)); }