0
\$\begingroup\$

In my game I want to apply bloom, from the standard assets, to only a few objects in the scene. To do that, I set up 2 cameras at the same position and orientation, one with the bloom component and the other without. Then I put the blooming objects on a "Bloom" layer, set the blooming camera to only render objects on this layer, and the main camera to render everything else.

Then I noticed that, if the main camera has a depth lower than the bloom camera, then the bloom camera will apply bloom to everything in the scene. I guess that's because the bloom effect works on everything rendered up to the point the script is executed.

So I made sure that the bloom camera has the lowest depth and clears with a solid color. Main camera does not clear. However, now I lose the illuminated pixels around the blooming objects. I guess they are overwritten by the main camera, since the blooming camera probably did not give them any depth.

Here's a simple scene to illustrate the problem:

Scene setup Main camera Bloom camera

Currently the game looks like this:

Current game

If I swap the configuration of the 2 cameras (Main camera: lower depth, clear with solid color; Bloom camera: higher depth, don't clear), the game looks like this (exaggerated for demonstration):

Game with swapped cameras

What I want is the yellow object to look like that in the last image, and the purple object to look like that in the second last image. How?

Because of company policies, I am limited to Unity 5.4.1f1, and cannot use anything not made by Unity in the Asset Store.

\$\endgroup\$
  • \$\begingroup\$ I don't have anymore time for a complete answer, but you could do that using a second camera. If in the meanwhile on one answers, I'll add an answer tomorrow :) cya. \$\endgroup\$ – GameDeveloper Feb 20 '17 at 20:14
2
\$\begingroup\$

Bit late, but here is how you do it with emission/HDR. Just use one camera that renders everything. Make sure "Allow HDR" is checked. Add a post-processing profile with bloom enabled, and set the bloom threshold to 1. This prevents anything non-HDR from getting bloomed, so normal lighting/materials are unaffected.

Then you can simply choose the models you want to bloom, and enable emission on their materials.

emission options

Choose the hue to set the bloom color, then set the brightness to set the amount of bloom. You can add extra amounts of bloom by setting the number to the right of the color selector to go past a brightness of 1.

If unintended objects in the scene are receiving too much bloom, you can turn down the bloom threshold and turn up the brightness on your emission materials.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.