diff --git a/plugins/SolidView/SolidView.py b/plugins/SolidView/SolidView.py index bf8eb67782..478cf7331b 100644 --- a/plugins/SolidView/SolidView.py +++ b/plugins/SolidView/SolidView.py @@ -125,7 +125,8 @@ class SolidView(View): self._xray_composite_shader = OpenGL.getInstance().createShaderProgram(os.path.join(PluginRegistry.getInstance().getPluginPath("SolidView"), "xray_composite.shader")) theme = Application.getInstance().getTheme() self._xray_composite_shader.setUniformValue("u_background_color", Color(*theme.getColor("viewport_background").getRgb())) - self._xray_composite_shader.setUniformValue("u_error_color", Color(*theme.getColor("xray_error").getRgb())) + self._xray_composite_shader.setUniformValue("u_xray_error_dark", Color(*theme.getColor("xray_error_dark").getRgb())) + self._xray_composite_shader.setUniformValue("u_xray_error_light", Color(*theme.getColor("xray_error_light").getRgb())) self._xray_composite_shader.setUniformValue("u_outline_color", Color(*theme.getColor("model_selection_outline").getRgb())) if not self.getRenderer().getRenderPass("xray"): diff --git a/plugins/SolidView/xray_composite.shader b/plugins/SolidView/xray_composite.shader index d5732d3757..75bbbf22ec 100644 --- a/plugins/SolidView/xray_composite.shader +++ b/plugins/SolidView/xray_composite.shader @@ -28,7 +28,8 @@ fragment = uniform float u_outline_strength; uniform vec4 u_outline_color; - uniform vec4 u_error_color; + uniform vec4 u_xray_error_dark; + uniform vec4 u_xray_error_light; uniform vec4 u_background_color; uniform float u_xray_error_strength; @@ -62,13 +63,14 @@ fragment = if(mod(intersection_count, 2.0) >= 1.0) { float lightness = (result.r + result.g + result.b) / 3.0; - if (hash12(v_uvs) < lightness) + //if ( (mod((v_uvs.x / u_offset[8].x - v_uvs.y / u_offset[8].y) * 0.1, 2.0) >= 1.0) == (mod((v_uvs.x / u_offset[8].x + v_uvs.y / u_offset[8].y) * 0.1, 2.0) >= 1.0) ) // diamond pattern + if (lightness > 0.5) { - result = result * (1.0 - u_xray_error_strength) + u_xray_error_strength * u_error_color; + result = result * (1.0 - u_xray_error_strength) + u_xray_error_strength * u_xray_error_dark; } else { - result = result * (1.0 - u_xray_error_strength) + u_xray_error_strength * (vec4(1.0) - u_error_color); + result = result * (1.0 - u_xray_error_strength) + u_xray_error_strength * u_xray_error_light; } } @@ -116,7 +118,8 @@ fragment41core = uniform float u_outline_strength; uniform vec4 u_outline_color; - uniform vec4 u_error_color; + uniform vec4 u_xray_error_dark; + uniform vec4 u_xray_error_light; uniform vec4 u_background_color; uniform float u_xray_error_strength; @@ -151,13 +154,14 @@ fragment41core = if(mod(intersection_count, 2.0) >= 1.0) { float lightness = (result.r + result.g + result.b) / 3.0; - if (hash12(v_uvs) < lightness) + //if ( (mod((v_uvs.x / u_offset[8].x - v_uvs.y / u_offset[8].y) * 0.1, 2.0) >= 1.0) == (mod((v_uvs.x / u_offset[8].x + v_uvs.y / u_offset[8].y) * 0.1, 2.0) >= 1.0) ) // diamond pattern + if (lightness > 0.5) { - result = result * (1.0 - u_xray_error_strength) + u_xray_error_strength * u_error_color; + result = result * (1.0 - u_xray_error_strength) + u_xray_error_strength * u_xray_error_dark; } else { - result = result * (1.0 - u_xray_error_strength) + u_xray_error_strength * (vec4(1.0) - u_error_color); + result = result * (1.0 - u_xray_error_strength) + u_xray_error_strength * u_xray_error_light; } } @@ -188,7 +192,9 @@ u_layer2 = 2 u_background_color = [0.965, 0.965, 0.965, 1.0] u_outline_strength = 1.0 u_outline_color = [0.05, 0.66, 0.89, 1.0] -u_error_color = [1.0, 0.0, 0.0, 1.0] +u_error_color = [0.0, 0.0, 0.0, 1.0] +u_xray_error_dark = [1.0, 0.0, 0.0, 1.0] +u_xray_error_light = [1.0, 1.0, 0.0, 1.0] u_xray_error_strength = 0.4 [bindings] diff --git a/resources/themes/cura-dark-colorblind/theme.json b/resources/themes/cura-dark-colorblind/theme.json index 9559101d24..c98fb0c815 100644 --- a/resources/themes/cura-dark-colorblind/theme.json +++ b/resources/themes/cura-dark-colorblind/theme.json @@ -12,6 +12,8 @@ "model_overhang": [200, 0, 255, 255], + "xray_error_dark": [255, 0, 0, 255], + "xray_error_light": [255, 255, 0, 255], "xray": [26, 26, 62, 255], "xray_error": [255, 0, 0, 255], diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index 9db024397a..8df336cfec 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -190,6 +190,8 @@ "model_unslicable_alt": [172, 172, 127, 255], "model_selection_outline": [12, 169, 227, 255], + "xray_error_dark": [255, 0, 0, 255], + "xray_error_light": [255, 255, 0, 255], "xray": [26, 26, 62, 255], "xray_error": [255, 0, 0, 255], diff --git a/resources/themes/cura-light-colorblind/theme.json b/resources/themes/cura-light-colorblind/theme.json index 10349acbfd..5628fad880 100644 --- a/resources/themes/cura-light-colorblind/theme.json +++ b/resources/themes/cura-light-colorblind/theme.json @@ -10,9 +10,10 @@ "y_axis": [64, 64, 255, 255], "model_default": [156, 201, 36, 255], "model_overhang": [200, 0, 255, 255], - "model_selection_outline": [12, 169, 227, 255], + "xray_error_dark": [255, 0, 0, 255], + "xray_error_light": [255, 255, 0, 255], "xray": [26, 26, 62, 255], "xray_error": [255, 0, 0, 255], diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 225e0db569..bb7409da39 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -369,6 +369,8 @@ "model_selection_outline": [50, 130, 255, 255], "model_non_printing": [122, 122, 122, 255], + "xray_error_dark": [255, 0, 0, 255], + "xray_error_light": [255, 255, 0, 255], "xray": [26, 26, 62, 255], "xray_error": [255, 0, 0, 255],