make xray error noise depend on background color

This commit is contained in:
Tim Kuipers 2019-10-22 11:37:39 +02:00
parent 4a8385e3e8
commit 1b2cc7f7a7

View file

@ -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;
}