Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to desaturate and blur background only?

Discussion in 'High Definition Render Pipeline' started by DrummerB, Dec 20, 2020.

  1. DrummerB

    DrummerB

    Joined:
    Dec 19, 2013
    Posts:
    135
    I'm trying to implementing an effect similar to what can be seen in Layers of Fear when picking up and inspecting an object. Everything except the inspected object is blurred and desaturated (see example below).

    First I thought of using a stencil to control where the post-processing is applied, similar to what's discussed here. Unfortunately, this would only work for Opaque objects.

    Then I tried using a Custom Pass to render the object after post-processing. However, this means that it is rendered after all post-processing, including effects that I want to keep (ambient occlusion, color grading, etc). I'm not sure if it would be viable to render the object into a separate render texture and manually apply the other post-processing effects on it?

    Next, I tried using camera stacking and simply rendering the object on top of the rest of the scene. This doesn't seem to be fully supported by HDRP as I was unable to render the second image without any background (just the object). Maybe it would be possible to render the second camera into a render texture and then manually blending it over the scene?

    And just now, I found the new Graphics Compositing feature that seems to allow exactly what I'm trying to achieve. However, the documentation says:

    The Graphics Compositor has a rather high CPU and GPU overhead and it is not recommended to be used in performance critical applications such as video games.

    So what is it intended for then?

    Any suggestions for how to achieve this effect?



     
  2. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Hey,

    for the depth of field part: did you try instead to use the Manual mode for the depth of field's Focus Mode? Then set your near blur Start and End at 0 meter (= no near blur), then set your far blur Start beyond the object you want to preview. This will then only produce blur in the background, behind the subject.

    See documentation:
    https://docs.unity3d.com/Packages/c....2/manual/Post-Processing-Depth-of-Field.html
     
    Last edited: Jan 8, 2021
  3. DrummerB

    DrummerB

    Joined:
    Dec 19, 2013
    Posts:
    135
    Hello pierred,

    That is indeed what I have currently (except using the physically-based camera mode and a focus distance). However, now I'm trying to add additional/different post-processing to the background.
     
    pierred_unity likes this.