Is it Common to Use Separate Cameras for UI and 3D Objects to Avoid Post-Processing?

Background to the question

I wanted to get the center of a UI Panel and place an object at that position.

When I set the Canvas Render Mode to Screen Space - Camera,
image

the following code worked fine.

private void CalculateTargetPosition()
{
    Vector2 localCenter = gridAreaRectTransform.rect.center;
    Vector3 worldPos = gridAreaRectTransform.TransformPoint(localCenter);

    Camera targetCamera = Camera.main;
    Vector3 screenPos = targetCamera.WorldToScreenPoint(worldPos);

    Vector3 finalWorldPos = targetCamera.ScreenToWorldPoint(new Vector3(screenPos.x, screenPos.y, targetCamera.nearClipPlane + 10f));
    targetWorldPosition = finalWorldPos;
}

However, when using Screen Space - Camera, URP’s Bloom effect applies to the UI, which is not what I want.
image

I am now considering two possible solutions:

A. Keep the Canvas in Screen Space - Overlay and find a script that works correctly in this mode.
B. Create a separate UI camera that doesn’t apply post-processing, and keep using Screen Space - Camera.

Since solution for A has not yet been found, so a solution for B is under consideration.

Question

Is it common to have two separate cameras, one for the UI and one for 3D objects, to avoid post-processing effects on UI?
Is this why Camera.main is often used in scripts?

Any guidance or advice would be greatly appreciated!

I do this in my game, and it works very well, quite simple too!

  1. Have a UI camera set to not recieve post processing, and have it’s culling mask set to only UI.
  2. Set your UI canvas to the “UI” layer, and set it to render in your UI camera via the “Screen Space - Camera” options.
  3. Change your UI camera to an Overlay camera.
  4. Add it to the Base camera’s list of overlay cams.
2 Likes

Yes. I see this all the time.

Camera stacking is a little bit different in URP vs. Built-in, because URP has some kind-of built-in “Camera Stack” feature.

2 Likes

Thank you for your response.
As a result, I’ve decided to look for a solution using Screen Space - Overlay.

This is because TAA (Temporal Anti-Aliasing) cannot be applied when using the Camera Stack, as mentioned in the documentation: Anti-aliasing in the Universal Render Pipeline | Universal RP | 15.0.7

However, I learned that it’s possible to use separate cameras for 3D objects and UI.
Which is a step forward.
It was very helpful. Thank you very much!