← Back to context

Comment by PrinsWes

3 hours ago

Neat to see and it takes me back years when I needed to make a similar effect for a Christmas greeting for Canon in Flash. It needed to be able to run in Flash and on sluggish office computers of the time (16 years ago - 2010). I eventually settled on a pooled particle system with three bitmaps:

Display bitmap - the visible output Collision bitmap - a grayscale heightmap tracking accumulated snow Snow sprite - the particle graphic with soft/transparent edges

When a particle hit the collision bitmap (simple pixel check), I stamped its graphic onto both the display bitmap and added it to the collision bitmap. Using grayscale for collision meant soft-edged sprites contributed proportionally to the heightmap, preventing the soft/transparent edges from causing unrealistic fast accumulation. Using stamping meant that we did not have to keep all the collided particles in memory and so the user could spam away snow particles with their mouse to their hearts content (few 100's at a time).

Edit: even more fun to see all the different ways to solve the same 'problem'. From simple to quite complex!