Saturday, January 12, 2013

Posted by Farhan Hamzah On 1/12/2013 02:20:00 PM


Step 1:
In order to use FractureTools in Blender, they need to be enabled from User Preferences. A quick way to go there is by pressing CTRL-ALT-U.
Picture
Step 2:
Select the object you would like to shatter and press SPACE and type in fracture. That brings up all the options from FractureTools.
Firstly you need to select Fracture Object parameter highlighted in red.
Picture
Step 3:
This brings up a couple of options to choose from. If you don't see the panel on the left, press T to open up the toolbar. There you can see
Number of shards, which determines how many pieces are generated.
Crack type determines the way the pieces are
going to be sliced. From my testing, only Flat and Flat Rough work.
Spherical seems not to be working.
To shatter the object, just tick the Execute button.

Remember, you can uncheck the Execute button after pressing it, to undo the shattering.
Picture
Step 4:
As you can see from the wireframe mode, which you can enter by pressing the Z key, there are pieces generated. 25 of them in this tutorial.
Of course, the pieces on their own are quite useless, but a neat option called Setup Fracture Shards adds convex-hull rigid body physics to all
of the pieces. Select all of the shards, type in fracture and choose Setup Fracture Shards.
Picture
Step 5:
Now you can see that all of the objects have circles around them, which means they have rigid body physics enabled.
To test out if the shattering really happens, press the P key to enter the game engine.
Press ESC to cancel the game engine.
Picture
Step 6:
I advise you to select all of the shards and choose Flat shading instead of the Smooth shading from the toolbar.
Picture
Step 7:
In order to get the cube to shatter at the time you want it to, you need to set up a rigid body recorder.
To do that, hit SPACE, type in fracture and choose Add Rigidbody Recorder(Fracture).
This adds an empty which act as the "freezer".
Picture
Step 8:
In order to get the shattering to work properly, you need to say that all of the shards only collapse when there is a collision.
Divide the screen and choose Logic editor to be shown.
Select one of the shards.
Picture
Step 9:
Add
  • Always Sensor; Collision Sensor
  • 2 And Controllers
  • 2 Edit Object Actuators. Change both of them to Dynamics type. The upper one should be Suspend Dynamics and the lower one Restore Dynamics.
Connect the logic bricks like in the picture.

What these logic bricks say, is that whenever the scene starts, by entering the game engine, ALWAYS suspend the dynamics so the pieces won't
collapse instantly. Then only when there is a COLLISION with one of the shards, the dynamics are restored and the pieces fall over.
Picture
Step 10:
Now, remember, you only selected one of the shards and added the logic bricks, but you need all of the shards to have the same logic bricks.
Unselect everything and choose all of the shards, but not the one you originally added logic bricks on. Then select the final shard.
Picture
Step 11:
Now you can easily add all of the logic bricks to all of the pieces.
Hit SPACE and type in copy. This brings up the copy operators and you need to select Copy Logic Bricks to Selected.
Now all of the shards have the same logic bricks, which keep them from falling over instantly.
Picture
Step 12:
Test it out.
Picture
Step 13:
Now its the fun part. Hit SPACE and type in fracture. Choose Add Projectile(Fracture).
Picture
Step 14:
This creates a ball projectile, which you can use to demolish the cube, or whatever object you're working with.
Move the object so it is parallel to the cube. The default movement for the projectile is negative on the y-axis.

You can also use any kind of object for the collision, but the object must have rigid body physics enabled.
Picture
Step 15:
Hit P and you can see the almighty demolishion!
Picture
Step 16:
Now you're getting into the materials.
In order to separate the inside faces from the outside faces so they can have different materials, you need to join all of the shards to one object.
Select all of the shards and hit CTRL+J.

Its okay if the empty is in the selection.
Picture
Step 17:
Go to edit mode with the TAB key and change to Face Select mode.
Picture
Step 18:
Now go to top view with numpad 7 and use the Box Select tool. Press B, Click and drag over the outside faces(4 sides of the cube).

Its okay if you accidentally select some of the inside faces, especially with more complex objects, but try to get this exact.
Picture
Step 19:
Don't forget to select the bottom and top of the outside faces from side/front view by pressing numpad 3.
Picture
Step 20:
Now go to materials tab and rename the default material to OutsideFaces(or whatever you like). Create a new material if there isn't a default one selected.
Change the material settings and when you're ready, hit the Assign button.
Picture
Step 21:
Now you need to select the inside faces, which you can do by pressing Ctrl+I to invert the selection.
Picture
Step 22:
Click the "+" sign and then the "X" sign. Then click Add New from the material tab to create a new material.
Picture
Step 23:
Rename the material to Inside(or whatever you like) and change the material settings. In this case I lowered the specularity and gave it an orange color.
Don't forget to hit the Assign button!
Picture
Step 24:
Now when the materials are completed, you need to separate the pieces again. Go to edit mode with TAB, select everything and hit P and choose By loose parts.
That way the pieces are re-generated from the joined object.
Picture
Step 25:
You can see that all of the objects now have the exact same origin point, which can cause weird behaviour in the game engine.
To fix that, select all of the shards and press CTRL-ALT-SHIFT-C and choose Origin to Geometry.
This resets the origin point for all of the shards to their individual centers.
Picture
Step 26:

If you press the P key, you can see that the objects fall over instantly. That's because the logic bricks got messed up when joining/separating.
You can copy the logic bricks the same way as in step 11, but I think it is much better to make a placeholder object to hold all of the logic brick
data, so you don't lose the logic bricks again.

Next time you can use the placeholder from the start, so instead of adding logic bricks to one of the shards, you add it to a placeholder object, like a cube in this example.

So, add a cube with Shift+A - Add - Mesh - Cube. Add the same sensors, controllers and actuators like previously.

Don't use empy as a placeholder because you can't add dynamics actuator for it.
Picture
Step 27:
Now deselect everything, select all of the shards and then select the placeholder cube. After that hit the SPACE key and type in copy.
Again choose Copy Logic Bricks to Selected.
Picture
Step 28:
Now you have set up the shattering so the pieces have different outside and inside materials and they collapse only on impact.
Picture
Step 29:
In order to use this shattering for an animation, change the default Blender Render to Blender Game.
Picture
Step 30:
To record the animation go to Game panel and tick the Record Animation button.
Picture
Step 31:
Hit P, wait for the collision to happen and when the pieces have settled down, hit ESC to stop the recording.
Hit ALT+A to see the animation happening.
I recommend to uncheck the Record Animation button from the Game panel, because if you accidentally press the P key, the keyframes are overwritten.

If you select one of the shards in the scene you can see a lot of keyframes on the timeline, which were created with the Record Animation option.
Picture
Step 32:
Originally the animation seems a lot like in slow motion and a quick way to get rid of that is to go to DopeSheet editor.
Picture
Step 33:
Here select all of the keyframes by hitting A(twice) and move the time indicator to the first frame(frame 0).
Then hit S to scale the time and type .4 on the keyboard to make the animation .4 times of the original timescale.
This speeds the animation up.

You can also scale the time 2 or more times to make the slow motion effect even stronger if you're going for the extreme matrix style!
Picture
That's it for this tutorial. I hope you got something out of it. You can find me here if you wish to see what else I'm up to.

Have a good day!
Reaksi:

0 komentar: