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
1 Answer
double nexLightIntensity(lastIntensity)
return clamp(0,1, lastIntensity+(rand()-.3)/100)
adjust parameters as needed
-
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\$– cubeNov 30, 2013 at 9:03