Search Unity

Using depth of field in a 2D project

Discussion in '2D' started by itsukiichiyuu, Apr 24, 2019.

  1. itsukiichiyuu

    itsukiichiyuu

    Joined:
    Feb 10, 2018
    Posts:
    15

    Attached Files:

  2. ghegi

    ghegi

    Joined:
    Jun 3, 2018
    Posts:
    28
    I think it's in their sprite. They drew the background to blur. You can easily do tht in photoshop. Also they use parallax effect to achieve it.
     
  3. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,807
    If you want true depth of field then you need to use depth. Separate your layers in the Z axis.
     
  4. itsukiichiyuu

    itsukiichiyuu

    Joined:
    Feb 10, 2018
    Posts:
    15
    Thanks for replying.
    So the post-process depth does not work on sprite, so the only easy posibility is to do it on photoshop.
     
  5. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,807
    It can work with sprites, the default sprite shader has ZWrite off. You can either duplicate and edit the shader to enable ZWrite and put it in the opaque render queue, or find a shader online that supports it.

    ie:
    https://github.com/traggett/UnitySpriteShaders
     
    gooby429 likes this.
  6. WayneJP

    WayneJP

    Joined:
    Jun 28, 2019
    Posts:
    44
    Hi, could you please take a look at my post?
    Is this blue fog or light made by shader?
    I have no idea to implement this effect, should I write shader code?