It’s happened again – a topic that I touched on in my Milan talk shows up in a New Scientist report from earlier this year (I only just caught up with it). In the talk, I commented on the profound challenges of mathematically modelling and simulating such an apparently simple material as sand, and referred to the amount of effort and research that had to go in to the stunning special effects for the Sandman character in Spider-Man 3:
From wired.com (ignore the reference to “the molecular structure of sand”):
The secret to Spider-Man's success can be found in a single grain of sand. After all, it's not really Peter Parker in latex that makes this film franchise a billion-dollar box office hit. It's the villain, and this time around it's the Sandman, a shape-shifting computer-generated marvel made up of thousands of digitized grains of sand.
But making the villain wasn't easy (nor was it cheap). It all started with director Sam Raimi peering through a microscope to study the molecular structure of sand, and led to two-and-a-half years of visual-effects R&D and a crew of 30 special-effects technicians.
"I had people bring in 12 different kinds of sand -- this is where people think the movie industry is insane -- so I could look at it," says Raimi. "I saw California beach sand, Mojave desert sand. We ended up picking Arizona sand because it looks exactly like ground corncobs. The reason that's important is that when you bury people alive in hundreds and hundreds of pounds of sand, they'll be squished. You need something lightweight like corncobs, so air can get through and the actors and stuntmen won't be crushed."
Computer modelling of sand as individual grains, even with the power of today’s algorithms and processing capacity, is limited to tens of thousands, perhaps a hundred thousand, grains. But now a different approach has yielded impressive results, as reported under the title “CGI tricks: How to make a fake beach look real” in the New Scientist:
From explosions in a desert, to the trickle of an egg timer, animated scenes containing sand are notoriously hard to model. But now Rahul Narain and his team from the University of North Carolina at Chapel Hill have developed a new technique that should make computer animations look more realistic.
Since sand is made up of a collection of tiny grains, its appearance can vary greatly. "It can look like a solid pile you can stand on, to a flowing avalanche, or even a cloud of dust," says Narain. Much work has gone into modeling solids and fluids, but materials such as sand have received less attention, perhaps because of these unique properties. So far, the only way to simulate sand has been to model every grain as an individual object, which can be extremely costly in terms of computation time and memory.
Narain and his colleagues are taking a more holistic approach. They realised that although individual sand grains do move independently, in practice the grains tend to flow together more often than not. So it made sense to make the most of existing fluid-modeling techniques and model sand as one big continuous material.
"This 'continuum based approach' makes it possible to simulate sand in a much faster and more memory-efficient way without sacrificing much in the way of realistic behaviour," he says.
Their new model also includes algorithms to make sure it's simulated realistically in instances when sand behaves differently from liquids. They do this by taking into account the forces on the particles, such as friction. When tested with animated sand clouds forming in an explosion (see video above) the results proved to be true-to-life.
As well as being used in animated films and games, when the technique is refined further it could be used to model real life scenarios such as avalanches and explosions.
The video (from which the image at the top of this post is a screen-grab) is impressive, and can be found on youtube.