Fun with particles

This evening, in response to a question over email, I started wondering whether Javascript is fast enough to do simulations with many particles. So I wrote a little test program with 500 particles. Since every particle needs to interact with every other, the program needs to do more than a hundred thousand particle/particle comparisons at each animation frame.

I was happily surprised to discover that this performs just fine in my web browser. You can try it by clicking on the image below:


Then, just for fun, I started playing around with how the particles interact. I tried making them “sticky” so that instead of bouncing off each other they would clump together.

I was happy to see that the particles started forming and re-forming weird shapes, which make me think of alien creatures. Some of these creatures look a little scary. It’s a good thing they only exist inside a computer! Click on the image below to see the simulation:

2 thoughts on “Fun with particles”

  1. Hey Ken,

    In our SIGGRAPH paper “Asynchronous Contact Mechanics” from a few years ago (2009), we actually explored, just a little bit, these “particles in a box” and the shapes they make with different coefficients of restitution. (towards the end of the paper)

    We also found in the book “Computational Granular Dynamics: Models and Algorithms” (Poschel and Schwager), a discussion of these “characteristic clusters”. Interesting stuff.

Leave a Reply

Your email address will not be published. Required fields are marked *