0
Not a bug

Depth Buffer not working as should.

EpicError fa 9 anys actualitzat fa 9 anys 2

I've already red around that it's tricky to mess with the alpha layer and also depth buffering as well, but I feel as if I missed something and I don't have it correct.


The current system I am trying to create is a object fade as seen in Diablo. The current situation is that it doesn't fade as intended.


When I have a simple texture with a color applied, and forward lighting and depth buffer enabled, I get the following result.


Image 580


Which clearly isn't correct. When I disable the depth buffering, I get the result I wanted:


Image 581


But it causes the obvious error below:


Image 582


How do I go on to fix the depth buffer issue?

Answer

Answer
Not a bug

It's hard to tell what you're trying to do, but it seems like you want to fade away multiple overlapping objects?

In that case, it's not really possible to do that, unless you make very specific shader for each layer of transparency, making a unique shader for each layer, with a unique render order, with depth / Z buffer disabled. Auto depth sorting is always a problem that won't go away for a long time though. There are some workarounds though that many games tend to use these days - using alpha clipping / opacity clip, along with dithering. This doesn't have the same sorting issues, but it doesn't look as smooth.

Answer
Not a bug

It's hard to tell what you're trying to do, but it seems like you want to fade away multiple overlapping objects?

In that case, it's not really possible to do that, unless you make very specific shader for each layer of transparency, making a unique shader for each layer, with a unique render order, with depth / Z buffer disabled. Auto depth sorting is always a problem that won't go away for a long time though. There are some workarounds though that many games tend to use these days - using alpha clipping / opacity clip, along with dithering. This doesn't have the same sorting issues, but it doesn't look as smooth.

Thank you for the reply!


I have replied to the Unity ticket to keep issues like such there. Thank you for your hard work on this asset!