Writing to bloom buffer in unlit shader

I want to add glow to an unlit shader.

AFAIK the standard shader writes to the emissive gbuffer which is read by the bloom effect. Is this correct?

Any information on what values i should be writing to the emissive buffer?

will this screw with Unity’s render pipeline if I start writing data to the emissive buffer?

TNKS!

G

When using deferred rendering the Standard shader does indeed render to an “emissive” gbuffer. However that title is misleading as it’s more accurately the post-lit buffer. When the deferred passes are rendered, the ambient lighting and/or light mapping (multipled by the albedo) and emissive color is rendered directly to the “emissive” buffer. After that all deferred lighting and reflections are rendered into that same “emissive” buffer, or more specifically it’s set to the camera’s render target when rendering the deferred lighting, and ends up effectively being what you see on screen. The bloom image effects that Unity now just uses the final “on screen” image to calculate the blur rather than relying on a separate buffer.

You can use the Frame Debugger to step through this process and see what it’s doing.

With HDR off you have to play with the image effect values as it’s essentially just letting you pick a brightness value to consider “bright”. With HDR enabled you just need to increase the brightness of the color over “1” to make the bloom more intense. Like with the Emissive value on the standard shader, you can do that with an HDR color, or just a multiplier, but you cannot keep the original “unlit” brightness unless you do the same fiddling with the bloom image effect you would do with HDR off.

In older implementations of bloom there was in fact an “emissive” or “bloom” buffer that was completely separate from the on screen “pre bloom” image, or a way to flag areas on screen for bloom by writing to the alpha. Some more recent games have used this technique still, as it let you have more control, but it’s not very realistic and isn’t something Unity currently supports with the official assets. Some of the bloom / glow effects on the assets store do still use this technique, but they don’t always play nice with the official image effects if you want both.

Thanks bgolus! That all makes total sense and I agree HDR bloom is the way to go instead of dedicated buffers. I added a simple color multiplier to my shader and added the bloom post effect and all is good. The only thing I tweaked was the gamma (I think, away from my work computer) of the bloom effect as it was blooming at RGB 1,1,1. I understand why since even the diffuse reflectance of fresh snow isn’t perfect white but from a VFX POV I didn’t want any bloom until the value was > 1.

The only time I’ve run into trouble with HDR bloom (in other engines) is when trying to create VFX with constant bloom no matter the camera exposure etc.