diff --git a/plugins/SolidView/xray_composite.shader b/plugins/SolidView/xray_composite.shader index 634dd33f70..55e2167308 100644 --- a/plugins/SolidView/xray_composite.shader +++ b/plugins/SolidView/xray_composite.shader @@ -51,8 +51,9 @@ fragment = result = layer0 * layer0.a + result * (1.0 - layer0.a); - float intersection_count = texture2D(u_layer2, v_uvs).r * 255.0; - if(mod(intersection_count, 2.0) >= 1.0) + 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) { 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); @@ -126,8 +127,9 @@ fragment41core = result = layer0 * layer0.a + result * (1.0 - layer0.a); - float intersection_count = texture(u_layer2, v_uvs).r * 255.0; - if(mod(intersection_count, 2.0) >= 1.0) + 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) { 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 8e21bf00c8..51e1cf326f 100644 --- a/plugins/XRayView/xray_composite.shader +++ b/plugins/XRayView/xray_composite.shader @@ -50,8 +50,9 @@ fragment = result = layer0 * layer0.a + result * (1.0 - layer0.a); - float intersection_count = texture2D(u_layer2, v_uvs).r * 255.0; - if(mod(intersection_count, 2.0) >= 1.0) + 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) { result = u_error_color; } @@ -121,8 +122,9 @@ fragment41core = result = layer0 * layer0.a + result * (1.0 - layer0.a); - float intersection_count = texture(u_layer2, v_uvs).r * 255.0; - if(mod(intersection_count, 2.0) >= 1.0) + 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) { result = u_error_color; } diff --git a/resources/shaders/xray.shader b/resources/shaders/xray.shader index 2f36a6fc0e..c375d4300c 100644 --- a/resources/shaders/xray.shader +++ b/resources/shaders/xray.shader @@ -12,7 +12,7 @@ vertex = } fragment = - const lowp vec4 u_color = vec4(1.0 / 255.0, 0.0, 0.0, 1.0); + uniform vec4 u_color; void main() { @@ -34,7 +34,8 @@ vertex41core = fragment41core = #version 410 - const lowp vec4 u_color = vec4(1.0 / 255.0, 0.0, 0.0, 1.0); + + uniform vec4 u_color; out vec4 frag_color; @@ -44,6 +45,7 @@ fragment41core = } [defaults] +u_color = [0.02, 0.02, 0.02, 1.0] [bindings] u_modelMatrix = model_matrix