0
Not a bug

How do I use depth blend?

MisterTelecaster 10 years ago updated by Freya Holmér (Developer) 10 years ago 9
This is less of a bug and more of me not understanding what to do. I'm trying to make a shader that uses depth blend for alpha, but before I start going that far, I'm just trying to make sure I know how to work with depth blend. So I made a custom lighting model where literally the only nodes that I have are a depth blend node sending its output into the custom lighting input, and a slider that goes from 0 to 10 going into the distance input on the depth blend node. I put that on a plane, stuck a few primitives underneath it and half in it, wrote a script that changes the main camera's depthTextureMode to Depth on start, and all I'm getting is a blank black plane. The other objects are all using Unity's diffuse shader, and I've tried all of the other built in lighting models with my Depth Blend's output going into the Diffuse input. No matter what I do, any object with the depth blend shader is all black all the time.

Answer

+1
Answer
Not a bug
Ah, good catch, thanks Jairo :)
Under review
Does it write to the depth buffer in the shader settings? Are you sure you're looking through the main camera? How does your node tree look?
This is how I have it set up right now, as basic as it can get.It is set to write to the depth buffer, and I've tried every lighting model there is built in, but in game all I get is black.
You have to turn off depth write. Also, plug it into emission to see more clearly, otherwise it's affected by lighting
-1
I tried it with depth write disabled before, it just turns invisible when I do that. Or at least everything that has an object behind it. Otherwise it's just black. I did it again though, and  the exact same thing happens when it's plugged into emission, into diffuse, and into both at the same time.
I think it's because you are using Unity Indie, this one don't support this.
Does it really? I don't remember seeing anything about Unity Pro when I was looking at the documentation to get the camera to write to depth buffer. I tend to miss things though

No, you are right in the documents it doesn't say anything about pro, but since this uses render textures to get it, you can't do it, so if you are on Unity Indie like me, forget about blend waters with terrains, and more things :S
aw that sucks

Thanks though
+1
Answer
Not a bug
Ah, good catch, thanks Jairo :)