Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Camera Stacking (URP) - How to apply different post processing to the UI?

Discussion in 'Universal Render Pipeline' started by JacketPotatoeFan, Feb 18, 2020.

  1. JacketPotatoeFan

    JacketPotatoeFan

    Joined:
    Nov 23, 2016
    Posts:
    34
    I am testing out camera stacking in the URP (7.2.1). I am wondering what setup I need to apply different post processing to my UI.

    - Base camera that has global post processing (bloom, color correction etc).
    - Overlay camera that will be just for UI (and added to the base camera stack).

    I would like the post processing from the base camera to not effect this camera so that I can apply a small amount of bloom to the UI. I am not sure how to do this (I would think with layers? but couldn't get that to work).

    Thanks
     
  2. Moritz5thPlanet

    Moritz5thPlanet

    Joined:
    Feb 5, 2019
    Posts:
    73
    You can set layer masks that the Volume works for, so you can have multiple volumes, and different ones for the UI.

    You may need to re-order your camera stack a bit.
     
    CapedHero, oleg_v and Thygrrr like this.
  3. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    1. Set the layer of your Volume for the UI to e.g. UI.
    2. On the Overlay Camera set Environment > Volume Mask to e.g. UI (the hover help – see picture below – is quite helpful).

    Screenshot 2020-02-18 12.32.24.png

    P.S: Also, what Moritz said :)
     
    CapedHero, CyrilGhys and zaiman1996 like this.
  4. Arkki

    Arkki

    Joined:
    Apr 4, 2013
    Posts:
    2
    What works: UI layer on top of the game layer, turn UI-cam post processing off and game-cam post processing doesn't affect it.

    To have separate post-processing effects on overlay UI-camera and base-game camera works in a very limited manner. Effects supported for overlay cameras appears to be: tone mapping mode, post-exposure-value, bloom and vignette, maybe some more, but could't get it to adjust hue/contrast/color-values for overlay cams. This works only in the base cam volume.

    Do let me know if you get this working somehow, would love to be able to adjust these individually for each overlay camera before stacking them together. (Right now I got a hunch that I'll need to learn stencil-buffer/depth masking to get the look I'm after.)
     
  5. beardedrangaman

    beardedrangaman

    Joined:
    Jul 22, 2017
    Posts:
    9
    is there a way to get the UI to be on an overlay camera without PP and still take depth into account so it behind objects it should be (they are rendered on the base camera)
     
    Rob-A and cassius like this.
  6. marlin_fabervisio

    marlin_fabervisio

    Joined:
    Jan 8, 2020
    Posts:
    4
    Hey Everyone!
    I stumbled upon this, and it helped me kind of. But I still have the issue, that the UI Post-Processing Volume is also affecting the Background Objects.

    My setup is the following:
    Default cam with layer-tag "Default" and also volume mask set to "Default" (Base Camera)
    UI cam with layer-tag "UI" and also volume mask set to "UI" (Overlay Camera added to the camera-stack of the default cam)

    One global volume with "Default" layer-tag and one with "UI".

    My UnityVersion is: 2019.4.11f1
     
    Last edited: Oct 2, 2020
  7. DearUnityPleaseAddSerializableDictionaries

    DearUnityPleaseAddSerializableDictionaries

    Joined:
    Sep 12, 2014
    Posts:
    135
    I'm also trying to solve this. Any idea?

    One way is via Render Textures + Raw Images, but they don't look really good, it affected the quality and there are issues with semi-transparency with that method.
     
  8. oleg_v

    oleg_v

    Joined:
    Nov 10, 2017
    Posts:
    68
    Tried stacked camera approach with different culling mask and different volumes. All fine, except the shadows.
    My case is motion blur for racing game with car w/o blur and all env is with blur.
    Playing with sandbox scene, here is video from reddit: https://www.reddit.com/r/Unity3D/comments/jr4mlh/urp_motion_blur/

    And ideas how to add shadows are welcomed. If it's only able to do it with digging into custom rendering features, plz post any refs to similar example.

    Thank you!
     
  9. unity_9eWJmHFApMYJkg

    unity_9eWJmHFApMYJkg

    Joined:
    Apr 23, 2018
    Posts:
    5
    Have you ever solved this? I have the same issue. The overlay works fine, effects get applied to all layers. But the PP effect of the overlay, also affects object below it
     
  10. Pretorianunity1978

    Pretorianunity1978

    Joined:
    Oct 27, 2015
    Posts:
    2
    same issue here. any solution out there?
     
  11. weiping-toh

    weiping-toh

    Joined:
    Sep 8, 2015
    Posts:
    192
    There is no out-of-the box solution as the PostProcess logic applies on the _CameraColorTexture which is actually the rendering result of both the Base and the Overlay cameras.

    The easiest(least coding) solution is to have both of the cameras as BaseCamera. The original Overlay camera rendering to a RenderTexture with the PP applied and then render the RenderTexture as a UI raw image on the BaseCamera. I have to warn though that this is not very performant and is also a hassle to setup.

    The better solution involves implementing a custom renderer for the original Overlay camera, making it a base camera that applies the PP onto the rendering results of the camera only before taking blending with the results of the original Base camera.
     
    dev_34Disorder likes this.
  12. dev_34Disorder

    dev_34Disorder

    Joined:
    Aug 7, 2018
    Posts:
    51
    hello and happy holidays!
    i've been trying to figure out this different-PPVolume-per-camera situation and the latter approach you brought up seems to be the most sensible, but i don't really know how to pull it off.
    i'm not asking for full straight up code, just hope you could explain how to go about placing the overlay camera image on top of the base one, whilst making sure the PP is applied before the images get overlaid, and also, how does a custom renderer play into all this and what should it do differently than the standard one.
    sorry for the probably noobish questions, i've just transitioned to URP and i feel like 2014 me again, trying to figure out what's the difference between a shader and a material.
    thanks for the post, and again, happy holidays!
     
  13. dev_34Disorder

    dev_34Disorder

    Joined:
    Aug 7, 2018
    Posts:
    51