1
\$\begingroup\$

I'm currently working on a 2D lighting system that has point lights effectively rendered as a quad in a top-down 2D view, something like this for each light:

enter image description here

I'd like to achieve a somewhat realistic "flickering" effect by changing the position and attenuation of the light over time, simulating the light emitted from a torch or candle. What would be a good way to adjust these attributes of the light, and how quickly / over how much time?

\$\endgroup\$
1

1 Answer 1

5
\$\begingroup\$

Randomly.

But not entirely randomly, as pure noise isn't very pleasing and isn't really even realistic in this case. Instead, generate some kind of one dimension smooth, repeatable noise (based on Perlin noise, although that alone might be too smooth, so perhaps some FBM noise).

Use that to adjust the light's attenuation over time, and perhaps to jitter the light's effective position within a very small radius over time, and you should get a reasonable approximation of the candle effect.

As for exactly how much or how often to do this... that's mostly up to you and your art style and what "looks good" in practice. You'll likely need to tweak both the frequency of updates and the parameters to the noise functions to get an effect you really like.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks for the insight Josh! Wouldn't have though to look at FBM noise. \$\endgroup\$ Commented Mar 14, 2016 at 17:39

You must log in to answer this question.

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