I have encountered a 3D rendering artifact that's about to drive me crazy. Here's a very minimal example:
triangle1 = {{0.8, 0, 0}, {0.997, 1, 0.5}, {0.8, 1, 0}};
triangle2 = {{1, 0, 0.5}, {1, 1, 0}, {1, 1, 0.5}};
Graphics3D[Polygon[{triangle1, triangle2}]]
This produces the following image on my computer (ThinkPad X1 Carbon, Arch Linux, Mathematica 12.2.0.0):
At the upper right, parts of the edges of triangle1 that should be hidden behind triangle2 are in fact visible (when viewed from certain angles). Here's a zoom:
I've played around with various RenderingOptions
, which made no difference at all. The same artifact is also visible when exporting to PDF.
It's not limited to triangles only. For example, let's add a line segment:
triangle1 = {{0.8, 0, 0}, {0.997, 1, 0.5}, {0.8, 1, 0}};
triangle2 = {{1, 0, 0.5}, {1, 1, 0}, {1, 1, 0.5}};
segment = {{1, 0.95, 0.5}, {0.95, 0.5, 0.4}};
Graphics3D[{Polygon[{triangle1, triangle2}], Line[segment]]
This segment should be completely obscured by triangle2 when viewed from the following angle, but as you can see, part of it bleeds through:
What's going on?!? Does this occur just on my system, or is it reproducible elsewhere? Are there any possible workarounds?