No depthtexture on forward rendering when shadows disabled

Hi.
I have a big Problem with a water shader that needs the camera depth texture. When i disable shadows (doesn’t matter if i disable it on the light source or at the graphics Settings), i get no depthtexture anymore.
I set manualy on the camera depthTextureMode to .depth, but it doesn’t work. At the Frame Debugger i also see nothing with updatedepthtexture and on the water shader the dephttexture is empty.

Any ideas what i do wrong? I found no solution with Google that works.

for Information: i use the latest stable Unity Version.

(sorry for my english :wink: )

Unity uses the depth texture for directional light shadow receiving on desktop and consoles, which is why it exists when there is a light source.

Setting the depth texture mode from script should force it on. If it’s not, then I would suspect there’s a problem with your code.

void Awake() {
    GetComponent<Camera>.depthTextureMode |= DepthTextureMode.Depth;
}

But i have it also at the Scene view when i disable there the lights.

Is in unity something (?) that Can break/Interrupt the depthtexture creation?

ok, i find the reason. It’s something with Unity Post processing behaviour. When i disabled it, it’s all fine. Very strange why. I just use Bloom

in the postprocessingbehavour script, it overrites the camera.depthtexturemode with None. that’s the Problem!

Indeed. I reported this sometime ago and provided a quick fix. See here: https://discussions.unity.com/t/642522 page-8#post-3014773

Has there been a bug report on this, a case number? :slight_smile:

It had been reported on GitHub. Thomas replied… [quote=“Chman, post:377, topic: 642522, username:Chman”]
It’s not a bug per-say, it’s a design decision. See this discussion about it.
[/quote]

Ah, thanks!

Thanks. But i fix it already :wink: