diff --git a/plugins/SolidView/xray_composite.shader b/plugins/SolidView/xray_composite.shader index 55e2167308..c67e3392f3 100644 --- a/plugins/SolidView/xray_composite.shader +++ b/plugins/SolidView/xray_composite.shader @@ -51,9 +51,9 @@ fragment = result = layer0 * layer0.a + result * (1.0 - layer0.a); - float intersection_count = texture2D(u_layer2, v_uvs).r * 50; // 1 / .02 - float rest = mod(intersection_count, 2.0); - if (rest > 0.5 && rest < 1.5) + 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) { 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); @@ -127,9 +127,9 @@ fragment41core = result = layer0 * layer0.a + result * (1.0 - layer0.a); - float intersection_count = texture(u_layer2, v_uvs).r * 50; // 1 / .02 - float rest = mod(intersection_count, 2.0); - if (rest > 0.5 && rest < 1.5) + 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) { 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 51e1cf326f..41b02a54a5 100644 --- a/plugins/XRayView/xray_composite.shader +++ b/plugins/XRayView/xray_composite.shader @@ -50,9 +50,9 @@ fragment = result = layer0 * layer0.a + result * (1.0 - layer0.a); - float intersection_count = texture2D(u_layer2, v_uvs).r * 50; // 1 / .02 - float rest = mod(intersection_count, 2.0); - if (rest > 0.5 && rest < 1.5) + 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) { result = u_error_color; } @@ -122,9 +122,9 @@ fragment41core = result = layer0 * layer0.a + result * (1.0 - layer0.a); - float intersection_count = texture(u_layer2, v_uvs).r * 50; // 1 / .02 - float rest = mod(intersection_count, 2.0); - if (rest > 0.5 && rest < 1.5) + 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) { result = u_error_color; }