Depth patch

This commit is contained in:
mcrcortex
2025-04-21 20:18:37 +10:00
parent 3684174b67
commit 306951ebee

View File

@@ -6,13 +6,10 @@ layout(binding = 0) uniform sampler2D depthTex;
void main() { void main() {
vec4 depths = textureGather(depthTex, uv, 0); // Get depth values from all surrounding texels. vec4 depths = textureGather(depthTex, uv, 0); // Get depth values from all surrounding texels.
//TODO: fully fix this system bvec4 cv = lessThanEqual(vec4(0.999999f), depths);
if (any(cv)) {//Patch holes (its very dodgy but should work :tm:, should clamp it to the first 3 levels)
depths = mix(vec4(0.0f), depths, cv);
}
//TODO, do it so that for the first 2,3 levels if 1 (or maybe even 2 (on the first layer)) pixels are air, just ignore that
// this is to stop issues with 1 pixel gaps
bvec4 cv = lessThanEqual(vec4(0.99999999), depths);
//if (any(cv) && !all(cv)) {
// depths = mix(vec4(1.0f), depths, cv);
//}
gl_FragDepth = max(max(depths.x, depths.y), max(depths.z, depths.w)); // Write conservative depth. gl_FragDepth = max(max(depths.x, depths.y), max(depths.z, depths.w)); // Write conservative depth.
} }