Author Topic: bloom/glow  (Read 8941 times)

0 Members and 1 Guest are viewing this topic.

Offline mind

  • Texture-San
  • DBF Aficionado
  • ******
  • Posts: 2324
  • Karma: 85
    • View Profile
    • boredom is a beatiful thing.
bloom/glow
« on: September 24, 2008 »
so, i developed this bloom/glow/hdr-filter-kinda-thingy that i think was pretty damn awesome.. now what im wondering is if anyone can tell me how people normally code bloom/glow filters.. point is that im trying to figure out if im the first one to do it the way i do it :D and for that reason i wont tell you how i do it, yet :) i will however post a screenshot ^^

here it is:


there, now lemme know how normal people code theirs ^^
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: bloom/glow
« Reply #1 on: September 24, 2008 »
You made it *exactly* as everybody else ;D
Except of the saturation-thing which I find very useful, but most people will probably desaturate light-colours instead.
Challenge Trophies Won:

Offline mind

  • Texture-San
  • DBF Aficionado
  • ******
  • Posts: 2324
  • Karma: 85
    • View Profile
    • boredom is a beatiful thing.
Re: bloom/glow
« Reply #2 on: September 24, 2008 »
You made it *exactly* as everybody else ;D
Except of the saturation-thing which I find very useful, but most people will probably desaturate light-colours instead.


well, it may look like i did it exactly like everybody else does it.. im not quite sure though, which is why i wanted to know how others do :)
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: bloom/glow
« Reply #3 on: September 24, 2008 »
here is an article.
Challenge Trophies Won:

Offline mind

  • Texture-San
  • DBF Aficionado
  • ******
  • Posts: 2324
  • Karma: 85
    • View Profile
    • boredom is a beatiful thing.
Re: bloom/glow
« Reply #4 on: September 24, 2008 »
yeah i read that one long ago.. and no, thats not how i do it, far from it :)

or well, the blur and add is the same i suppose, but the way i generate my glow maps is not :P
« Last Edit: September 24, 2008 by mind »
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: bloom/glow
« Reply #5 on: September 24, 2008 »
According to your screenshot, you take the source colour (or probably intensity), subtract "threshold" (thus clamping everything below to black), scale the result by "luminance" (to compensate darkening from "threshold" and weighting the end-result), gaussian and add the result to the source-image ?
Challenge Trophies Won:

Offline mind

  • Texture-San
  • DBF Aficionado
  • ******
  • Posts: 2324
  • Karma: 85
    • View Profile
    • boredom is a beatiful thing.
Re: bloom/glow
« Reply #6 on: September 24, 2008 »
According to your screenshot, you take the source colour (or probably intensity), subtract "threshold" (thus clamping everything below to black), scale the result by "luminance" (to compensate darkening from "threshold" and weighting the end-result), gaussian and add the result to the source-image ?


nope, thats not how i do it.. the threshold is used for the binary glow mode only(where you see "warm" i also have a cold and a binary mode. luminance and saturation are something i added just for fun, so i could give the images a feinter glow instead of the default max glow :D luminance and saturation are 2 different buffers with different lighting data.. but good guesses nontheless, keep em coming :P

now iz bed tiemz!
Challenge Trophies Won:

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
Challenge Trophies Won:

Offline mind

  • Texture-San
  • DBF Aficionado
  • ******
  • Posts: 2324
  • Karma: 85
    • View Profile
    • boredom is a beatiful thing.
Re: bloom/glow
« Reply #8 on: October 01, 2008 »
here's mine:

OpenGL:
http://rel.betterwebber.com/junk.php?id=83

Software:
http://games.freebasic.net/forum/index.php?topic=80.0


the software one is just a "do stuff on source buffer->copy to other buffer->blur other buffer->add other buffer to source buffer", right? the ogl one is beyond me, i have no idea how opengl works :P
Challenge Trophies Won:

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
Re: bloom/glow
« Reply #9 on: October 01, 2008 »
Actually they're the same methods.
I still do the blooming part using software.
Just an RGB blur that sucks.
Yours look way nicer. LOL
Challenge Trophies Won:

Offline mind

  • Texture-San
  • DBF Aficionado
  • ******
  • Posts: 2324
  • Karma: 85
    • View Profile
    • boredom is a beatiful thing.
Re: bloom/glow
« Reply #10 on: October 01, 2008 »
Actually they're the same methods.
I still do the blooming part using software.
Just an RGB blur that sucks.
Yours look way nicer. LOL


thanks :) best part is that it doesnt add any glow to parts that arent supposed to glow, and i dont have to use any exponential curves to darken/brighten any of the image before blurring/combining :D
Challenge Trophies Won:

