## Choreography Parametrization

The Realsoft 3D animation system is based on the idea that you can "teach" an object to act based on some input signal. In other animation tutorials, objects were taught to act based on time. However, even though all actions occur over time, a time value, such as a frame number, is not the only way or the best way in all cases, to make some action occur in your scene.

This tutorial presents the basic principles for making objects perform some action based on any attribute of any object! This is actually a relatively simple notion - not nearly as complicated as it may sound. When you consider that living organisms in the real world respond to and take actions based on numerous types of stimuli (chemicals, light or other forms of radiation, pressure, etc.), it would seem only natural to use these techniques within an animation system.

Although it is true that you could animate anything by setting keys at specific frames, animating certain actions in this way not only can be extremely time-consuming, but prone to subtle synchronization errors. Keying actions based on the attibutes of other objects is an extremely powerful and efficient way to create a wide variety of animation effects, from plants tracking the movement of the sun to a character watching a fly buzzing around the watcher's head.

Tutorial project: 'tutorprojects\animation\input\stretch based on translation'

 Let's imagine you want to create a bouncing sphere using keyframes. You would like the sphere to bounce several times during the animation and every time it hits the floor, it should deform as if the collision between the sphere and the floor was causing the deformation. If you only want to make the sphere to bounce once, there is no problem. You can create a couple of keyframes that control the path and the deformation of the sphere. However, in making the sphere bounce numerous times, it would be great if we could make the sphere stretch automatically every time it hits the floor so that we would only have to worry about the translation of the sphere. Key 1: The sphere in its initial position.

Let's see how this can be accomplished.

 1. Create an analytic cube to represent a tabletop or a floor. Next create an analytic sphere, and in the select window, choose Make Choreographable from the popup menu. Then open the Input tab of the Choreography window. Select the 'sphere.init0' choreograph. Choose New/Keyframer from the popup menu, and then Open from the popup menu to see the created sub choreograph. Select Keyfr1 choreograph. At the right side of the choreography window, change the Input Type to Geometric Object. Now click the Change button, and scroll down the list until you see Translate. Expand the Translate folder if necessary by clicking it and select Translate.y. Key 2: Position where the sphere touches the floor and starts to stretch.

You are now ready to teach the sphere how it should stretch based on its Y coordinate.

 2. Move the sphere downward to the position where the sphere is just about to hit the floor and starts to stretch. Activate the animation recording mode and stretch the sphere slightly in its Y direction. Then reset the animation recording mode. 3. Move the sphere further downward to the position where the sphere should reach its most deformed state. Again, set animation recording on and stretch the sphere even more. Reset the animation recording mode. Key 3: Sphere in its lowest position with maximum stretch

That's all! Move the sphere up and down using the move tool or by dragging its Y-axis handle and the watch how the sphere stretches every time it hits the floor!

Note that if you followed the previous steps exactly, the sphere should do nothing if you move the time slider. The reason is that you have not taught the sphere to act based on time.

Let's now teach the sphere to move with time. To do this, you create a new time based choreograph, because the current choreograph is sensitive only to the sphere's translation in Y and does not react to time changes in any way.

On the choreography window, select the choreograph sphere.init0. Choose New/Keyframer from the popup menu. This creates a new keyframe choreograph for the object and makes it the current choreograph. By default, this new choreograph is time-based.

Set animation recording on and keyframe the position of the sphere so that it bounces off the floor. Note that as you move the sphere to a position at the floor, it deforms according to the attribute-based choreograph you just created. When you have keyframed several bounces of the sphere, turn off the animation recording mode and play the animation.

Tutorial project: 'tutorprojects\animation\teaching\stretch based on translation'

