Page 1 of 1

Bloom Shader Problem

Posted: Tue Apr 19, 2016 1:58 am
by Hackz101
Hi everyone. I've been using Love2d for a bit now and am I'm trying to get into shaders. I can never wrap my head around how or why they work including the math. Yes, I've seen about every tutorial there is out there but they are always the complete basic understanding of what shaders are, or they are way too complex and not well explained. One of the main shaders I am interested in is the bloom shader but of course I don't understand it. Is there anyone who can shed some light on how to create one or explain the process using code? I'd much prefer it over looking at articles because they are never specific enough. Thanks :awesome:

Re: Bloom Shader Problem

Posted: Tue Apr 19, 2016 7:28 am
by dandruff
Did you read the blog post about shaders in love? It covers the basics of shaders:
http://blogs.love2d.org/content/beginners-guide-shaders

Re: Bloom Shader Problem

Posted: Tue Apr 19, 2016 4:47 pm
by pgimeno
Have you tried to make a bloom effect without using shaders? That would be a first step to enhance your understanding on how the effect works. Once you have that understanding, you also need to know how shaders work. The post that dandruff has posted is a good introduction on the latter. It's the one that made me finally understand shaders.
  • In GIMP, for example, you duplicate the original layer, mask out the parts that you don't want bloom on in the copy, apply blur to the copy, and set it to Additive mode.
  • In pure LÖVE without shaders, you'd need to blur the image somehow, possibly in advance, then use [wiki]love.graphics.setBlendMode[/wiki] to draw the blurred image over the original in additive mode (after drawing the original in normal mode).
  • With a shader, you use the shader to apply the blur, then add the result to the original image.
A good explanation on how to make a bloom effect using a shader is here: http://http.developer.nvidia.com/GPUGem ... _ch21.html - it also explains the principles of the effect itself, which should let you make your own effect. The problem is that it uses terms such as convolution to refer to how to do the blur. It's a problem because that term is not familiar to people who haven't studied maths at that level, and it's easy to get lost with it.

If all you want is a bloom shader effect already made, check https://github.com/vrld/shine

Re: Bloom Shader Problem

Posted: Wed Apr 27, 2016 12:04 am
by Hackz101
Thank you very much. I"ll look into it. But yes, I have checked the beginners guide to shaders as it has helped me for simple ones but not the more useful shaders.