Offline madsravn

  • ZX 81
  • *
  • Posts: 13
  • Karma: 0
    • View Profile
Re: bloom/glow
« Reply #11 on: November 17, 2008 »
Looks awesome.. And I especially like the girl ;) I have been wondering whether I shouldn't make something similar... :)

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
Re: bloom/glow
« Reply #12 on: December 19, 2008 »
Mind: How do you do your "luminance" pass?  The filter before the blur.


As for the glow, I would assume you are doing a gaussian or box filter on about 3 or 4 rescaled textures at these factors (1/2,14,1/8,1/16...) and paste them above the original pic.
« Last Edit: December 19, 2008 by relsoft »
Challenge Trophies Won:

Offline mind

  • Texture-San
  • DBF Aficionado
  • ******
  • Posts: 2324
  • Karma: 85
    • View Profile
    • boredom is a beatiful thing.
Re: bloom/glow
« Reply #13 on: December 23, 2008 »
well, i guess it's time to reveal the awesomeness that is my bloom filter :D

the idea came to me when i was sitting on the tram on my way home from a party, experienceing a pretty sweet LSD afterglow :P Basically i figured that we waste(read; throw away) so much relevant data when we code stuff. And mainly, for this i was refering to light.. for example, when we add colors together we usually saturate them at 255 to avoid an overflow, and damn thats a waste.. so anyways, i thought of the great idea to use that insight to make a bloom filter, and started coding it as soon as i got home..

as cool as it looks, its actually REALLY simple.. you take the 2 images you want to add, be it source1+source1 or source1+source2, you add them as usual BUT instead of saturating, you pop the overflow into a "glow-buffer", you then blur that buffer with an appropriate blur(in my case a standard slow as hell blur, since i was too lazy to code a box blur for this) and add it to your original scene..

something like this:


function makestuffglow;
begin
  for x = 0 to width do
   for y = 0 to height do
    if source1[x,y]+source2[x,y]>255 then glow_buff[x,y]=(source1[x,y]+source2[x,y])-256 else source1[x,y]=saturate(source1[x,y]+source2[x,y]);
   end; 
  end;

  awesome_fast_boxblur(glow_buff);
  source1=saturate(source1+glow_buff);

end;

and thats pretty much it.. the Luminance and Saturation parameters i use are just for controlling the brightness/saturation of the glow map before blurring and adding it all together..

there ya go, now let me see you use it wisely in some realtime productions.. and remember, credit where credit is due, or i'll come to your house!! :P
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: bloom/glow
« Reply #14 on: December 23, 2008 »
cool!!

thats very simple indeed mind i will definitly be giving this a go cheers! k+
Challenge Trophies Won:

Offline spitfire

  • Amiga 1200
  • ****
  • Posts: 275
  • Karma: 9
    • View Profile
Re: bloom/glow
« Reply #15 on: December 24, 2008 »
Cool, thnx for sharing. I'm sure there could be other interesting uses for an overflow buffer too.

Offline nunu

  • ZX 81
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Re: bloom/glow
« Reply #16 on: August 24, 2009 »
I just have to have a say ;)
Your method is still the same as the one using tresholding :p

Because adding source with itself leads to double intensities, right? Now if you take whatever goes over 255 to your overflow buffer you get the same values as you would get when tresholding away everything that is below 255/2.