The light is too loud!
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.
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).
Next I created a new Layer and called it Exclude from Post Processing.
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.
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.
The last step was to change the layer that my shield visualizer was on.
And now my shield visualizer isn’t affected by the post processing stack and the rest of the scene is!
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.