Search Unity

Question Disable shadows on full screen quad shader

Discussion in 'General Graphics' started by b1gry4n, Sep 8, 2020.

  1. b1gry4n

    b1gry4n

    Joined:
    Sep 11, 2013
    Posts:
    146
    To start off, I am not very good with shaders and I am sort of learning as I go. I am using HDRP and I have a custom render pass set up. I am drawing a full screen quad, rendering to it, and using depth offset to push the pixels back into the world. I have been struggling for hours trying to figure out what these black artifacts are:


    And I suddenly realized that the texture is still rendering...so its an issue with shadows. After turning off the shadows of the background object it looks how I would expect it to.



    I am in a situation where I know what I want to do, but I am not sure how to do it. Why would it be interacting with shadows? How can I make it so that this object doesnt cast or receive shadows at all? In the shader it is set to shadowcasting off. Zwrite off. Ztest disabled. Is this a render queue issue? If so I am somewhat confused as this is a custom pass transparent shader and it is injected before post processing. Maybe the depth offset is pushing the pixels too far below the surface and the object is casting shadows onto it? What would be the correct way to adjust the depth offset based on distance? This seems to happen close to the camera.

    This is how I am getting the depth offset value. If I increase the depth offset manually it goes away which makes me suspect that its actually pushing the pixels under the background object. Like I said, at a distance I can get away with a smaller offset, but when the camera gets closer to objects it pushes them too far.
     
    Last edited: Sep 8, 2020
  2. b1gry4n

    b1gry4n

    Joined:
    Sep 11, 2013
    Posts:
    146
    After messing with it some more it is a depth offset issue though now I am stumped as to how I can calculate the depth offset accurately in this situation.