### A light sensitive fellow

 Imagine that you want to create a character who does not like bright light. If the light intensity is low, the character is happy. As the light intensity gets stronger, the more unhappy our otherwise friendly character becomes. 1. Create a simple head and one point light source. Position the light source so it is in front of the character and slightly above the top of the head. If you are too busy to model a head, you can load in the one from the 'models/nurbs' folder. 2. Select the head and in the select window, choose Make Choreographable from the popup menu. Create a head and a point light source
 3. Select the light source, open the choreography window and go to the Input tab. Select the choreograph head.init0. Choose New/Keyframer from the popup menu, then open the head.init0 choreography using the popup menu and click the new keyfr1 choreograph to select it. Change the input type from Time to Geometric Object and then click the Change button. You can now see all the attributes that are specific to a point light source. Select Intensity. The input of the selected choreograph set to the Intensity of the light source

Note Instead of selecting Geometric Object and clicking the Change button, you can simply drag and drop the desired geometry object from the select window over the desired choreograph to make it depend on the dropped object.

 You have now set up a choreograph that is based on the intensity of the light source. From this point, all that needs to be done is to define the "key" light intensities and modify the facial expressions of the head in the animation recording mode. The only difference between this and recording a time-based choreograph is that you have to adjust the 'intensity slider' instead of the time slider. 4. Open the property window for the point light. Go to the Spec tab and set the 'Intensity' attribute to a low value (in this case, use zero). Then, set animation recording on and deform the face so that it looks relatively happy. When done, reset animation recording. Set the Intensity of the light source to zero
 5. Now increase the intensity of the light source by moving the slider all the way to the right. Again, enter the animation recording mode. Now edit the character's facial features so that it looks very unhappy. Reset the animation recording mode. You have now created two 'key' light intensities for the character. Now select the light source and play with the intensity slider in the property window. The stronger the light intensity, the more unhappy the character looks! The face looks happy under low lighting and unhappy under bright light.

So, we have created a character who does indeed appear sensitive to light. What you actually did was morph the head's facial features as a function of the intensity of the light source. But why would anyone want to define morphing based on the intensity of a light source or some other attribute? There are many reasons, as we will show in the following tutorial examples. Keep reading and be ready for a big surprise.

### Teaching muscles

Tutorial project: 'tutorprojects\animation\input\bicep'

Imagine that you need to create an arm whose bicep muscle acts based on the angle between the two arm bones, so that the smaller the bone angle, the bigger the bicep. Think about how tedious this task would be if you had to keyframe it based on time. Not only would this be tedious, but extremely limited in application. This is where the real power of attribute based animating is exhibited.

By using attributes rather than time, you can single point edit the bicep at two different bone angles to show the muscle how to deform. In this way, you now have total control over all muscle deformations. Then, you just animate the character's skeleton, making it move as you want, and all the muscles deform automatically according to your definitions.

 1. To make such an arm, start by creating and shaping an SDS mesh to be your arm. Then create a skeleton consisting of two bones - make sure the first joint of the skeleton represents the shoulder joint. Remember to define a proper angle constraint for the elbow while you draw the skeleton. Position the skeleton, and then: A SDS mesh and a skeleton
 2. Select the arm and then the skeleton. 3. Activate the Lattice Mapping->Map tool to map the mesh to the skeleton. 4. Set the mapping mode to the Pointwise option, and click Accept. Map the mesh on the skeleton using the Map tool and the Pointwise option

