@Hatahata Thanks for sharing a screenshot of the issue, this helps a lot. The issue is showing a theoretical problem when rendering transparent objects while writing to the Z Buffer, which can unfortrunately not be solved perfectly. The general problem is that opaque and alpha-tested objects are rendered in front-to-back order while writing to the Z-buffer. Then afterwards transparent objects are rendered in back-to-front order, but they don't render where the Z-buffer is already set to a closer distance.
The quality-wise best solution, as Misaki mentioned, would be to render the object twice:
- Low-Quality write to Z-Buffer: With alpha-test and write-to-depth enabled and a more aggressive alpha threshold (a value close to 1.0 or at 1.0) which cuts away more, but writes to the z buffer for the screen-space reflection post processing effects.
- High-Quality transparent: Render the mesh with normal transparency settings, write-to-depth disabled.
This way you should get the normal high-quality blending in semi-transparent areas, while the Z-buffer will only be written at opaque pixels.
Another solution (or improvement in general) would be to change the Render Queue
setting of the Material which writes to the Z-buffer from Alpha Test
to Transparent
. You could also experiment with setting the Render Queue
to Transparent - 1
and + 1
respectively.