Open nicolas-guichard opened 1 year ago
Hi @Nico264,
Thanks for reporting this. Unfortunately there's no easy way of working around the issue. Nvdiffrast wasn't originally designed with depth peeling in mind, and we are abusing it by combining peeling and the anti aliasing primitives.
The issue in this case is that the distant plane is split into two layers (first and last in your images). The antialias
function only operates on a single layer, and therefore thinks there's a silhouette in the background layer, even though the plane continues in the foreground layer. There are some workarounds, but solving the problem correctly would require bigger changes to the renderer:
Hi @JHnvidia and thanks for your answer.
I was indeed under the impression that this was not trivially fixable. I went for a variant of your first suggestion: I repeatedly apply anti-aliasing on the final composition according to each layer's rast, ignoring fragments that are occluded or fully transparent.
The result still isn't really correct but the artifacts are less obvious and I still get some gradients for silhouettes behind transparent objects.
I guess you can close this as won't fix/known issue if fixing this is out of scope.
In render.py, you composite the scene back to front, anti-aliasing each step of the way:
This can cause the background to bleed though in some cases when rendering transparent parts.
For instance, in the attached scene of a rotated transparent box in from of an opaque plane, we can get the background to appear in front of the opaque plane:
Those artifacts also impact the resulting gradients obviously.