Unity - How to apply different post processing effects to objects within the same UI canvas?

Viewed 125

Is there a way to do this, or does anyone have suggestions of a work-around, etc?

Quick example of what is happening. In short, I have separate cameras for each layer so that I can apply different post processing to each respective layer. I have my test canvas set to "Screen Space - Camera" and its render camera set to the UI layer. This is an example of each camera's settings. Each volume is set to a different layer. All of the objects in "Test Canvas" are set to the UI layer, except for the outer red border which is set to the bloom layer.

What I want is the text and inner square to NOT have bloom but the outer red TO have bloom. Is there a way to do this? I've tried a bunch of things and nothing has worked so far. Thanks!

1 Answers

Two things:

One -- Setting the "Layer" on your UI objects is not going to solve this issue. As far as I can tell, all UI elements in a canvas with Render Mode set to Screen Space - Camera will output to that camera with whatever layer the parent canvas is set to.

For example, if I have a Camera X that only shows Layer X, with a canvas set to Layer X, and a UI Panel inside that camera set to Layer Y, the UI Panel will still be rendered to Camera X.

Conversely, if I have a Camera A that only shows Layer A, with a canvas set to Layer B, and a UI panel inside it set to Layer A, that panel will not be rendered to Camera X.

To solve this, you'll need to set up a "Bloom Canvas" and "No Bloom Canvas", and have Bloom Canvas render out to a Bloom UI Camera with the post processing applied, and No Bloom canvas rendering out to a No Bloom UI Camera.

There's one other trip-up you may encounter:

Two -- Currently, post-processing effects also apply to any camera lower on the stack. So for example, if I have a base camera, a bloom camera (with "post-processing" checked), and a non bloom camera, if I stack it as:

  1. Main Camera
  2. Bloom UI Camera
  3. No Bloom UI Camera

The bloom is applied only to layers 1 and 2. Like so:

"New Text" and black box above red box with bloom applied.

However, if I stack it like this, with no other changes:

  1. Main Camera
  2. No Bloom UI Camera
  3. Bloom UI Camera

The bloom will be applied to layers 1, 2, and 3. Like so: Red box above black box with "New text". All have bloom applied.

So when applying post processing effects, make sure you have your "non-post processing" cameras always at the top of the stack.

Related