18
\$\begingroup\$

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.

\$\endgroup\$
4
  • \$\begingroup\$ looks like particle simulation system \$\endgroup\$
    – Dave O.
    Commented Feb 21, 2011 at 1:02
  • \$\begingroup\$ Please add a screenshot :) \$\endgroup\$
    – Kromster
    Commented Feb 21, 2011 at 10:18
  • 1
    \$\begingroup\$ 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. \$\endgroup\$
    – Elva
    Commented Feb 21, 2011 at 11:26
  • \$\begingroup\$ That looks half ugly, half beautiful, and 42% like a lot of gradients were used. \$\endgroup\$ Commented Feb 22, 2011 at 0:46

3 Answers 3

6
\$\begingroup\$

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)
\$\endgroup\$
5
  • \$\begingroup\$ how exactly does one "add" the images together? alpha-blending? \$\endgroup\$
    – Dave O.
    Commented Feb 21, 2011 at 15:00
  • 2
    \$\begingroup\$ Here's a relevant comic strip re: bloom. media.giantbomb.com/uploads/0/7554/1510356-bloom.jpg \$\endgroup\$ Commented Feb 21, 2011 at 15:03
  • \$\begingroup\$ 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]) \$\endgroup\$
    – void
    Commented Feb 21, 2011 at 17:27
  • \$\begingroup\$ 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. \$\endgroup\$
    – zfedoran
    Commented Feb 21, 2011 at 21:12
  • \$\begingroup\$ There are a lot of ways you can blend stuff together after blurring. The blend mode might scale against the background color/alpha. \$\endgroup\$
    – void
    Commented Feb 22, 2011 at 7:17
0
\$\begingroup\$

Fluid Dynamics + Additive Blending + Bloom?

\$\endgroup\$
0
\$\begingroup\$

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

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .