Cycles transparent object causes Z-fighting artefacts


I’ve got two planes both at global Z 0.0 but offset from each other slightly on the X, Y. One has a transparent shader, the other diffuse.

I’m trying to figure out why the transparent plane is causing z-fighting artefacts with the other plane.

I tried turning off the various Ray Visibility options for both objects (with the exception of Camera rays) to no effect.

Z-fighting is caused by the renderer not being able to decide which surface is “on top” = which surface is to render. And that’s exactly what happens here: For some pixels it’s the grey diffuse surface, for others it’s the transparent one.

Make the background color a little more dramatic to see what happens:

The red (in your case: the dark grey) is just the background color seen through the pixels that render transparent, which makes this indeed a typical z-fighting artefact.

Z-fighting is about the interaction of co-planar and overlapping geometry. The fact that you can’t see the transparent plane, doesn’t mean it isn’t there.

Right, but in both cases (whether the transparent plane is evaluated as ‘on top’ or ‘on bottom’) the plane with the diffuse shader should be fully visible with no parts missing. Try manually moving the transparent plane above and below the other plane.

It’s as if for some pixels (or samples) the diffuse material is being ignored completely.

Yes, and that’s exactly what Z-fighting is about.
The renderer renders one surface or the other. And if one of those surfaces is transparent, you will have a transparent pixel in the object where this surface comes out on top.

I will admit that my phrasing with “on top” might have been ambiguous.
The surface “on top” is the only surface rendered at this point, as the renderer can only “see” that very surface. So, that’s “come out on top” more in a “winner of the z-fight” sense, and not indicating a spatial hierarchy.

Ah, that makes sense with what I’m seeing.

So there are actually three states:

  • plane is clearly seen as in front of the other
  • plane is seen as behind
  • two planes share the same place and renderer makes a decision to render one surface OR the other (on a per-sample basis, leading to patchy noise)

Thanks for clearing that up :slight_smile: