diff options
author | Tim Kuipers <t.kuipers@ultimaker.com> | 2019-10-22 12:37:39 +0300 |
---|---|---|
committer | Tim Kuipers <t.kuipers@ultimaker.com> | 2020-02-27 18:41:20 +0300 |
commit | 1b2cc7f7a78ae92ccad0962381b6f013d984c3e0 (patch) | |
tree | 1947e52be830734b909909b1a0af87ea34108365 /plugins/SolidView | |
parent | 4a8385e3e8b91e0a6443b104b4d6a6320648314f (diff) |
make xray error noise depend on background color
Diffstat (limited to 'plugins/SolidView')
-rw-r--r-- | plugins/SolidView/xray_composite.shader | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/SolidView/xray_composite.shader b/plugins/SolidView/xray_composite.shader index db661d5540..d5732d3757 100644 --- a/plugins/SolidView/xray_composite.shader +++ b/plugins/SolidView/xray_composite.shader @@ -61,7 +61,8 @@ fragment = float intersection_count = texture2D(u_layer2, v_uvs).r * 255.0; if(mod(intersection_count, 2.0) >= 1.0) { - if (hash12(v_uvs) > 0.5) + float lightness = (result.r + result.g + result.b) / 3.0; + if (hash12(v_uvs) < lightness) { result = result * (1.0 - u_xray_error_strength) + u_xray_error_strength * u_error_color; } @@ -149,7 +150,8 @@ fragment41core = float intersection_count = texture(u_layer2, v_uvs).r * 255.0; if(mod(intersection_count, 2.0) >= 1.0) { - if (hash12(v_uvs) > 0.5) + float lightness = (result.r + result.g + result.b) / 3.0; + if (hash12(v_uvs) < lightness) { result = result * (1.0 - u_xray_error_strength) + u_xray_error_strength * u_error_color; } |