From 6c6bcadee50c5c474e37f9c47baf3aa4af5a8e00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Wed, 2 Feb 2022 00:56:58 +0100 Subject: [PATCH] Tighter fit on projection. --- src/main/resources/assets/oc2/shaders/core/projectors.fsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/assets/oc2/shaders/core/projectors.fsh b/src/main/resources/assets/oc2/shaders/core/projectors.fsh index 7b198d81..65d30769 100644 --- a/src/main/resources/assets/oc2/shaders/core/projectors.fsh +++ b/src/main/resources/assets/oc2/shaders/core/projectors.fsh @@ -56,8 +56,8 @@ vec3 getNormal(vec3 worldPos) { bool isInClipBounds(vec3 v) { return v.x >= -1 && v.x <= 1 && - v.y >= -1 && v.y <= 1 && - v.z >= -1 && v.z <= 1; + v.y >= -1 && v.y <= 1 && + v.z >= -1 && v.z <= 1; } float toLinearDepth(float depth, float zNear, float zFar) { @@ -92,7 +92,7 @@ bool getProjectorColor(vec3 worldPos, vec3 worldNormal, mat4 projectorCamera, float projectorDepth = texture2D(projectorDepthSampler, projectorUv).r; float projectorClipDepth = projectorDepth * 2 - 1; - if (projectorClipPos.z < projectorClipDepth + 0.005) { + if (projectorClipPos.z <= projectorClipDepth + 0.0001) { vec4 projectorColor = texture2D(projectorColorSampler, vec2(projectorUv.s, 1 - projectorUv.t)); float dotAttenuation = clamp((d - DOT_EPSILON) / (1 - DOT_EPSILON), 0, 1); float distanceAttenuation = clamp(1 - (linearDepth - START_FADE_DISTANCE) / (MAX_DISTANCE - START_FADE_DISTANCE), 0, 1);