3
$\begingroup$

Screen Shot

My freestyle renders randomly have these glitches in them (circled in red). From what I can tell they appear sometimes where there is geometry in the background that crosses lines in the foregroud - I've highlighted the position of the background lines in yellow in this image to show where they are. To be clear, the geometry in no way intersects, the background object is quite some distance behind the foreground object in 3D space. What could be causing this and how can I fix it?

Edit: Here is a minimal reproduction:

From making this reproduction I learned something. The issue seems to occur when two objects in the background share an edge in the same place. In the example here the "window" is a seperate object aligned to the wall (which has a cut-out hole for the window). Therefore the edges of the window align with the inner edges of the cutout. If an object is then placed in the foreground the freestyle glitch occurs:

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ Could you share a minimal version on blend-exchange.com ? $\endgroup$
    – Robin Betts
    Commented Feb 27, 2023 at 10:05
  • 1
    $\begingroup$ Thank you for your suggestion, this lead me to a better understanding of the issue (see updated question). $\endgroup$
    – John
    Commented Feb 27, 2023 at 12:39

1 Answer 1

3
$\begingroup$

You're on the case by yourself..

No renderer likes Z-fighting. It's curious that, in Freestyle, the symptom shows in a surface well in front of the Z-fighting in the background.. but coincident surfaces seem to have screwed the whole depth-calculation, all the way to the viewing-plane.

The Z-fighting affects all of your Line-Set discriminators, in EEVEE and Cycles.

So the best bet is to avoid all exactly coincident surfaces:

enter image description here

.. on the right, the background window-frame has been moved forward by 0.001 from the wall-with-hole, which is enough.

Other options would be to use different discriminators. The wall and window could be on the same surface of the same object, with explicitly marked edges, or boundaries between materials, for example.

$\endgroup$
4
  • $\begingroup$ Thanks for the explanation. I knew that coincident faces cause problems but hadn't realised that coincident edges were so bad. When modeling a simple surface (like a wall) with more complex features (like a window), I cut out holes then duplicate the edges to create a new object. That way I can add more loop cuts/detail to the window without adding extra geometry to the wall. Clearly this approach is flawed. I would be interested to know how more experienced modellers solve this issue. Thanks again. $\endgroup$
    – John
    Commented Feb 27, 2023 at 14:19
  • 1
    $\begingroup$ @John.. I guess that depends on your case,, if you explicitly marked edges, you wouldn't need much more topo, but, yes, that would be a pain. Z-fighting in Freestyle is new to me, too. $\endgroup$
    – Robin Betts
    Commented Feb 27, 2023 at 14:29
  • 1
    $\begingroup$ I made a further discovery - turning off "Chaining" under View Layer Properties > Freestyle Strokes seems to mitigate the issue. I'm guessing the chaining detection is the part that gets messed up by edges that are z-fighting. $\endgroup$
    – John
    Commented Mar 3, 2023 at 17:31
  • $\begingroup$ @John Intersting! Feel free to offer an edit to the answer if that's conclusive. $\endgroup$
    – Robin Betts
    Commented Mar 3, 2023 at 17:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .