Blog

Archive
| All posts |
  • Shatter

    published on 4/4/2011 6:28 PM
    On the morning of 26th of March I finally came up with an idea that I could use to join the DBF Destruction competition 2011. The problem was that the deadline was the very same day. The idea I had was to simulate the shattering of glass and as such it was a fairly ambitious idea for the 8 hours that was left until the deadline but I though I might as well try. A while before the deadline I had a entry that I though was good enough to enter the compo with.

    The original entry finished 3rd but work continued on the effect and this is the end result of a few days of polishing.


    The process to do this effect is as follows.
    1. Create 4 points and add to a list
    2. Depending on the destruction done on the window
      • For a explosion randomize a number of points inside the rectangle formed by the 4 points
      • For a bullet hit pick a random point and generate rings with the initial point in the center
    3. Triangulate the point list. Paul Bourkes triangulation works fine for this
    4. From the triangle soup create one shard per triangle.
    5. Depending on the destruction done on the window
      • For a explosion calculate the distance from ground zero and apply a force equal to that to each point in the shard list
      • For a bullet hit calculate the distance from the ray and apply a force equal to that to each point in the shard list
    6. Use a verlet integrator to simulate the shards particles. The verlet integrator is very simple, fast and stable so perfect for shards.
    7. After the integrator has moved the shards forward a time step move all points out from any collision surfaces
    8. Let the effect run for a few seconds then apply a linear interpolation that takes the shard particles back to their original location to create the rebuild effect
    9. Apply an appropriate shader to the triangle list and the effect is complete

    Only one window is simulated and then cloned 3 more times to create the illusion of a fully simulated box.
    The first explosion in the video is about 2000 shards in each window the 2nd and 3rd explosions are closer to 30000 per window.

    No textures where used or harmed in the making of this entry. It's all procedural.

    You can try it yourself. Start it with the "run.bat" file. Most of the scene can be changed in the scenes/shatter.p9s file



Comments

You need to Log in/register to add comments