From 890b6dc0b4243d41892c676e82b63ba18cc2256c Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Thu, 27 Feb 2020 20:03:35 +0100 Subject: [PATCH] prevent false negative xray error for high overlap count --- plugins/SolidView/xray_composite.shader | 4 ++-- plugins/XRayView/xray_composite.shader | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/SolidView/xray_composite.shader b/plugins/SolidView/xray_composite.shader index c67e3392f3..6eccc2d4e5 100644 --- a/plugins/SolidView/xray_composite.shader +++ b/plugins/SolidView/xray_composite.shader @@ -53,7 +53,7 @@ fragment = float intersection_count = texture2D(u_layer2, v_uvs).r * 51; // (1 / .02) + 1 (+1 magically fixes issues with high intersection count models) float rest = mod(intersection_count + .01, 2.0); - if (rest > 1.0 && rest < 1.5) + if (rest > 1.0 && rest < 1.5 && intersection_count < 49) { vec2 scaling = textureSize(u_layer0, 0) / textureSize(u_xray_error, 0); result = result * (1.0 - u_xray_error_strength) + u_xray_error_strength * texture(u_xray_error, v_uvs * scaling); @@ -129,7 +129,7 @@ fragment41core = float intersection_count = texture(u_layer2, v_uvs).r * 51; // (1 / .02) + 1 (+1 magically fixes issues with high intersection count models) float rest = mod(intersection_count + .01, 2.0); - if (rest > 1.0 && rest < 1.5) + if (rest > 1.0 && rest < 1.5 && intersection_count < 49) { vec2 scaling = textureSize(u_layer0, 0) / textureSize(u_xray_error, 0); result = result * (1.0 - u_xray_error_strength) + u_xray_error_strength * texture(u_xray_error, v_uvs * scaling); diff --git a/plugins/XRayView/xray_composite.shader b/plugins/XRayView/xray_composite.shader index 41b02a54a5..d8c90a5259 100644 --- a/plugins/XRayView/xray_composite.shader +++ b/plugins/XRayView/xray_composite.shader @@ -52,7 +52,7 @@ fragment = float intersection_count = texture2D(u_layer2, v_uvs).r * 51; // (1 / .02) + 1 (+1 magically fixes issues with high intersection count models) float rest = mod(intersection_count + .01, 2.0); - if (rest > 1.0 && rest < 1.5) + if (rest > 1.0 && rest < 1.5 && intersection_count < 49) { result = u_error_color; } @@ -124,7 +124,7 @@ fragment41core = float intersection_count = texture(u_layer2, v_uvs).r * 51; // (1 / .02) + 1 (+1 magically fixes issues with high intersection count models) float rest = mod(intersection_count + .01, 2.0); - if (rest > 1.0 && rest < 1.5) + if (rest > 1.0 && rest < 1.5 && intersection_count < 49) { result = u_error_color; }