diff options
author | Remco Burema <r.burema@ultimaker.com> | 2020-11-20 14:32:58 +0300 |
---|---|---|
committer | Remco Burema <r.burema@ultimaker.com> | 2020-11-20 14:32:58 +0300 |
commit | 2837640315acf20f9e2a3a141c37ba30bba6bb3e (patch) | |
tree | d70e373a04759399f70a646154d46c28cfa006ff /resources/shaders | |
parent | 39acad87d916b32c98e852b9e14b6b76b0070852 (diff) |
Invert colors at lowest print height.
Instead of inverting them if below 0 (build-plate). Fixes #8735
CURA-7871
Diffstat (limited to 'resources/shaders')
-rw-r--r-- | resources/shaders/overhang.shader | 7 | ||||
-rw-r--r-- | resources/shaders/striped.shader | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/resources/shaders/overhang.shader b/resources/shaders/overhang.shader index 3438c1b3ca..e16eb3e224 100644 --- a/resources/shaders/overhang.shader +++ b/resources/shaders/overhang.shader @@ -32,6 +32,7 @@ fragment = uniform lowp float u_overhangAngle; uniform lowp vec4 u_overhangColor; + uniform lowp float u_lowestPrintableHeight; uniform lowp vec4 u_faceColor; uniform highp int u_faceId; @@ -65,7 +66,7 @@ fragment = highp vec3 grid = vec3(f_vertex.x - floor(f_vertex.x - 0.5), f_vertex.y - floor(f_vertex.y - 0.5), f_vertex.z - floor(f_vertex.z - 0.5)); finalColor.a = (u_renderError > 0.5) && dot(grid, grid) < 0.245 ? 0.667 : 1.0; - if (f_vertex.y <= 0.0) + if (f_vertex.y <= u_lowestPrintableHeight) { finalColor.rgb = vec3(1.0, 1.0, 1.0) - finalColor.rgb; } @@ -109,6 +110,7 @@ fragment41core = uniform lowp float u_overhangAngle; uniform lowp vec4 u_overhangColor; + uniform lowp float u_lowestPrintableHeight; uniform lowp vec4 u_faceColor; uniform highp int u_faceId; @@ -141,7 +143,7 @@ fragment41core = finalColor = (u_faceId != gl_PrimitiveID) ? ((f_vertex.y > 0.0001 && -normal.y > u_overhangAngle) ? u_overhangColor : finalColor) : u_faceColor; frag_color = finalColor; - if (f_vertex.y <= 0.0) + if (f_vertex.y <= u_lowestPrintableHeight) { frag_color.rgb = vec3(1.0, 1.0, 1.0) - frag_color.rgb; } @@ -157,6 +159,7 @@ u_overhangColor = [1.0, 0.0, 0.0, 1.0] u_faceColor = [0.0, 0.0, 1.0, 1.0] u_shininess = 20.0 u_renderError = 1.0 +u_lowestPrintableHeight = 0.0 [bindings] u_modelMatrix = model_matrix diff --git a/resources/shaders/striped.shader b/resources/shaders/striped.shader index 31ae2d5047..e83074473d 100644 --- a/resources/shaders/striped.shader +++ b/resources/shaders/striped.shader @@ -36,6 +36,7 @@ fragment = uniform mediump float u_width; uniform bool u_vertical_stripes; + uniform lowp u_lowestPrintableHeight; varying highp vec3 v_position; varying highp vec3 v_vertex; @@ -64,7 +65,7 @@ fragment = highp vec3 viewVector = normalize(u_viewPosition - v_vertex); highp float NdotR = clamp(dot(viewVector, reflectedLight), 0.0, 1.0); finalColor += pow(NdotR, u_shininess) * u_specularColor; - if (v_vertex.y <= 0.0) + if (v_vertex.y <= u_lowestPrintableHeight) { finalColor.rgb = vec3(1.0, 1.0, 1.0) - finalColor.rgb; } @@ -112,6 +113,7 @@ fragment41core = uniform mediump float u_width; uniform mediump bool u_vertical_stripes; + uniform lowp float u_lowestPrintableHeight; in highp vec3 v_position; in highp vec3 v_vertex; @@ -144,7 +146,7 @@ fragment41core = finalColor += pow(NdotR, u_shininess) * u_specularColor; frag_color = finalColor; - if (v_vertex.y <= 0.0) + if (v_vertex.y <= u_lowestPrintableHeight) { frag_color.rgb = vec3(1.0, 1.0, 1.0) - frag_color.rgb; } @@ -160,6 +162,7 @@ u_opacity = 1.0 u_shininess = 20.0 u_width = 5.0 u_vertical_stripes = 0 +u_lowestPrintableHeight = 0.0 [bindings] u_modelMatrix = model_matrix |