Multiplatform Building Explosion
- May 9th, 2010
Follow me on twitter @ikerwan. I’ll be more than happy to answer your questions or read your suggestions.
Welcome to the “Blow up a Building Tutorial Part I” for Maya and Realflow. This is an intermediate/advanced guide that requires previous knowledge in these particular platforms. Newbies will have a very difficult time following these instructions.
In this installment of the tutorial, we’ll create a realistic 3D simulation that emulates the conditions for a building that is damaged by an explosion. We will only focus on the dynamics and behavior of the structure. This includes all the forces and physics that are applied to it.
We will not focus on the details and the compositing. Stuff like smoke, fire and other particle effects will be addressed in part II of this series.
First off and before we begin to blow stuff up, you must have a basic understanding on how an explosion works. If you don’t feel like being bored with a brief lecture on the physics of an explosion, skip this section and move on directly to the tutorial part. Albeit, if you really want your effect to be realistic and convincing, I recommend you stick around for this.
I) The physics of an explosion
In an effort to spare you from taking a nap on your keyboard, I promise to keep this simple and thorough.
An explosion is basically a sudden and powerful release of pressure and heat. Sometimes, it can be more of one or the other, it all depends on what it is used for. Usually, when you want to remove objects or destroy structures, you want the pressure element to be the strongest.
An explosive device is usually contained into a package of some kind. It is triggered by applying a catalyst that creates a chain reaction that ultimately releases extraordinary amounts of energy. This energy collides with everything around it and displaces it outward, destroying almost everything in its path.
In a man-made explosion, there will always be an attempt to control these forces and pressures by directing the release of this energy towards certain directions. Fact is, little can be done to control this effect entirely, since all the pressure moves in every direction evenly. All the objects that are in the way of this burst will apply a counter force that will act against this pressure.
In most cases, objects will collapse and lose their structural integrity against this force. The resulting effect is the acceleration of these objects in the direction of the pressure. Gravity and mass add themselves to the mix and create what we know as “debris”. At some point, it will end up being launched very fast and at the same time, create new destructive forces.
Heat is usually used to create an additional catalyst to the process of debilitating the structural integrity of an object. This is exactly what happened in the tragic events of 9/11 in New York. The heat melted the steel components in the Towers, which ultimately led to their collapse.
The most important thing that should be understood from all of this is that pressure is what does most of the destruction, not the heat or the debris. If massive amounts of pressure are applied on a concrete plank, it will fragment more where it absorbs this energy most, leaving the other parts of it weakened and broken, but less damaged.
If we were to put a pile of dynamite in the middle of a concrete box, the region that would be most damaged by an explosion is the ground adjacent to it. Since the ground also creates a resistive element (because it is supported by the earth itself), that energy will reflect and bounce off in all directions. The explosion will find the weakest point in the box and affect it. This is why when a bomb is dropped from the sky there is always a crater, but most of the damage is in its surrounding area. If you observe closely, a lot of the dropped bomb’s energy is wasted upward. Billions of dollars have been invested on how to counter this unwanted loss.
I suggest you look around for examples of these explosions and observe their behavior before proceeding to create your own virtual instance.
If you’re still awake and in the mood, let’s now proceed to the creation of the structure we will blow up.
II) The tutorial: Modeling with Maya
A) Creating our structure.
Like in literature, in order to achieve a certain degree of realism in our simulation, we must create an effect called: suspension of disbelief. That is, make it “seemingly realistic”.
Maya is great at many things, but dynamic calculations is not one of them. In here we will model our building and give its form and texture. Most of the physics will a job left to Realflow.
First thing is to create a building that is as similar to reality as possible. Since most of us don’t have powerful super computers that can process billions of calculations per second, we will keep this structure very basic. In this case, we will use simple concrete planks and steel reinforced columns along with glass windows.
A.1) Start a new Maya project and Save it with whatever name pleases you most.
A.2) Create a Plane polygonal object with the following characteristics and duplicate it 5 or 6 times (size is irrelevant):
A.3) Using the Split Polygon Tool, divide the first Plane into something that looks a little like this:
NOTE: Be careful not to divide these planes too much, these fragments will ultimately become our flying pieces of debris. You have to repeat this process over and over again. When these pieces start to add up the calculations your machine will have to process for the simulation will augment exponentially. Make sure you don’t go all Stephen Hawking on it. Keep it simple.
These Planes we just built will act as the floors of our building, so keep in mind they will also end up collapsing on top of each other.
Make sure you understand how the explosion will work. Make the smallest fragments where the actual explosion takes place and the largest from where it is furthest. This usually is a process of trial and error. Be very patient and ready for a lot of experimentation. If you get it right on your first try, I will add you to my list of heroes.
A.4) Repeat the process of fragmenting the pieces on all the other Planes. Be sure to keep the size and geometry of these objects realistic.
A.5) Delete the history on all your Planes. Repeat this process as often as possible.
A.6) Hide and leave only one Plane visible at a time. On the “polygons” menu in Maya, go to Edit Mesh> Keep Faces Together and uncheck it.
A.7) Select the Plane and apply Mesh> Extract
A.8) Delete your history once again and freeze all transformations.
Make sure you now have individual pieces for what used to be your Plane.
A.9) Select all fragments. Freeze all transformations, delete history and center pivot.
A.10) Select all the pieces you have and apply Edit Mesh> Extrude. Extrude your pieces to the desired width. Keep in mind that you will have to repeat this process for the other Planes so try and keep a relatively easy to match width (Y axis).
A.11) If you feel like you have too many pieces, select a couple of them together (make sure they’re adjacent to each other) and select Mesh> Combine. This will add these pieces into one object. This can also help you define a more realistically looking “cracked” surface. This step is optional.
A.12) Once you’re satisfied with your objects, go to Mesh> Triangulate, delete their history and freeze transformations. This step is extremely important. Realflow will go crazy if all geometry isn’t properly triangulated when you export from Maya.
A.13) Group your fragments and rename the group into something you’ll recognize.
A.14) Repeat all these steps with your remaining Planes.
A.15) Select all your Plane groups and hide them.
B) Creating the supporting columns
Now that we have our floors done, we can proceed to create the columns. The process is actually very similar, but there are a few new things we can try to make these pieces look more realistic and convincing. One thing that is important to have in mind, is to keep proportions balanced. You don’t want a column to be too big or too small. They will also define the distance between the floors and the height of your building.
There will be 4 columns per floor (minus the ground level and the roof). When you make your first column, duplicate it before you actually start modifying it into fragments. It is always good practice to keep an unmodified “master object” for every piece of geometry you create, in case you mess something up… and believe me, you will.
B.1) Create a polygonal cube and give it any size you want. Make sure it has these characteristics (size depends on what you want to give it):
B.2) Once you’re satisfied with it, delete the history, freeze transformations, duplicate the object and hide the copies. Leave only one object visible.
B.3) Go to the dynamics menu in Maya. Select your column and go to Effects> Create Shatter Menu
B.4) Select the Solid Shatter tab.
This option is extremely tricky. You have to play with it and have lots of patience. If your polygonal object does not have its history deleted and transformations frozen, the effect won’t work. This can really drive you nuts, so always make sure you have followed these steps closely.
B.5) Put in the following options. The number of pieces depends on the placement of the column: more pieces if it’s close to the explosion, less if it’s not. Be sure to uncheck the “apply interior material” option. What this does is that it gives a yellowish texture to your inner geometry. If you’re like me and like to texture all objects personally, you’ll find this incredibly annoying.
B.6) Once you’re satisfied with the amount of fragments and general look of your column, delete the history and freeze transformations.
B.7) Group your fragments and rename the group into something you’ll recognize.
B.8) Repeat the process for all your remaining columns.
C) Building your structure
C.1) Unhide all your geometry
C.2) Take all your floors and columns and stack them like so:
C.3) Select everything and delete its history and freeze transformations. Make sure everything is properly triangulated.
C.4) If you haven’t done so, try and rename the most relevant objects in your scene.
D) Creating window frames
The windows will actually be divided into panels that will work as the exterior facade of the building. Glass is usually supported by a frame that holds it together. I recommend you check out the right size for the panels that will end up covering your building before your start modeling.
We will first start with the frames.
D.1) Create a cube that will serve as the vertical part of the frame with the following characteristics. The size ultimately depends on what will end up fitting best for your structure. The horizontal pieces of the frame will end up resting on top of them, so make sure you get these dimensions right.
D.2) Once you’re done, duplicate the object once and then hide both objects.
D.3) Create a cube that will serve as the horizontal element of your frame with the same characteristics you used for the vertical pieces. Once again, make sure you give it the right dimensions.
D.4) Duplicate it once and then unhide the vertical pieces.
D.5) Make a perfectly rectangular or squared frame with these objects. Make sure the horizontal pieces rest on top of the bottom vertical piece and the top vertical is on top of both the horizontal cubes. If you don’t do it this way you will regret it later on in Realflow, guaranteed.
D.6) Delete history and freeze transformations for all four objects.
D.7) Group all four pieces and rename the group. Duplicate it as much as you have to. Hide all these new duplicates and keep just one copy visible.
D.8) Apply the same solid shatter effect you previously used on the columns to each of the pieces of the frame. Since window framing in a building is usually made from aluminum, it tends to be weaker and more flexible than concrete. They tend to fragment into bigger pieces, so divide each cube into 2 or 3 pieces maximum. Remember, they’re adding up.
D.9) Once your done, delete all history and freeze transformations. I wish I didn’t have to repeat this as much, but it is extremely important.
When producing special effects it is important to remember we are just creating an effect, an illusion or “magic trick” of some sort. This is not an advanced simulation that is going to be used for scientific research. All we care about is what the camera will be pointing at. So make sure you don’t go shattering all the frames in the building. Select the area that your explosion will cover and limit all pieces of debris and fragments to that area alone. Whatever is behind it or not shown is of no importance to our cause.
Now we can proceed to create the windows.
E) Creating windows
The process for the windows is the exact same thing we did for the floors back in section A. The only real difference is that we don’t really need to add depth by extrusion to the glass. We could choose to do this, but it’ll only end up making the computer do unnecessary calculations regarding, dynamics, reflections, refractions, transparency and shadows.
Simple planar objects if seen from a distance give the illusion of having some sort of 3 dimensional geometry. If you are thinking of placing your camera really close to the explosion, then you might want to add a little depth to increase the detail. In all, this tutorial is designed to be shot from a distance, but by adding detail to all shatters and pieces you can achieve interesting results for closer shots.
E.1) Go back to the A section of this tutorial and read it again.
E.2) Create a Polygonal Plane and place it vertically
E.3) Size it to fit exactly inside the frames you just created.
I really hope you haven’t started placing all your window frames all over the building. If you did, consider slamming a book on your face, because you’re going to have to bring them all back so that you can place the windows inside of them. If you froze transformations, this will be a true nightmare.
E.4) Once you have the right size for your window, duplicate the Plane as much as needed. Be sure not to duplicate the frame too.
E.5) Hide all the Planes and leave just the one you’ll be working on.
E.6) Divide and separate the window into the pieces you want (repeat all the steps in the A section).
E.7) Group your fragments into a new window group and add it to the frame group.
E.8) Once you’re done working your first window, delete the history and freeze transformations. Even though you’ll end up repeating this step after you’ve put the panels in place, it’s always better to have them properly centered in case you have to rework them later on.
NOTE: I created a script for Maya called “The Matcher”. You can find it at ikerorozco.com and download it for free. It matches any selected object to another object’s postion, size or rotation. It can be very helpful when you’re dealing with things like panels. It’ll work fine as long as your objects are frozen to the exact center of the grid.
E.9) Finish all your remaining frames and windows.
E.10) Place them in their proper position around the structure of the building.
Congratulations. You’ve managed to finish the most mind-numbing part of this tutorial. If you got to this far, I promise the rest will be a lot more fun.
You can choose to add additional things like walls, chairs and desks to add detail to your scene. I actually encourage you to do it. However, this guide will only focus on the basics. I strongly recommend you finish this tutorial first and then add your own stuff.
I built some exterior walls, support elements and bricks to add an additional effect of debris. You may chose to do this if you want, but it’ll slow your simulation down in Realflow. For your first try, I recommend you keep the amount of geometry to a minimum. Once you get the basics of this tutorial, you can go back and make your animation a lot more complex. I’ll keep these structures so that you can see how they will behave and interact with the rest of the dynamic geometry. If all this wasn’t clear, don’t worry; you’ll understand it later.
F) Exporting to Realflow
Most people avoid using Maya for complex dynamic simulations. It’s equations, algorithms and calculations aren’t always the best. If you don’t have access to Realflow and want to try and make this simulation work in Maya, you’re more than welcome to. I can’t guarantee you won’t end up throwing a bowling ball at your computer though. Believe me, I’ve tried.
Let’s proceed with the final stage of the modeling process.
F.1) If something remains hidden, unhide it. Everything has to be visible, except if you have the master objects we discussed previously. You can either keep these hidden or if you’re not planning on using them any longer, delete them.
NOTE: Hidden objects in Maya will not appear when exported to Realflow.
F.2) Select every single piece of geometry in your scene. Delete history, freeze transformations, center pivot and triangulate.
F.3) Double check everything to make sure it’s properly reseted and triangulated. Don’t make all this work be for nothing, Realflow is merciless when it comes to exporting stuff from Maya. If a single thing is wrong, it’ll mess up everything.
F.4) Go to the Realflow tab in Maya
F.5) Export SD file using the standard options. The only thing you have to change is the playback range. Uncheck where it says Use Playback Range. Set the Start frame to 0 and the end frame to 15. If you put your whole timeline in, it’ll take ages to process. You can add these additional frames later in Realflow.
F.6) Make sure the file lands where you want it. You can later move it using your OS, it doesn’t really matter. DO NOT change the file’s name though. It has to have the exact name your Maya file does. This is very important.
You’re done with Maya… for now.
III) Simulating Physics with Realflow
Realflow is probably one of the best written pieces of software out there. If you are new to it and don’t really know how to use it that well, worry not. You’ll get the hang of it right away. Even begginers could go through this part of the process with out a problem. So, let’s proceed.
G) Importing to Realflow and setting the scene
G.1) Start a new file in Realflow and name it however you want. It’s always preferable if you name it exactly like your Maya file to avoid confusion, but you can later change this if you want.
G.2) Go to realflow> Preferences. Go to the General Tab then to the Axis Setup option. Make sure that it is set to YZX (xsi, maya, houdini)
G.3) Now go to to file> import> import object. Select the file you exported from Maya and bring it in.
That whole building you just made in Maya will now appear in Realflow, and if you take a look to your right, you’ll see the name of hundreds of pieces of geometry. I really hope you changed those names. I warned you.
G.4) Select every single piece of geometry there is in the scene (excluding camera and other things that aren’t objects) Go to the Node Params window and change the settings to this:
The important thing here, is to create dynamic rigid bodies with dynamic motion. All the options you see are pretty much irrelevant for now, you can figure out what they do once you start experimenting on your own. The most important aspects here are the “Primitive” and the “@ mass” option.
Primitive gives your object a shape that will collide with other objects. I suggested you change it to Convex Hull because it’ll adapt to your objects shape. Mess around with the options to see how they affect your object. Avoid using the Mesh option for this tutorial because it’ll increase processing time significantly.
Realflow doesn’t keep Maya’s grouping convention; you’ll have to do that again here. If you changed the names, like I told you, that won’t be problem. If you didn’t, go get something to drink a put on a little music, cause you’ll be sitting there trying to figure out which thing is which for quite a while.
You can’t change anything’s name in Realflow (unless you created it in Realflow). Objects that originated in Maya will have to remain as shard1, shard324, pCube8 and so on. If you didn’t change those names, I strongly recommend you go back to Maya and fix things. This includes resetting, deleting history, triangulating and freezing transformations. Re-export your scene, and for the love of God, get it right this time.
G.5) Select all shards and pieces from the ground floor and group them together. Repeat this process for every floor.
G.6) Group all columns that belong to a floor together
G.7) Group all windows and frames into their respective panel and then group all these panels into a single floor. Make everything on the nodes window look organized and nice.
When ordering stuff into groups, make sure you have them divided into something that’ll enable you to work and identify pieces faster. I chose to divide mine according to their dynamic characteristics. Groups of objects that will eventually move were put in groups called “dynamic”. Objects that won’t move are put in groups called “fixed”.
G.8) Once you have a complete floor group ready with ground, columns and panels; group it together and name it something like “1stFloor” or whatever you want. What’s key here, is to know exactly where everything is. Do the same for every other floor
G.9) Go to the small icons on the top of the middle part of the UI and select the little icon that has three orange arrows. This is the daemon menu. Create a gravity daemon.
G.10) Go to the small icons on the top middle part of the UI and select the little icon that looks like a box. Create a Plane.
G.11) Place the Plane as the ground for your structure. Leave it at any size you want, for now.
G.12) Identify the explosion’s exact spot relative to your structure
G.13) Go to the objects menu and create a sphere. Rename it to “bomb”.
This sphere will simulate the energy released by a bomb. It’ll act more like a bashing ball that collides against the structure. I’ve tried using daemons and other properties for explosions, but spheres usually produce the best effect.
G.14) Go back to your workspace and place the “bomb” exactly where it’s supposed to explode.
G.15) Go to Node Params under the Node tab and change the bomb’s dimensions (scale) on all axes to something bigger (this can vary because it all depends on the scale of your project)
Well, here’s the end of the really easy part. Now we’re going to have to apply a little scripting to get our geometry to react only when we need it to and not have our building collapse prematurely. This is exactly why I had you painstakingly grouping every single thing into a very organized system.
We now have to create a Python script that binds everything together until the force of the explosion is applied.
G.16) Go to Layout> Batch Script
G.17) Download and then Copy and paste this script into the Batch Script area. You can load it directly in if you prefer. It’s a python script, so make sure you keep it properly indented or else it won’t work.
What it does is that it creates “fixed constraints” to all your objects. It maintains all objects bound together until there is an external force that applies pressure on it. Thanks to it, our building won’t collapse before the bomb goes off. Notice that I put stuff in the code like “nameOfYourFloor”. In this parameter, you have to put in the name of your largest piece within the structure. For example, if your largest shard within the floor (not the group) is called shard24, then name it exactly like that. IMPORTANT: Keep the quotation marks in the script.
G.18) Run the script. This process will probably end up taking quite a while before it’s done. It has to create a constraint for every single piece of geometry there is in the scene. Let it work its magic.
G.19) Create a ground plane to cover a very large area, this will work as the ground outside your building. Your pieces of debris will probably end up flying very far from the structure. Make sure they don’t fall off this plane, because this will end up slowing up the simulation render time.
G.20) Double check everything and make sure every single object has the correct settings and properties.
We are now ready to go to the next step
H) Rigging the explosion
For this part of the tutorial, I can’t give you precise settings. Everything depends on how you set-up your geometry and pieces of debris. All I will do here is tell you how to make the effect of the bomb using approximations.
H.1) Select your bomb object (the sphere).
H.2) Change its settings to something like this. The scale, position and rotation parameters depend on your own project; don’t put them exactly like mine. Focus on the Rigid Body Characteristics.
Notice that I set the @mass parameter to something extremely high (100K). This will give the ball huge power against the building’s structure. Remember, pressure, gravity and mass react against each other in an explosion. Every object your sphere collides with will slow it down. If you set its mass to something that is too low, it’ll simply bounce back and cause little destruction. Keep it really high, the effect will be much cooler.
H.3) Add @ Velocity on the axes you want the sphere to move towards.
What we are doing here is giving momentum to the sphere, so that when the simulation starts, it moves in a certain direction. Remember we added a gravity daemon, so this is the only force that is working on the sphere, and it is pushing it down. We can counter that by adding @velocity on the Y axis. If we want it to move forward add @velocity to the X or Z axes. It all depends on how your project is oriented.
Imagine this as a pitcher that has to throw a ball to a certain point in the batter’s strikeout area. You can control this ball’s spin, speed and direction by applying forces to it. As soon as it leaves the pitcher’s hand, the ball is only affected by gravity and the initial forces the pitcher gave it. The pitcher can’t control the ball when it’s flying through the air, obviously. This is exactly how @velocity works.
You’ll probably end up figuring this out after a couple of trial and error exercises. It’ll be easy, promise.
H.4) Once you added the correct forces to the sphere. Go to the gravity daemon on your nodes window and click on it.
H.5) Go to the Node Params window and open the Gravity tab
Now we’re going to run a pre-simulation to observe our bomb’s behavior. But before we do this, you have to expand the number of frames in your simulation.
H.6) Go to the small boxes on the right of your timeline and change them to 300 and 300. Like this:
Before we press the simulate button, make sure everything is in it’s right place and all your settings are right. You have a lot of pieces of geometry, that means that there are as many things that can go wrong.
H.7) Press the simulate button on the lower right hand corner. Be patient, it’ll probably take a while to process a couple of frames. Wait till it has produced enough results for you to see if something is not working right.
H.8) Once the program has processed enough frames for you to see the sphere’s trajectory, adjust whatever settings you have to in order to make it behave the way you want it to. Reset the simulation to start again the process by pressing the Reset button next to the Simulate button.
This change might require you to alter the sphere’s size, position, @mass or @velocity. Also, make sure your ground plane is large enough to contain all falling debris. Set everything to make it behave the way you want it to. Repeat this process as many times as you have to.
If you go back to step H.4, you’ll notice I made you open the gravity daemon’s settings. This is because you can add additional support to your structure, in order to keep it stable until the sphere smashes into it. Once you have the sphere behaving properly, you can now reduce the gravity to zero until the moment it collides with all the other objects.
H.9) Make sure you have a working simulation that has enough frames to see the sphere’s trajectory. Go to the exact moment in your timeline when the sphere hits the first object. Go to the Node Params window, then the Gravity tab and change the strength to 0.
H.10) Right click your mouse on top of where it says strength and add a key.
H.11) Move to the next frame and now change the gravity’s strength value from 0 to 9.8. Right click on top of strength and add a key.
What we just did here was keyframe the gravity to work only up until the moment the sphere hits the building’s structure. This will reduce your render time significantly and assure you your building stays stable until your bomb affects it.
H.12) Reset your simulation and tweak everything to the point you feel confident enough it’ll have the results you’re looking for.
H.13) Run the simulation. Let it work its magic. Avoid stopping it too much unless something is definitely not feeling right. You’ll need at least 100 frames to be able to tell this.
H.14) Make a working simulation that has the effects you want
Once you have everything ready and looking perfect, finally, we can re-export it to Maya and take it from there.
Realflow will actually keep a register of your simulation in its cache. You don’t have to do any more complicated operations to take your work back into Maya. So we can basically just save and move on.
I) Taking your simulation to Maya
I.1) Save your file. It is a precious accumulation of hours of work.
I.2) Using your OS, go to the origin of your Realflow’s project directory. I’ll put an example of where I put mine. Yours will surely be different.
I.3) Find your “objects” folder. Look for the file named “animation.sd”
The reason I made you do this, is so that you know where the file is before you import it to Maya. It makes things easier.
I.4) Launch Maya and open the file you used to create your building.
You are now ready to import, but before you do, have in mind all the objects in this file will be replaced by the simulation you just did in Realflow. It is good practice to save a back-up copy with a different name, just in case.
I.5) Open the Realflow tab to reveal the icons.
I.6) Click on the “Import SD file” icon
I.7) Select the “animation.sd” file I made you find with your OS. The import will take a while, so be patient.
There! You made it! You finally got a working simulation of an exploding building! If for some reason, some of your objects look a little weird (they might end up looking a little fatter with strange edges), worry not, this is really easy to fix.
I.8) Select all pieces of geometry in your scene.
I.9) Go to the polygons menu. Go to Normals> Harden Edge
And that’s it. You finally got your Building.
Have in mind that this is just a simulation in its simplest form. Now that you know how to build a simulation using these two platforms, you can go ahead and create something that is more complex and has more components or pieces of geometry. Play around with it as much you can.
Download the Final Simulation
Stay tuned for the next installment of this tutorial. In it, we will use particles, fluid effects and other neat tricks to create a realistically looking explosion that will put our animation together.
Thanks for the patience, hope this guide was useful.


































Great Tutorial, Sir. I will keep checking back to this!
@KenThanks buddy. Let me know if it’s clear enough or needs additional steps or something.
great tutorial…the next tutorial when is ready ?
some bowling balls are heavy and i accidentally dropped one on my foot. it is quite painfull*’*
Hobbies include writing, quilting, sewing, knitting. And I recently started spinning my own yarn. Basically anything arty.
oh cool, this information is really useful and definately is comment worthy! hehe. I’ll see if I can try to use some of this information for my own blog. Thanks!
¡Gran poste! Gracias por tardar la época de escribir algo que está realmente digno de la lectura. Encuentro demasiado a menudo el Info inútil y no algo que es realmente relevante. Gracias por su trabajo duro.