Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Kuipers <t.kuipers@ultimaker.com>2020-02-27 20:42:27 +0300
committerTim Kuipers <t.kuipers@ultimaker.com>2020-02-27 20:42:27 +0300
commit5d90fd31d9828ab430b70cb3183b534b34c50d17 (patch)
tree2b71068ca622dfafb5586d876d13b28be92d0666 /plugins/SolidView
parentb51b6997155b7d074e0e8112b3afedac13ba5d94 (diff)
fix xray for high intersection count models
I don't understand why, but any deviation from this produces worse results
Diffstat (limited to 'plugins/SolidView')
-rw-r--r--plugins/SolidView/xray_composite.shader12
1 files changed, 6 insertions, 6 deletions
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);