Beginner's question on Bloom Effect for 2d sprites

Hi guys, I’m almost new to using image effects & shaders, and got some questions about Bloom effects.

So I tried to make some ‘glow’ effects for my pixel art sprites. After searching many documents and trial & errors on unity editors, This is what I understood about HDR & Bloom Effects :

*HDR can simulate pixels that can have color value larger than 1.

*So, with HDR checked camera, You can use threshold = 1 in bloom effect script, and bloom effects will work on pixels with values > 1.

My Question is : Then how do you let your sprite pixels have larger than value 1? I guess it’s by shader, but dunno exactly what tweaks I should do to set pixel values of my sprites > 1 for bloom.

*And a bit addition here - I accidentally made it work, with these settings(I use no lightings.)
**(Edit - Well, Actually I used lightings. I just forgot my editor has default built-in directional light, and it’s important source for bloom effects.)


Inspector of my sprite object : I used Sprite-Diffuse shader instead of Sprite-Default. The sprite is just a simple white-filled object.


Inspector of my camera, HDR turned on with bloom script.


Result of setups above. We can see only light shaft object gets nice bloom effect here.

So if I use Sprite-Diffuse instead of Sprite-Default, It seems like somehow my sprite gets pixel values > 1.

I get good glow effect per object now, I’m happy with this, but still dunno WHY it works.
It would be really helpful if someone explains me the reason…

OK, so I got why Sprite-Diffuse shader works here. I had editor-generated Directional Light in my scene, and thanks to that light, My sprite can glow. Difference between Sprite-Default & Sprite-Diffuse is that your sprite affects by light or not.

Still, I have question here - so If you want to set pixel values > 1 for nice bloom effect, then you MUST have lights? No other options like texture.setPixel()?

Hi. The threshold parameter determines what value the pixels will start blooming at. What you can do is instead of using the sprite diffuse shader make a custom shader that outputs a value > 1 where you want bloom to come from.

Oh…Ok, so I need a custom shader. You mean that with custom shader, I don’t really need light sources for bloom, right? I’m almost new to shader system so it makes me little bit nervous to touch it, but thanks for the reply - Seems like I gotta learn about shaders then. Thanks!

Yep that’s correct.

What you should do is download the built in shaders Built in Shaders - Questions & Answers - Unity Discussions and take a look at sprites default shader. You can copy this into your project and rename it (both the file and the name INSIDE the shader) and start tweaking :slight_smile: