Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

2D URP and Depth of Field Post Process

Discussion in 'Universal Render Pipeline' started by VektaCo, Sep 5, 2020.

  1. VektaCo

    VektaCo

    Joined:
    Sep 30, 2019
    Posts:
    31
    Is it possible to get the Depth of Field Post Process working nicely?
    When I use the Post Process is just blurs everything, no matter the distance from the camera.

    I am using a ShaderGraph with the Sprite Lit Master node.
     
    znagler and RemDust like this.
  2. Oxeren

    Oxeren

    Joined:
    Aug 14, 2013
    Posts:
    120
    Sprites do not write to depth buffer, so depth of field can't work correctly. If you need something like a blurred background, you can use camera stacking and render everything in the background by a separate camera, then setup postprocessing volumes so depth of field is only applied to the base camera to blur everything rendered by it. Everything in the foreground should be rendered by an overlay camera, this way it will not be blurred.
     
  3. VektaCo

    VektaCo

    Joined:
    Sep 30, 2019
    Posts:
    31
    Can i get Sprites to write to the Depth buffer using ShaderGraph?
    It's a 2.5d game and I want to continue using the 2D lighting system.
     
  4. znagler

    znagler

    Joined:
    Sep 25, 2022
    Posts:
    9
    Is there any update on this? Neither Gaussin or Bokeh work, they don't seem to have any link to the z-axis. They just blur everything. I don't understand how 2D URP games are achieving depth of field :(