2
\$\begingroup\$

What is a simple way to simulate flashing candle / torch / fire light? I'm not asking about animating the flames, I'm only interested in the light surrounding the fire, similar to what this device does: https://www.youtube.com/watch?v=dPsVr4pU8Tg

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$
double nexLightIntensity(lastIntensity)
    return clamp(0,1, lastIntensity+(rand()-.3)/100)

adjust parameters as needed

\$\endgroup\$
3
  • 1
    \$\begingroup\$ In addition to varying the light intensity, you may also want to move the light source slightly around its nominal location to make it flicker more realistically. \$\endgroup\$ Nov 15, 2013 at 23:35
  • 1
    \$\begingroup\$ I would think using Perlin noise for the position and intensity might work well. \$\endgroup\$ Nov 17, 2013 at 6:05
  • \$\begingroup\$ This works perfectly! I thought it would be harder :) \$\endgroup\$
    – cube
    Nov 30, 2013 at 9:03

You must log in to answer this question.

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