The light is too loud!

Excluding Objects from Post Processing

In our previous article we took a look at adding post processing to our scene to add effects like Bloom and Color Correction. I have found, while working on a project that sometimes you have objects that you don’t want to apply post processing to. Let’s take a look at how I have excluded some objects from post processing.

While play-testing, I found that the bloom effect was causing my shield visualizer to burn hotter than the sun! This was not my intended effect and I quite liked the effect of the shield visualizer without the bloom effect.

Shields before and after post processing
Shields before and after post processing

This led me to research for a way to exclude just my shield visualizer from the post processing stack. The method that I settled on is to duplicate my main camera, where my post processing is being applied, and then remove the post processing from the duplicate camera and use both cameras culling masks to only display the appropriate layer that contains the objects that I want effected/not effected by post processing.

The first step to setting this up was to duplicate my Main Camera and rename the duplicate to Main Camera (No Post) so that I can easily identify it at a glance. I then removed the post-process layer component (and the Audio Listener since you are only supposed to have 1 Audio Listener in a Scene).

Duplicate Camera and Remove Components
Duplicate Camera and Remove Components

Next I created a new Layer and called it Exclude from Post Processing.

Creating the Exclude from Post Processing Layer
Creating the “Exclude from Post Processing” Layer

I then set the Culling Mask for the new camera to only include the new layer and the Culling Mask on the original camera to exclude the new layer.

Setting the Culling Masks on the Cameras
Setting the Culling Masks on the Cameras

I also set the Depth property of the new camera to be 1 higher than the original camera so that the shield visualizer still rendered over my ship. It should be noted that having the cameras depth affect the layering of the graphics could make this technique unsuitable for some scenarios but it works for mine.

Depth Level on New Camera
Depth Level on New Camera

The last step was to change the layer that my shield visualizer was on.

Changing the Layer of the Shield Visualizer
Changing the Layer of the Shield Visualizer

And now my shield visualizer isn’t affected by the post processing stack and the rest of the scene is!

End Result
End Result

Today we took a short detour on our way to learning to add audio to our game and learned one way to exclude an object from post processing. Next time we’ll get back on track and add audio to our game! If you enjoyed this article, or want to come along with me as I progress on my journey, follow me at gamedevchris.medium.com.

Unity Game Developer, Software Engineer, Gamer, Musician, and Father. Christopher is a creative that enjoys a challenge and loves coding.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store