Sunday, May 16, 2010

Graphics Final: Volcano Simulation

Adam Dziuk and Benjamin Finkel
CS 384G Final Project
Volcano Simulation

For our final project in CS384G we strove to emulate the effects of smoke from volcanoes, taking great inspiration from Eyjafjallajökull's prominence in recent news. This process was divided into the two components of lava and smoke, chosen for their distinctiveness as part of eruptions. We rendered the lava as a swarm of particles parametrized with time-dependent variables. The smoke was rendered using a 3D adaptation of Jos Stam's simulation of stable fluid dynamics, chosen as the best way to produce the distinctive vortexes which often characterize smoke.

The lava particles are assigned a random mass when they are generated, which affects their size, mass, velocity, and lifespan. This allows the smaller particles to act like spray which quickly vanishes from view, while the larger ones resemble proper globules of lava. These effects were chosen because they allow for a constant amount of particles to render what appears to be a constant eruption. This allows for much quicker simulation because it does not require resizing of the vector, which can quickly become very expensive.

Jos Stams "Real Time Fluid Dynamics for Games" paper contains source code and explanation for a high speed, good looking fluid dynamics simulation that requires relatively little overhead. Indeed, the simulation of the fluid dynamics itself is relatively minor compared to the rendering time for most relatively small sized simulations (56^3 takes about 5 minutes to render a 20 second movie).

Stam's simulation partitions a space into cells which hold densities of the fluid as well as velocity vectors for moving the fluid around. The vectors and densities are initialized and updated with each time step for factors like wind and the volcano's expulsion of the smoke. But each time step also updates those quantities by the process of advection, which simulates the momentum of the fluid. This process transforms the vectors along themselves.

Jos Stam released source code for how to simulate his fluids in 2D, so the tricky aspect of our project was adapting it to the third dimension. We decided to render the smoke as cubes, analogous to Stam's squares, with alpha blending to color it. By raising the resolution of the grid to a high degree, we got smooth looking smoke to issue from the volcano, with the expense of a massive rendering time.

The smoke simulation is highly sensitive to its settings allowing us to produce interesting effects by having powerful wind:
or by manipulating diffusion



In the end, by rendering overnight we were able to get some very nice looking eruption videos.
Here is our final result:


References:
Jos Stam's publications
Stable Fluids
Real-Time Fluid Dynamics for Games
Stam's code

Adam Dziuk and Ben Finkel

2 comments:

alex said...

Faust post!

That's some cool visuals. You said you had to leave the volcano rendering overnight... what kinds of things can you render in realtime?

Azeltir said...

Well, we could do the lava in real time. And we could do a bunch of really obviously cube-made smoke. The problem is that the smoke is in fact a big grid of cubes that keep track of the density and velocity of the fluid they represent. So the finer the grain of the grid, the cubic the increase in computation.

Ben