Your online Softimage Educational Resource

The blog has been online for more than 4 years and there’s still not a single post even remotely related to the delicious brew called coffee… Perhaps it will someday, but in the meantime you can read the articles about Softimage. Most of the material are tutorials and Q&As I’ve written for 3D World Magazine sometime between today and 2003. If you have any questions please don’t hesitate sending me an email.


Thanks to Letterbox Animation Studios for hosting all the scene files.

Make sure you visit their Redi-Vivus.com for 100s of hours of free XSI video tutorials.

Saturday, July 5, 2008

Bowling Alley Timewarp

The basic idea of bowling is rather simple; throw a big heavy ball down a rigorous polished wooden floor and keep your fingers crossed that you’ll knock over at least one of the oddly shaped thingies at the end of the lane. Obviously there’s a lot more to the game that the above and the bizarre shoes, so in order for us to setup our alley truthfully we might as well have a crash course in the art of bowling as we go trough the various steps on the following pages.

Even if there are no more than eleven objects to animate, the ball and ten pins, it will still be a rather tedious task animating them all by hand due to the way they are supposed to interact with each other. Unless were aiming for some truly extraordinary motions for the pins (which can be achieved by additional keyframe animation), XSI rigid body dynamics (RBD) will be right up our alley. Consequently we’ll inevitable be facing the constant reoccurring question about scale and Softimage Units. The truth is that a Softimage Unit equals exactly anything you want it to. Whether it’s an inch, centimeter or a mile is arbitrary, and won’t make a difference as long as you know what it’s representing in your current environment. However, for the values used in the simulation to make any sense at all, it’s important to note that they by default are based on the relation of one unit equals 10 centimeter.

The second part of the problem requires a bit of further manipulation, which will take place in the animation mixer. While we theoretical can animate the change of time/speed in the animation by hand, it would have us facing a big problem since we’re driving the all the motions with RBD. Decreasing the forces and the speed of the ball could indeed give the desired impression of slow-motion but will unavoidable also alter how the objects interact. If we, for instance, reduce the speed of the ball under a certain limit it won’t have enough energy to knock down any of the pins. Instead we’ll run the simulation at full speed, cash the position and orientation of each object at every frame as a clip in the animation mixer. Once that is done we can easily animate the speed of the clip (known as time warp) and thus having full freedom of the camera motion.

The project files used in this tutorial can be found at:
http://www.Redi-Vivus.com/Caffeineabuse/BowlingAlley.zip


Stage one The alley
Step 1
Start by loading the scene bowling_alley.scn from the CD. Apart from the refreshments, the scene contains all the ingredients needed for a successful night of bowling. The first thing we need to do is to setup the physical rules, which are to control the interaction between the scene components.
Step 2
Press [4] to switch to the Simulate Toolbar. The bowling lane itself shouldn’t be affected by the dynamics in the scene (such as the gravity), so for that reason we’ll turn it in to passive rigid body. This is done by selecting the lane object and from the Create > Rigid Body menu choose Passive Rigid Body. Leave the default settings as they are and close the PPG.
Step 3
Both the ball and the pins on the other hand, should all be used to act and react with each other. Select all of them (11 objects in total) and from the Create > Rigid Body menu choose Active Rigid Body. We’ll be working on the settings separately so to ensure optimal interaction check the Mute checkbox to temporarily exclude them from the simulation and close the PPG.

Stage two The ball
Step 4
Select the ball alone and from the Modify > Rigid Body menu click Edit Rigid Body to open its PPG. Bowling regulations prohibits balls from weighting more 7.26 kg (and circumference grater that 68.6 cm). Under the Inertial Properties, enter 6 as the Mass and we’ll stay well under the limit. You can always return and change any of these values later on to fine-tune or experiment with the outcome.






















Step 5
Scroll down to the Rigid Body Properties and uncheck the Mute checkbox. By default the collision type is set to Bounding Box, which evidently won’t produce very realistic results for our ball. So change the type to Bounding Sphere instead. The next step is to set how and when the ball will start losing its energy.




















Step 6
The Elasticity determines how much of the energy that will be lost (or gained) when the ball collides with another object whereas the Friction determines how much will be lost as it rolls along the surface of the lane. Set the Elasticity to about 0.5 and the Friction to 0.25. These parameters are obviously affected by the same values of the other objects in the simulation, so you might want to return and fine-tune them later on.

Stage Three Preparing the hook
Step 7
Before start working with motions we’ll need to add gravity. Any force added to the scene is automatically assigned to all RBD objects in the environment. From the Get > Force menu click Gravity. As we’ve constructed out objects in the “correct” scale (refer to the introductory text), we can just leave the Amplitude settings as they are.
Step 8
Due to the layout of the pins it’s not possible to knock all of them down with the ball alone, but one has to rely on the pins hitting each other. Most inexperienced bowlers throw the ball in a straight line, aiming directly at the firs pin, whereas the more experienced player usually have developed a hook. Given we’re well on the route of becoming skilled bowlers we might as well do it the hip way.
Step 9
A neat feature in XSI is the ability to use Ghosting, which is available even when working with RBD simulations. Press [6] to open the Layer Control Window. Click the empty checkbox at the very right to activate Ghosting for all objects in the layer. This enables us to se the position of the ball throughout its animation without actually running the simulation.

