render2

Using the Cell Fracture Feature in Blender to Create Advanced Dynamics

‌‌
Dynamics are a huge part of the 3D pipeline, and a large part of dynamics is creating some type of demolition, like a building crumbling, or a bridge getting destroyed by artillery. In just about any blockbuster movie you'll find dynamics utilized, whether it's Godzilla smashing through the city, or a Transformer charging its way down a busy street smashing cement as they go. Dynamics are necessary, because hand keying every single tiny piece of geometry would take much too long, and likely wouldn't produce accurate results. In some of the previous Blender dynamics articles, you learned about the very basics of things like fluid systems, and the rigid body simulation. Now that you've kind of got your feet wet, it's time to get into some of the more advanced physics systems in Blender. In the rigid body article, you learned how to properly setup the most basic simulation, and that is a line of dominoes falling over, it's a great exercise, but definitely not the most exciting. In this article, you'll learn how to setup a basic destruction simulation utilizing the Cell Fracture Add-on that comes with Blender. Say you want to have something breaking through another object, maybe a wrecking ball smashing through a cement wall, or a bullet shattering a window. The Cell Fracture Add-on is the tool you'll need to achieve this type of effect. For this particular tutorial, we are going to keep it fairly simple, and have an object smashing into a cube; the cube of course will get demolished into a bunch of little pieces. image 01 The first thing you'll need to do when you open up Blender is to activate the Cell Fracture addon, by default this addon isn't enabled. Go to the Info Header at the top of Blender and under the file menu select User Preferences. This will open up the preferences for Blender; which is the area where you adjust everything from the interface theme to the size of the cursor in Blender. It's also where you install and enable Addons from the Blender community, which is for what we will be using the Preferences. image 02 Select the Addons tab, and within the search bar type in "Cell Fracture" you should see a tab appear on the right with the title Object: Cell Fracture. You can select the arrow to open the details of the addon, like who the author is, as well as the version of the addon. To enable the addon all you have to do check the box next to the little armature icon to the right of the Cell Fracture details. image 03 Now just close the User Preferences and you're ready to go! If you go under the Toolbar and under the Tools tab you should notice a new tool appear called Cell Fracture, this is what you'll be using to adjust the properties of the fracture on the object. So now that you have the addon enabled in Blender you can begin setting up your dynamics simulation. For this particular tutorial, we'll just use the basic cube that appears in Blender by default. image 04 Of course, you'll need to make a few changes to the cube to make sure everything is optimized to how you want. So scale up the cube by pressing "S" on your keyboard and then by pressing "5" this will scale up the cube uniformly to a value of 5 on the X, Y and Z axis. image 05 Now translate the cube in the Z axis until it's roughly on top of the grid. image 06 Next, you'll need to subdivide the cube a few times to make sure you have enough resolution to get a realistic demolition simulation. So go into Edit Mode and then press "W" on your keyboard to open up the Specials shortcut window, and choose Subdivide. You'll want to repeat this process four more times. Your cube's resolution should resemble what you see in the image. image 08 Now it's time to fracture the cube, so go back into Object Mode. image 09 Navigate to the Tools menu within the Toolbar and select the Cell Fracture button. Now, it may be overwhelming when you first get a glimpse at the fracture tool, there are a lot of different values and properties to adjust. There's no need to feel intimidated by it, once you get the basics down, the Cell Fracture tool is actually a simple tool to grasp. At the top of the Cell Fracture tool you should see Point Source, and by default it's set to "Own Particles". This is going to work fine for what we are going to be creating. However, we will dive into the Grease Pencil point source in the video tutorial below. The Grease Pencil is an excellent way to have a lot of control of the fracture whether you want the object to fracture into large pieces or very small pieces. image 10 So within the Cell Fracture tool you'll want to bump up the Source Limit, by default it's set to 100, this means that the maximum input points you will have on the cube will be 100, meaning the it will likely create much larger fractures on the cube. You can increase this to somewhere around 350, which increases the number of maximum input points, which in turn, fractures the cube into a lot more pieces. Finally you need to decrease your Mass, by default it's set to 100, for this exercise we lowered it to .50. image 11 Under the "Scene" parameters you should see the Next Layer check box, this is checked by default, and we will keep it that way. This will automatically create the fractured version of the cube on a different layer. image 12 Select "OK" and you should see the fracture being generated; this may take a few seconds until it is completed. If you select the new layer that's automatically created, you should see that the cube is now fractured into lots of little pieces. image 13   If you press the "P" key while in Object Mode, this will actually start the game in Blender; Blender has its own built-in game engine. When you run it, you should see the cube fall off into endless 3D space and disappear. If you created a Plane and scaled it up, the cube would have something to land onto, and crumble. While this is great and all, we really don't want to have to run this in a game engine. So what we need to do now is convert these fractured pieces into active rigid bodies. image 14 Select one of the fractured objects, and go into your physics panel, and enable the Rigid Body physics. With the single object still selected, marquee select the rest of the fractured pieces by pressing "B" on your keyboard to go into marquee select mode and select the entire cube. image 15 Under the Physics tab of the tool bar select the "Copy from Active" option. This copies the parameters of that single fractured piece to the rest of the pieces. If you now play the simulation out, you should see that all the pieces drop off into endless 3D space. What you need now is a floor. So go to the Create tab, drop in a Plane, and scale it up by pressing "S" on your keyboard. You can scale it up however much you like. You also need to make sure the Plane is positioned directly below the cube. image 16 With the Plane still selected, go to the Physics panel and select Rigid Body and change the Type to Passive. image 17 Now when you play out the simulation the cube should land on the ground plane, and crumble into lots of little pieces. So this is great and all, but what if we wanted to have something smash into the cube, if we animated that right now, the cube would start to crumble before the object even interacted with it. To fix this, you just need to make a few minor changes to the parameters of the active rigid body set for the fractured objects. image 18 Select one of the single fractured objects again, and under the Rigid Body properties go down to the bottom until you see the Rigid Body Dynamics parameters. Check the Enable Deactivation and the Start Deactivated check box. image 19 With the piece still selected, press "B" to marquee select the rest of the fractured pieces and choose Copy from Active to copy the change to the rest of the objects. You may have accidentally selected the plane when you marquee selected, so just select the cube and go into its rigid body parameters and make sure the Type is still set to Passive. image 20 So now, when you play the simulation, the pieces shouldn't fall, or crumble. Instead, they'll just stay in place, which is what we want. Because a wall doesn't crumble before the wrecking ball hits it. The last thing we need is our wrecking ball. Go to the Create tab and drop in a UV Sphere. You can scale it up if you like, or keep in the same size. Move it outside of the cube, and position it off to the side. image 21 With the Sphere selected go to the Physics panel and enable Rigid Body, set the Type to Passive, and check the Animated checkbox. image 22 Go to frame 1 on the timeline, and under the Animation tab select Insert keyframe and choose Location, and then go to frame 50 and move the sphere to the opposite side of the cube, and select Insert and choose Location again. image 23 When you play back the simulation, you should see the sphere smashing through the cube. How cool is that? A lot more exciting than some dominoes! Now that you know how to setup a basic demolition simulation using Cell Fracture take some time to experiment with it, adjust some of the settings and see what kind of results you get from it. If you want to learn more about Blender, check out our library of in-depth Blender tutorials.