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.

URP - Depth of Field - Orthographics Camera - Gaussin, Bokeh!!!

Discussion in 'Universal Render Pipeline' started by Foriero, Apr 9, 2021.

  1. Foriero

    Foriero

    Joined:
    Jan 24, 2012
    Posts:
    572
    Does DoF.Gaussian ( Start, End ) or DoF.Bokeh ( FocalLenght ) actually work with Orthographics camera?

    So far we only see DoF.Gaussian being applied as a global PP and does not react to Start or End parameters.
    Bokeh does not work at all with Orthographics camera!!!

    Does unity work on it?

    Thank you, Marek.
     
  2. Foriero

    Foriero

    Joined:
    Jan 24, 2012
    Posts:
    572
    Anyone?
     
  3. harusame-

    harusame-

    Joined:
    Nov 18, 2013
    Posts:
    11
  4. Foriero

    Foriero

    Joined:
    Jan 24, 2012
    Posts:
    572
    Anyone from Unity can shed a light on Orthographics DoF, please?
     
  5. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    1,852
    The concept of depth is foreign to orthographic/2D rendering, which is why DoF won't work as expected.
     
    GoGoGadget likes this.
  6. Foriero

    Foriero

    Joined:
    Jan 24, 2012
    Posts:
    572
    Yes, but to achieve depth in orthographics camera we exactly need DoF to work.
     
  7. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    836
    As @StaggartCreations pointed out, Orthographic cameras don't handle depth as you'd expect. This is what an Orthographic depth texture looks like.



    So personally, I wouldn't really be trying to use a fullscreen DoF effect with an ortho camera - you're much better off writing your own implementation of a fake-dof - maybe UI based or something similar to a 'tilt shift' effect instead.

    However, out of curiosity, I did check my Post-Processing asset, CUPP's DoF to see how it handles an Ortho camera - surprisingly, with a change to one line of code, it manages to pull off a front-field DoF effect quite nicely:

     
    harusame- and lilacsky824 like this.
unityunity