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\$
2
\$\begingroup\$
double nexLightIntensity(lastIntensity)
    return clamp(0,1, lastIntensity+(rand()-.3)/100)

adjust parameters as needed

\$\endgroup\$
  • 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\$ – Ilmari Karonen Nov 15 '13 at 23:35
  • 1
    \$\begingroup\$ I would think using Perlin noise for the position and intensity might work well. \$\endgroup\$ – David Cummins Nov 17 '13 at 6:05
  • \$\begingroup\$ This works perfectly! I thought it would be harder :) \$\endgroup\$ – cube Nov 30 '13 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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