prevent false negative xray error for high overlap count

This commit is contained in:
Tim Kuipers 2020-02-27 20:03:35 +01:00
parent 5d90fd31d9
commit 890b6dc0b4
2 changed files with 4 additions and 4 deletions

View file

@ -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 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); 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); 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); 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 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); 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); 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); result = result * (1.0 - u_xray_error_strength) + u_xray_error_strength * texture(u_xray_error, v_uvs * scaling);

View file

@ -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 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); 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; 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 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); 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; result = u_error_color;
} }