Stage Four Scoring a strike


Step 10
Return to the Dynamics PPG of the ball and under the Dynamics Initial State switch to the Velocity tab. Since there’s currently no animation assigned the ball we need to give it some initial energy. Enter –70 as the LinVelZ. With some quick mental calculation we’ll see that a value of 70 actually means the ball will travel just over 25 km per hour, 70 units equals 7 meters (per second) times 3600 seconds.
Step 11
To achieve the curved path we’re striving for, we’ll also need to throw the ball at a slight angle rather that straight down the lane. Set the LinVelX to about 5.5. Now the ball obviously runs way out of out bounds. To fix this we’ll need to make it spin, there by forcing it back towards the pins as it travels down the lane.
Step 12
The amount of spin needed depends on the strength of the LinVelx and LinVelZ. The plan is to make the ball hit the pins between pin one and three, assuming your aiming for a strike. Under the Angular section, enter about 1350 as the AngVelZ value as this should do the job nicely. Play with the setting till you you’re happy with the shape of the path.

Stage five The pins
Step 13
Before start working with the parameters for the pins it’s recommended to turn off the Ghosting, as this can otherwise slow down the system considerably. Select all ten pins and from the Modify > Rigid Body menu click Edit Rigid Body. These are still excluded from simulation so start with un-checking the Mute checkbox under the Rigid Body Properties.
Step 14
The Bounding Box collision type won’t work very well once the pins fall over so let’s change it Bounding Capsule. Although there is an Actual Shape available as the collision type, you’ll run a great risk of unpredictable result and even stability issues when using it (in XSI ver 4.2). So unless truly needed, I recommend you not to use it.























Step 15
A high Elasticity value, such as one (above one will add energy at each collision), will give you lots of bouncing whereas a low value will bring them to a rest quickly. Set the Elasticity to 1 and the Friction to 0.25. To add some more characteristic to their motion, set the Mass (under Inertial Properties) to about 0.25, click the Use Center of mass checkbox and set the Y to about 1.

Stage Four Cashing the simulation
Step 16
In order for us to be able to edit the result of our simulation, we need to store the information about where and when the objects are in space and time. In the Main Command Area click the Explore button and choose Environments. Expand the Environment section and click the Simulation Time Control. Check the Caching checkbox at the bottom of the PPG.
Step 17
While all the action is played out in about four seconds (100 frames), we still want to run the simulation for another 15 seconds or so. The reason for this is to ensure we’ll have enough animation in our clip to allow easy editing. So, at frame one hit the play button and let the simulation run all the way to the last frame (500).
Step 18
Return to the Simulation Time Control PPG and click the Save caches to mixer button. This will open a new PPG. Enter a suitable name for the clip and click the Add Clip To Mixer checkbox to load it into the Animation Mixer. Click Ok. Note that this will automatically deactivate the simulation and the motions will now be driven by the animation clip instead.

Stage five Edit the animation clip
Step 19
While the Bounding Capsule is working nicely with the pins, there is a slight problem. As the ends of the capsules are round and not flat, the pins appear to be floating in the air in the beginning of the simulation. Don’t worry; since we’ve converted their positions to f-curves, we’ll be able to fix the slight slip-up in the next two steps.




Step 20
Select any of the objects and press [Alt] + [0] (zero) to open the Animation Mixer. With the right mouse button click on the simulation clip and from the menu choose Animation Editor (AE). In the AE, click the View menu and choose Position>Y to filter out any animation but the ones on the objects Y-axis. In the Animation Tree (the left pane in the AE), select all pin objects.
Step 21
Now, zoom in really close on the frames between frames one and something like sixty. Looking at the keys we’ll se that they have a value just over 0.4, whereas the bowling lane is at 0. So, select all the corresponding keys for the pins and enter 0 in the Value text box and press [enter]. A small tip is to work with one pin at the time, as it’s easier to see the different keys. Close the AE and we’re back on track.

Stage six a slice in time
Step 22
Select any of the objects and press [Alt] + [0] (zero) to open the Animation Mixer. Select the F-curve and with the right mouse button click on the simulation clip and from the menu choose Time Properties… (shortcut [Ctrl] + [T]). In the General tab of Time Control PPG you have option to scale the duration (speed) of the entire clip, by changing the Scale value under the Time Reference.
Step 23
However, since we are to animate the change of speed we’ll need to switch to the Warp tab. Start by clicking the Do Warp checkbox to enable the effect, right-click inside the Warp FCurve area and from the menu choose Keys > Unlock All Keys. Now, step trough the animation till you reach the frame where you want the time warp (slow-motion) to begin, probably something like frame 71.
Step 24
Right-click within the graph again and choose Keys > Insert Key at Current Time. Next, go to frame 73 (the frame where you want the animation to return to normal speed) and insert another key. Set another key at frame 150. Now, select the keys at frame 73 and 150 and move them about 250 frames to the right (to avoid you from accidentally change the Y values of the key, you can right-click and choose Keys > Lock In Y (Value)). This will stretch the animation between frame two and three for another ten seconds but leave the speed between frame 3 and 4 unchanged. Your graph should now look something in the line of the previous screenshot.

0 comments: