Browse Source

Don't show overhang on first layer or below buildplate.

Remco Burema 4 years ago
parent
commit
3717181884
1 changed files with 2 additions and 2 deletions
  1. 2 2
      resources/shaders/overhang.shader

+ 2 - 2
resources/shaders/overhang.shader

@@ -61,7 +61,7 @@ fragment =
         highp float NdotR = clamp(dot(viewVector, reflectedLight), 0.0, 1.0);
         finalColor += pow(NdotR, u_shininess) * u_specularColor;
 
-        finalColor = (-normal.y > u_overhangAngle) ? u_overhangColor : finalColor;
+        finalColor = (f_vertex.y > 0.0001 && -normal.y > u_overhangAngle) ? u_overhangColor : finalColor;
 
         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;
@@ -138,7 +138,7 @@ fragment41core =
         highp float NdotR = clamp(dot(viewVector, reflectedLight), 0.0, 1.0);
         finalColor += pow(NdotR, u_shininess) * u_specularColor;
 
-        finalColor = (u_faceId != gl_PrimitiveID) ? ((-normal.y > u_overhangAngle) ? u_overhangColor : finalColor) : u_faceColor;
+        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)