Download the windows demo (light sources are invisible in this version) PlanetBuster2.zip.
In conventional movies, a planet or large space object just blows up in a lame explosion with a ring that defies physical explanation racing away: the explosions are so powerful that the planet/large object is instantly consumed. I'd much rather see oceans boiling off, shockwaves circling the planet and continents buckling in their path, etc. It would be as if the planet was ripping itself apart in an extremely detailed (and 'realistic') way. This project is a step towards realizing exactly that sort of carnage.
Having just ploughed through Alastair Reynold's Revelation Space the other weekend, the important issue of
realistic destruction was in mind, and coincidentally the 'SpringSphere' project I was working on would under some conditions look like a planet getting laid to waste with some kind of horribly destructive weapon (relativistic projectiles? focused gravity waves?).
Most of the work (spanning a couple of days in itself) stemmed from the work I did with spring systems.
The brown planet is comprised of two layers of interconnected springs and masses, and each spring on
the visiblie surface is also a triangle edge, and likewise the springs are connected in pyramid-like
Here's a simplified picture, the lighter sphere is the invisible interior label, dark purple lines are vertical springs
connecting the two layers:
The explosion looks good at first glance, but across all these pictures it doesn't change. It's just a white
sphere inside of a transparent shell that I placed on top of the initial disturbance. It would look cooler expanding,
drowning out the screen in a flash of brilliance and then disappearing.
The starry background should probably be rendered invisible by the brightness of the blast, but regardless the sky was generated from around 10,000 GL_POINTS in a volume surrounding the scene, randomized color, and fog effects to make more distant objects dimmer. Instead of redrawing the points every update, the stars are rendered to a skybox upon initialization.
The extreme disturbance chronicled in these pictures is the result of an impulse force imparted on a few
the masses near the pole (where the 'explosion' white sphere is), causing oscillations that travel to adjacent
masses and eventually envelop the whole planet. It's more of a thin rubbery egg-shell than a crust-and-mantle, so future improvements could put additional layers of spring masses deeper into the core, and gravity could be implemented. What would really complete
the effect is if overextended springs would snap and send chunks of rock off into space. As it is, eventually the whole thing starts to collapse (and look less like a destroyed planet) like a crumpled sphere of paper.
If you look closely at some of the pictures, you can see that the normals are per-triangle rather than per-vertex, but
there are so many triangles it doesn't look too bad. Since every triangle has vertices that move around semi-independently, the normals have to be constantly recomputed (there's probably a less expensive way to do this), and averaging triangle normals together would be much more time-consuming.
Every update recomputes the velocities of every mass, the forces on which are determined by the length and orientation of the springs. There are about 2*350*350 triangles, not a inconsiderable amount, but
on my 1.5 Ghz Geforce 2 system the bulk of time is spent updating the spring and masses, of which there are about ten times the number of triangles. I could probably gain a lot from using a more approximate square root method. Updates take about 5 seconds, and the picture with the most extensive damage took about a half hour to arrive at.