Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

This is the most beautiful 2d lighting I have ever seen, and I'd like to perform lighting like this too. How do I do it?

I don't care about the physics or how the particles are simulated - I only want to know about the lighting.

Screenshot showing the lighting

Here are some videos for reference:

Or you could download Polluted Planet 2 here.

share|improve this question
    
looks like particle simulation system –  Dave O. Feb 21 '11 at 1:02
    
Please add a screenshot :) –  Krom Stern Feb 21 '11 at 10:18
1  
Like Dave O said, some kind of particle system, to get the lighting effect I think there is some kind of HDR filter with blur over it. –  Kevin van der Velden Feb 21 '11 at 11:26
    
That looks half ugly, half beautiful, and 42% like a lot of gradients were used. –  muntoo Feb 22 '11 at 0:46

3 Answers 3

It is usually called bloom, and is done by adding a blurred version of the image on top of the original. This combined with a high dynamic range can give some nice effects.

You will probably want to threshold the image before blurring, so that only really bright parts will bloom.

Outline of algorithm:

  1. Render scene to texture (preferable HDR)
  2. Threshold to a new texture: out = rgb_to_gray(pixel) > threshold ? pixel : black
  3. Blur thresholded image, or generate the whole mip chain to get glow over the whole screen
  4. Add images together and do some HDR scaling to get in output range (usually RGB8)
share|improve this answer
    
how exactly does one "add" the images together? alpha-blending? –  Dave O. Feb 21 '11 at 15:00
2  
Here's a relevant comic strip re: bloom. media.giantbomb.com/uploads/0/7554/1510356-bloom.jpg –  Jari Komppa Feb 21 '11 at 15:03
    
You can do any blending that looks good. Regular add is common, another quite common is screen, which does not saturate as much. d = s1 + s2 - s1*s2 (assuming color is in the range [0, 1]) –  void Feb 21 '11 at 17:27
    
This is not done with bloom. Notice how the particles actually occlude each other. For example if you surround the light source particles with black particles, the light does not spread. –  zfedoran Feb 21 '11 at 21:12
    
There are a lot of ways you can blend stuff together after blurring. The blend mode might scale against the background color/alpha. –  void Feb 22 '11 at 7:17

Lots of particles with additive blending could achieve a similar effect.

share|improve this answer

Fluid Dynamics + Additive Blending + Bloom?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.