use correct LOD depthbuffer on depth-bsaed effects (ssao, water fog, ss shadows, ect)

This commit is contained in:
Xonk
2025-12-29 21:14:29 -05:00
parent 3ad4a73531
commit abad444311
4 changed files with 15 additions and 10 deletions
+10 -4
View File
@@ -262,7 +262,7 @@ float convertHandDepth_2(in float depth, bool hand) {
}
vec2 SSAO(
vec3 viewPos, vec3 normal, vec3 flatnormal, bool hand, float noise
vec3 viewPos, vec3 normal, vec3 flatnormal, bool hand, float noise, bool isLOD
){
int samples = 7;
@@ -294,8 +294,14 @@ vec2 SSAO(
#ifdef USING_LOD_MOD
float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, offsetUV, 0).x, hand);
float sampleDHDepth = texelFetch2D(LOD_DEPTHBUFFER_OPAQUE, offsetUV, 0).x;
float sampleDHDepth = 1.0;
float sampleDepth = 1.0;
if(isLOD){
sampleDHDepth = texelFetch2D(LOD_DEPTHBUFFER_TRANSLUCENT, offsetUV, 0).x;
}else{
sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, offsetUV, 0).x, hand);
}
vec3 offsetViewPos = toScreenSpace_DH((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), sampleDepth, sampleDHDepth);
#else
float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, offsetUV, 0).x, hand);
@@ -420,7 +426,7 @@ void main() {
#if indirect_effect == SSAO_FILTERED || indirect_effect == SSAO_HQ
if(z >= 1.0) FlatNormals = normal;
vec2 SSAO_SSS = SSAO(viewPos, worldToView(normal), worldToView(FlatNormals), hand, noise);
vec2 SSAO_SSS = SSAO(viewPos, worldToView(normal), worldToView(FlatNormals), hand, noise, z >= 1.0);
SSAO_SSS.y = clamp(SSAO_SSS.y + 0.5 * lightmap.y*lightmap.y,0.0,1.0);
+3 -3
View File
@@ -367,7 +367,7 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo
#ifdef USING_LOD_MOD
float sampleDepth = 0.0;
if(depthCheck){
sampleDepth = texelFetch2D(LOD_DEPTHBUFFER_OPAQUE, ivec2(newPos.xy/texelSize),0).x;
sampleDepth = texelFetch2D(LOD_DEPTHBUFFER_TRANSLUCENT, ivec2(newPos.xy/texelSize),0).x;
}else{
sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, ivec2(newPos.xy/texelSize),0).x,hand);
}
@@ -772,8 +772,8 @@ void main() {
#ifdef USING_LOD_MOD
float DH_mixedLinearZ = sqrt(texture2D(colortex12,texcoord).a/65000.0);
float DH_depth0 = texture2D(LOD_DEPTHBUFFER_TRANSLUCENT,texcoord).x;
float DH_depth1 = texture2D(LOD_DEPTHBUFFER_OPAQUE,texcoord).x;
float DH_depth0 = texture2D(LOD_DEPTHBUFFER_OPAQUE,texcoord).x;
float DH_depth1 = texture2D(LOD_DEPTHBUFFER_TRANSLUCENT ,texcoord).x;
float depthOpaque = z;
float depthOpaqueL = linearizeDepthFast(depthOpaque, near, farPlane);
+1 -1
View File
@@ -320,7 +320,7 @@ vec4 computeTAA(vec2 texcoord, bool hand){
//use velocity from the nearest texel from camera in a 3x3 box in order to improve edge quality in motion
#ifdef USING_LOD_MOD
bool depthCheck = texture2D(depthtex0,adjTC).x >= 1.0;
vec3 closestToCamera = closestToCamera5taps_DH(adjTC, depthtex0, LOD_DEPTHBUFFER_TRANSLUCENT, depthCheck);
vec3 closestToCamera = closestToCamera5taps_DH(adjTC, depthtex0, LOD_DEPTHBUFFER_OPAQUE, depthCheck);
vec3 viewPos = toScreenSpace_DH_special(closestToCamera, depthCheck);
#else
vec3 closestToCamera = closestToCamera5taps(adjTC, depthtex0);
+1 -2
View File
@@ -16,8 +16,7 @@
"samplers": [
"noisetex",
"colortex4",
"colortex5",
"colortex16"
"colortex5"
],
"uniforms": [
"vxRenderDistance",