From 1b2cc7f7a78ae92ccad0962381b6f013d984c3e0 Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Tue, 22 Oct 2019 11:37:39 +0200 Subject: [PATCH] make xray error noise depend on background color --- plugins/SolidView/xray_composite.shader | 6 ++++-- 1 file 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; }