5
$\begingroup$

How can I make an object give the effect that it is giving out light when it isn't? I basically want to make an object glow, for example Neon Lights. Also Area Lights in my engine work properly but to increase how realistic it looks I wanted to give the effect of a haze or glow rather than a flat white rectangle/disk.

This photo basically shows what I want to do perfectly.

enter image description here

$\endgroup$

1 Answer 1

7
$\begingroup$

This effect is called light bloom. Its algorithm is usually a variation of the following:

  1. Render your scene (preferably in high dynamic range) to texture.
  2. Make a thresholding pass to another texture. I.e. pixels whose brightness is below a certain (configurable) threshold are are turned down to black.
  3. Downsample and blur the thresholded pixels. Usually, this is done in several "octaves", i.e. rendering a Gaussian blur with a small kernel to progressively smaller render targets: from full resolution to half resolution, from half to quarter etc.
  4. Composite the downsampled octaves back onto the scene image.

Both the number of octaves used and the Gaussian blur kernel size affect the end result in terms of visual quality and performance, so you may need to do trade-offs.

In other words, the glow effect that you seek is usually simply the original scene image, but thresholded and blurred, superimposed back onto the scene image.

$\endgroup$
4
  • $\begingroup$ Would you know of any online tutorials that do this? $\endgroup$ Commented Nov 4, 2016 at 5:56
  • 1
    $\begingroup$ @ArjanSingh The UE4 source code has examples of how to do this exact method. $\endgroup$
    – Syntac_
    Commented Nov 4, 2016 at 8:31
  • 1
    $\begingroup$ It's a bit more complicated in UE4 because it also generates lens flares, and the shader system requires some engine know-how to understand, but yeah, AddBloom() here is a good starting point. However, for a super-simple technique that involves an optional "lens dirt" effect, you could check out the post-processing library I wrote back at university: the CPU side (lines 222-241) and the bright pass and compositing shaders. Apologies for TinyURL, comment was too long. $\endgroup$
    – IneQuation
    Commented Nov 4, 2016 at 9:09
  • $\begingroup$ Also, this blogpost is a pretty cool resource for camera effects such as this. It links to Intel's tutorial on the subject, with compute shaders in mind, for instance. $\endgroup$
    – IneQuation
    Commented Nov 4, 2016 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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