Bloom Shader Problem

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Hackz101
Prole
Posts: 4
Joined: Sat Mar 12, 2016 6:44 pm

Bloom Shader Problem

Post 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:
User avatar
dandruff
Prole
Posts: 38
Joined: Fri Jan 15, 2010 1:39 pm

Re: Bloom Shader Problem

Post 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
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: Bloom Shader Problem

Post 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
Hackz101
Prole
Posts: 4
Joined: Sat Mar 12, 2016 6:44 pm

Re: Bloom Shader Problem

Post 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 186 guests