Search Unity

No depthtexture on forward rendering when shadows disabled

Discussion in 'General Graphics' started by EwieElektro, Feb 25, 2018.

  1. EwieElektro

    EwieElektro

    Joined:
    Feb 22, 2016
    Posts:
    45
    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 ;) )
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    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.
    Code (csharp):
    1. void Awake() {
    2.     GetComponent<Camera>.depthTextureMode |= DepthTextureMode.Depth;
    3. }
     
  3. EwieElektro

    EwieElektro

    Joined:
    Feb 22, 2016
    Posts:
    45
    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?
     
  4. EwieElektro

    EwieElektro

    Joined:
    Feb 22, 2016
    Posts:
    45
    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
     
  5. EwieElektro

    EwieElektro

    Joined:
    Feb 22, 2016
    Posts:
    45
    in the postprocessingbehavour script, it overrites the camera.depthtexturemode with None. that's the Problem!
     
  6. grizzly

    grizzly

    Joined:
    Dec 5, 2012
    Posts:
    357
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Has there been a bug report on this, a case number? :)
     
  8. grizzly

    grizzly

    Joined:
    Dec 5, 2012
    Posts:
    357
    It had been reported on GitHub. Thomas replied...
     
    Last edited: Feb 26, 2018
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Ah, thanks!
     
  10. EwieElektro

    EwieElektro

    Joined:
    Feb 22, 2016
    Posts:
    45
    Thanks. But i fix it already ;)