Fixed z-fighting between contour around the area selected by smart fill and painted triangles inside the FDM support painting gizmo.

This commit is contained in:
Lukáš Hejl 2021-10-15 18:50:56 +02:00
parent b45675b4e1
commit 0c2d9f01a6
5 changed files with 15 additions and 16 deletions

View file

@ -32,6 +32,8 @@ struct SlopeDetection
uniform vec4 uniform_color;
uniform SlopeDetection slope;
uniform bool offset_depth_buffer;
#ifdef ENABLE_ENVIRONMENT_MAP
uniform sampler2D environment_tex;
uniform bool use_environment_tex;
@ -69,4 +71,9 @@ void main()
else
#endif
gl_FragColor = vec4(vec3(intensity.y) + color * intensity.x, alpha);
// In the support painting gizmo and the seam painting gizmo are painted triangles rendered over the already
// rendered object. To resolved z-fighting between previously rendered object and painted triangles, values
// inside the depth buffer are offset by small epsilon for painted triangles inside those gizmos.
gl_FragDepth = gl_FragCoord.z - (offset_depth_buffer ? EPSILON : 0.0);
}