Breaking the IceWe'll begin by defining some basic principles of reactor behavior. The first concerns the difference between a single object and many objects. Generally, a single cohesive object breaks apart differently than a group of separate objects that happen to be close to one another, just as a concrete wall breaks apart much differently than loose bricks stacked in the shape of a wall. In reactor, a single cohesive object destined to be broken apart is represented by a helper object called a fracture (Figure 16.3). This tool will be useful to you any time you need to shatter something, whether it's an eggshell, an ice cube, or an asteroid. Figure 16.3. The Create Fracture button on the reactor toolbar creates a reactor fracture object.A fracture object is basically a container, a nonrenderable object that holds a number of renderable objects. (Let's refer to the renderable objects as fragments from now on, reserving the term fracture for the nonrenderable helper object.) By grouping the fragments into a fracture, you tell reactor to apply forces to the fragments to make them behave initially as one cohesive unit. Later, if the cohesive unit is broken by some external force, the fragments may began to behave like separate objects. In this chapter we'll create an iceberg that gets shattered by a jumping dolphin. The fracture object contains four chunks of ice that together form the iceberg. By putting the chunks in a fracture, we tell reactor to create the illusion that the iceberg is a single object breaking into pieces. In reality, it is already in pieces, but they fit together seamlessly and don't break apart until they are struck by the dolphin/sprite. Our first job is basically to create a 3D jigsaw puzzle, something that looks like a single object but is actually made up of multiple sub-objects. There are many ways of going about this. Two related issues to consider in selecting the best approach are interpenetrations and convexity/concavity. It is permissible in reactor for fragments to interpenetrate one another. However, for our iceberg, we want to avoid or at least minimize interpenetrations among fragments, for two reasons: First, we don't want chunks of ice visibly passing through one another, since real chunks of ice don't do that. Second, interpenetrating fragments tend to produce highly "explosive" fragmentation, as reactor by default tries to push interpenetrating objects apart very quickly, so that periods of interpenetration will be too brief to be noticeable. In the first example scene shown here (Figure 16.4), the lower two balls are fragments in a fracture object, with significant interpenetration. When the top ball falls on them, they are knocked far apart quickly (Figure 16.5). In the second example (Figure 16.6), the lower two balls are fragments with no interpenetration. When the top ball falls on them, they are not knocked apart nearly as fast or as far (Figure 16.7). Figure 16.4. Interpenetrating fragments (bottom two spheres).Figure 16.5. Interpenetrating fragments resulting in explosive fragmentation.Figure 16.6. Non-interpenetrating fragments (bottom two spheres).Figure 16.7. Non-interpenetrating fragments resulting in nonexplosive fragmentation.Highly explosive fragmentation may be perfect for some situations, such as in videogame space combat. In this case, though, we don't want our ice chunks to go flying off at high velocity in all directions when struck by the dolphin, so we need to moderate the explosiveness with which the fragments separate. The most elementary precaution for moderating explosiveness is to minimize interpenetrations. Another issue we need to take into account is the convexity or concavity of our fragments. In reactor, an object is convex if a line connecting any two points on the surface of the object will never go outside the object. Any object that is not convex is concave. For instance, in our next example (Figure 16.8), the egg is convex, the egg cup is concave. (The 3ds max file for this figure, egg&eggcup.max, is included on the DVD.) Figure 16.8. The egg is convex, the egg cup is concave.Note
Simulating concave objects puts more stress on the processor than simulating convex ones. In many instances, the concavity really isn't important to the simulation, so by default reactor treats concave objects as if they were convex. However, if a fragment is really concave, treating it as convex can increase the explosiveness of fragmentation if another object happens to occupy the empty space created by the concavity. For example, in Figure 16.9, the concave object on the left and the convex object on the right will not actually interpenetrate when brought together to form a sphere. However, if reactor doesn't know that the object on the left is concave, it will treat it as something close to a sphere, and it will consider that the two objects do interpenetrate. In such cases, reactor sees more interpenetration than really exists, so it applies a more explosive separation force than it would if it knew the truth. You can greatly reduce the explosiveness of the fragmentation by telling reactor that the fragment is in fact concave. The cost is a greater load on the processor, which can mean longer waits while reactor analyzes or creates your virtual world. (The added time, however, might not be noticeable in the case of a simple, low-poly fragment.) Figure 16.9. When the object on the left is defined as concave, reactor sees the two objects as non-interpenetrating.Let's briefly explore the concavity/convexity issue in an exercise. Convex and Concave FragmentsIf you wish to examine the finished 3ds max scene implementing this exercise, open concave_convex.max on the DVD. The rendered movies are concave_convex1.avi (explosive version) and concave_convex2.avi (nonexplosive version).
The above exercise demonstrates that interpenetrations among fragments tend to cause explosive fragmentation, with a possible exception for concave fragments that reactor knows are concave. There are other configuration options that can also help moderate explosiveness. We'll look at some of them a little later. They're generally more appropriate for fine-tuning than for trying to undo the effects of massive interpenetrations. By the way, if you want to find out whether there are interpenetrations among your fragments, there is a simple way to get that information. As long as the fragments are part of an enabled fracture object, 3ds max will not issue any warning about interpenetrations among the fragments, because interpenetrations are considered perfectly legal for fragments. However, if we disable the fracture, max will see the fragments only as members of a rigid body collection. Interpenetrations are generally considered a bad practice for rigid bodies, so we'll get warnings when there are interpenetrations. To disable the fracture, select it, go to the Modify panel, scroll down to the very bottom of the Properties rollout, and check the Disabled check box; the box should be unchecked initially for an enabled fracture, as shown in Figure 16.17. Now click the Analyze World button on the reactor toolbar. If there are interpenetrations, you'll get a message like "Bodies Sphere01 and Sphere02 are interpenetrating." You'll get the same message if you click Preview Animation. Figure 16.17. The Properties rollout for a fracture, with the Disabled check box unchecked.Tip
Creating FragmentsWhen creating fragments, it's ideal to use convex meshes, or at least meshes that can be treated as convex without causing explosive fragmentation. Using such meshes minimizes processing time without causing explosive fragmentation. That's the ideal we'll be aiming for. Probably the easiest approach to creating fragments is to align separate objects so that they form a visually unified whole. This is easiest when all the fragments are rectangular, such as a square table with rectangular legs or a building constructed of rectangular boards. Another simple example is a brick wall. Each brick is a member of the fracture, and they are all arranged to form the wall. The bricks are all convex, and you can easily arrange them to look like a solid wall but avoid interpenetrations. (Or you could deliberately cause them to interpenetrate to increase the strength of the explosion.) In the tutorials that are included with 3ds max 7, there is an example using bricks. (See Help > Tutorials > Using reactor and Flex for Simulation > Simulating Fractures with reactor.) The bricks approach is not optimal for our iceberg, however. Unlike brick walls, icebergs are highly irregular in shape. There is simply no straightforward way to create separate objects that will fit together naturally, without interpenetrations, to form a nice icebergy-looking iceberg. Another approach we won't pursue, though it works for some situations, is based on Booleans. Using this approach, you would create a "cutter" object, clone both cutter and iceberg, and then create a Boolean intersection of one iceberg and one cutter and a Boolean A-B of the other iceberg and cutter. You would end up with two objects: the Boolean A-B (which would essentially be the iceberg with a cutter-shaped hole in it) and the Boolean intersection (which would precisely fill that hole). You could continue cutting up either or both of these pieces by creating a new cutter object and repeating the process. The Boolean-based technique gives maximum flexibility in defining the shapes of the fragments (which are basically determined by the shapes of the cutter objects). It also requires many keystrokes and/or mouse clicks per fragment. More significantly, if the overlapping part of your cutter is anything but perfectly flat, you'll end up creating one concave fragment and one convex fragment interpenetrating itjust what we're trying to avoid. (If the overlapping part of your cutter is perfectly flat, see the discussion of slicing below. It's a much easier way of doing the same thing.) Another viable approach that we won't use here starts by creating a Connect compound object, which becomes the "quarry" from which you mine your fragments. In the simplest case, you start with two objects with holes in them, and the Connect object builds a "bridge" between the holes. More complex Connect objects can be created by bridging more than two hole-y objects. To avoid interpenetrations, make sure that the edges of each hole are coplanar (all lying in one plane). That way, at the point where they might be in danger of interpenetrating, both fragments will be perfectly flat, and there will be no interpenetrations. One way to accomplish this is to delete just one polygon per hole. Another way is to use a Slice Plane to create new edges. The technique we will pursue in detail in this chapter is based on cutting up the iceberg object with a Slice Plane. The Slice ApproachFor this chapter, we create fragments by using a Slice Plane to cut our iceberg into elements. Then we clone those elements to create separate objects. A limitation of this approach is that the surfaces along which the "quarry" object breaks will always be perfectly planar. They can't be curved or irregular. This very limitation happens to be a strength in the case of our iceberg, though, because it eliminates interpenetrations even when reactor treats the fragments as simple convex bodies. As we've seen, non-interpenetrating convex bodies automatically moderate explosiveness without incurring any processing overhead. The workflow for this approach is quite efficient. For example, to create the iceberg in this chapter, we create one quarry object and slice it twice, creating four chunks. Four fragments with two slices: That's efficiency! If you need more than four chunks, take any chunk and follow the same procedure to divide it into four. The basic approach can be summarized in three steps:
If you are planning to create the main project described in this chapter, open Dolphin&Rider_start.max from the DVD. This file contains the starting scene that you will use in this project.
OK, we've created our fragments! Now let's test them and make sure they start in a stable position. |