5. Select the skeleton and turn the edit mode on by hitting the spacebar. If you drag the end point of the skeleton so that the arm bends, you can see that bicep area does not react as a real bicep would. Therefore, you need to teach the bicep to get bigger (and contract) based on the bone angle.

 6. To do this, open the choreography window to the Input tab. Select the bicep.init0 choreography. Select Open from the popup menu to see its sub choreographs; there is already a lattice item. Choose New/Keyframer from the popup menu, then select the created keyfr1 object. Change the Input type to Geometric Object and select the the skeleton in the select window. Click the Change button. The select the Angle1.x attribute of the skeleton as the input source. Now keyfr1 is a choreograph that is based on the angle of Joint1 of the skeleton. Set the input of the choreography to skeleton's 'Angle1.x'
 7. Select the skeleton and edit its position so that the arm is straight. Now select the arm mesh and activate the animation recording mode. Use single point editing to make the bicep area look the way you want when the arm is stretched out straight. When finished, deactivate animation recording. Now the muscle knows what to do when the skeleton is opened to its maximum bone angle. Bicep corresponding the 180 degree bone angle.
 8. Select the skeleton and move 'Joint2' so that the forearm is bent at approximately a 90 degree angle. Select the mesh again, and repeat the procedure described above to point edit the bicep area to make it look like the muscle is contracting and bulging. Exit the animation recording mode when done. That's all you have to do! Now the bicep compresses and stretches based, quite naturally, on the angle between the two arm bones. Move Joint2 and see how the arm looks. There are more refinements you could do to make the arm bend look more natural. If you want to have parts of the arm animate based on other joints or joint angles, use the same technique to create additional choreographs. Bend the arm and make the bicep bigger

### Deformation based on acceleration

Tutorial projects:

• 'tutorprojects\animation\input\deform based on acceleration'

• 'tutorprojects\animation\input\bend based on acceleration'

• 'tutorprojects\animation\input\bend with angular acceleration'

You have probably seen some fancy animations created by advanced simulation systems. If you have used some of these systems, you know that in order to take full advantage of them, you have to know something about physics. Another problem is that simulations are controlled by a rich set of parameters, and often it is not clear how strong an impact a change to any particular parameter value will have on the final result.

Although Realsoft 3D does include many simulation features, it would, in general, be easier in many cases to keyframe some of these fancier visual effects. Once again, this is what attribute-based choreographs allow you to do.

Imagine that you want to make some character or creature whose body needs to jiggle in a realistic way, based on the body's acceleration (for instance, jumping up and down). In the same way you made the bicep muscle bulge based on the angle of the elbow, you can apply the same principle to make a character's midsection jiggle (or deform in some way) in response to physical properties like the velocity and acceleration of the object.

 1. To create this type of animation, start by creating and shaping a cubic NURBS sphere so that it looks similar to the image on the right. 2. Next, from the select window's Geometric Objects tab, right click and choose 'New->Field Evaluator' from the popup menu. This creates a field evaluator object. This object is needed for one reason only: it is capable of evaluating acceleration. 3. Select the field evaluator object and then the sphere object, and then choose Drop to a level from the pop-up menu. Your acceleration-sensitive model is now ready to be animated. A NURBS sphere reshaped to allow for 'torso' jiggle

4. Select the mesh object, located inside the newly created level object, and choose Make Choreographable from the popup menu. Open the Choreography window to the Input tab. Select the mesh's choreograph and choose New/Keyframer from the popup menu. Open the init choreograph and select the keyfr1 object under it. Then drag & drop the Field Evaluator object from the select window to the choreography list. Choose the Acceleration.y attribute of the field evaluator object.

 5. Now go back to the select window. Select the field evaluator object and open the property window to the Spec tab. Set the acceleration field to the following values: 0 10 0 6. Next, edit the model so that its shape is what you want it to look like at this acceleration value: Activate animation recording, select the NURBS sphere and enter the point editing mode. Bend the torso region downward as if it was the high acceleration that deformed the object. Then deactivate animation recording. 7. Since this character will also have to decelerate (that is, respond to negative acceleration), you should also set the character's look under the opposite condition. Change the Field Evaluator object's Acceleration attribute to the following values: Shape of the sphere character when the acceleration value is 0 10 0

0 -10 0

Activate animation recording, edit the mesh, and then deactivate animation recording.

You have now taught the mesh to 'bend' based on true acceleration. The only thing we need to do now is to animate the position of the level object containing the mesh and the field evaluator object and see how the mesh deforms according to the acceleration.

8. Make sure animation recording is still on, and modify the vertical position of the level object up/down in various time frames. When done, turn off animation recording and play the animation.