0
Fixed

Depth Blending only works sometimes?

Tj Hughes 8 years ago updated by Freya Holmér (Developer) 7 years ago 9

I have no idea if other users get this problem, but sometimes depth blending does not work on particular SF shaders. I do not know what determines whether or not it works.

Sometimes the problem can be fixed by recreating the SF shader from scratch (with same settings)


I don't think it's a rendering problem, depth blending always works on some SF shaders I make, and doesn't on others. When it decides to not work, it only stops working for that specific shader, others aren't affected.

It doesn't matter what I have Depth Blending hooked up to, if it's not working on that particular shader, it will continue not working on both opaque and transparent shaders.


This happens across multiple computers, regardless of operating system. If depth blending works on one computer, then you export the shader and load it up on another, it may break.


Here are two examples of it working:

Image 589

Image 590

the shader is set up so that geometry gets darker around the intersections. This is behaving as expected.

Here's the same scene as above, but without depth blending working:

Image 591

Intersections aren't interacting with the shader at all. This is with the same settings as above. This is in the same scene, but is on a different computer that we know supports depth blending.


Here is what it looks like when we set the Depth Dist of the depth blending to 0:

Image 592

It looks almost like Z fighting.


Any suggestions on how to get depth blending working more consistently? I hope I provided enough info, if not please let me know!


Answer

Answer
Fixed

One thing I noticed that is likely the issue - depth blend only works when lighting preview is on. If it's off, it stops working. In addition, materials now have a render order as well, which might be the culprit.

Under review

Odd, not sure what could be causing that. Different quality settings? Different Unity versions?

So I tried once again making a shader with depth blending in one of my projects, and once again it looks like this:


I don't think miso soup is supposed to look like that. Even when I tried duplicating an SF shader where depth blending works, depth blending stopped working in the duplicated shader. (but kept working in the original)

So then I tried something: I tried making a new project entirely, importing nothing but Shader Forge and a bowl of miso soup.



Here, depth blending worked, even after duplicating the shader, and making the miso soup green. Do you think there's a possibility that something else in the project is interfering with Shader Forge?

UPDATE: I deleted the ShaderForge folder, then redownloaded and reimported it, and my miso soup is back to looking like miso soup....

strange!

Hmm...both projects are on the highest quality setting; There are different versions of Unity though; my project is in Unity 5.2.2, and the other project is in the latest version of Unity. But I don't think this is the issue because here is a depth-blended SF shader working in the same project:

The above shader didn't work at first either but it suddenly started working after importing a new version of it one day. Sorry if that doesn't help, it's definitely odd, I wish it was at least more consistent! I've seen depth blending both broken and working on a Windows computer as well, so I don't think it's a hardware issue either

Hey man, try to connect a vector2 (0,0) in the refrection field. I dont know why, but that worked every time for me.

I don't recommend doing this as you're paying a heavy price for refraction

Ah unfortunately that weird vector2 fix didn't work for me, it yielded the same results :(

hi!!
do you show the shader nodes?

Answer
Fixed

One thing I noticed that is likely the issue - depth blend only works when lighting preview is on. If it's off, it stops working. In addition, materials now have a render order as well, which might be the culprit.