I want to be able to apply a full-screen image effect like a glow on just my UI elements, without also applying the effect to the rest of my scene. As I understand it, the right approach is something like this:
- Set the main scene camera Culling Mask to exclude UI layer.
- Create a second camera for rendering the UI, orthographic, forward rendering path
- Set the UI Canvas Render Mode to Screen Space - Camera, and link to the UI Camera.
- On the UI Camera, set Clear Flags to Depth Only and Culling Mask to just the UI layer. (Setting Clear Flags to Don’t Clear here would create a smearing effect, right?)
At this point, any image effects applied to the UI camera will be applied to the entire render buffer, so a glow would affect both the UI and the scene. To get around this:
- Set Target Texture for the UI Camera to a RenderTexture.
- Blit the render texture to the game screen.
That last step is where I’m stuck. How do I combine this with the buffer from the main camera? Would the correct approach be to create a Screen Space - Overlay canvas with an Image component to display the RenderTexture on top of the game screen? I’m guessing some scripting is required.
Thanks in advance!
