Bloom lib.

Any community contributions to libgdx go here! Some may get included in the core API when permission is granted.

Bloom lib.

Postby kalle_h » Sat Jan 21, 2012 1:11 am

I made simple but effective library that handle blooming. Using is almoust ridicoulous easy.
http://code.google.com/p/bloom-lib/

@render
Code: Select all

bloom.capture();
//your render code

bloom.render();


@create
Code: Select all
bloom = new Bloom();//too small can cause aliasing but is lot faster


@resume
Code: Select all
bloom.resume();



Pipeline goes something like this. Capture your scene to fbo with bloom.capture();
Call bloom.render(). Then library does take minimized copy of original image with highpass filter(simple treshold, adjustable).
That smaller image is pinponges via horizontal and vertical gaussian passes. Blur is identic with 9x9 size kernel but use only 10texture look ups without any dependance reads, this is ridicoulous fast way to blur.
Then scene is rendered with fullscreen pass back to screen. Shader in this stage is pretty minimalistic.

//final
Image

//only bloom texture
Image

//original
Image

Use it freely.
Last edited by kalle_h on Thu Mar 29, 2012 9:32 pm, edited 3 times in total.
kalle_h
 
Posts: 637
Joined: Thu Dec 29, 2011 9:50 pm

Re: Bloom lib.

Postby kalle_h » Sat Jan 21, 2012 1:38 am

Loader issue fixed.


Currently blooming migh or might not work well with 2d games. I have had both experiencies.
kalle_h
 
Posts: 637
Joined: Thu Dec 29, 2011 9:50 pm

Re: Bloom lib.

Postby tommo1 » Sat Jan 21, 2012 6:37 am

Are you ever going to plan to merge this with your current lights library?
tommo1
 
Posts: 37
Joined: Wed Nov 02, 2011 1:29 pm

Re: Bloom lib.

Postby kalle_h » Sat Jan 21, 2012 10:19 am

tommo1 wrote:Are you ever going to plan to merge this with your current lights library?

Maybe. Depending how well they play together.
kalle_h
 
Posts: 637
Joined: Thu Dec 29, 2011 9:50 pm

Re: Bloom lib.

Postby kalle_h » Sat Jan 21, 2012 1:16 pm

Added resume() method and some java doc.
kalle_h
 
Posts: 637
Joined: Thu Dec 29, 2011 9:50 pm

Re: Bloom lib.

Postby mzechner » Sat Jan 21, 2012 1:19 pm

Nice, thanks a bunch!
mzechner
Site Admin
 
Posts: 4715
Joined: Sat Jul 10, 2010 3:50 pm

Re: Bloom lib.

Postby Obli » Sat Jan 21, 2012 4:22 pm

Awesome, thanks kalle!
Obli
 
Posts: 616
Joined: Mon Jan 10, 2011 6:18 pm
Location: Bordeaux, France

Re: Bloom lib.

Postby kalle_h » Sat Jan 21, 2012 11:31 pm

Btw: source is inside of jar. Its only 10k with classes and sources so i did't see the need to separate those.
kalle_h
 
Posts: 637
Joined: Thu Dec 29, 2011 9:50 pm

Re: Bloom lib.

Postby bach » Sun Jan 22, 2012 5:42 am

This is awesome! :)

Would be great to add a capture delay option so you can create trailing/fake motion blur effects with the same lib..

Cheers,
Bach
bach
 
Posts: 713
Joined: Mon Mar 07, 2011 1:50 am

Re: Bloom lib.

Postby kalle_h » Sun Jan 22, 2012 1:35 pm

bach wrote:This is awesome! :)

Would be great to add a capture delay option so you can create trailing/fake motion blur effects with the same lib..

Cheers,
Bach

There is option how often bloom texture is updated. I played with some options to get trail but if I dont clear the screen I did get visible glitches. Can you point me to right direction to do it properly?
kalle_h
 
Posts: 637
Joined: Thu Dec 29, 2011 9:50 pm

Next

Return to Libgdx Contributions

Who is online

Users browsing this forum: No registered users and 0 guests