By Saif Jouda | June 10, 2024
Procedural animation is a technique in computer graphics where animations are created algorithmically rather than being manually crafted by animators.
Procedural animation generates movements using algorithms and mathematical functions instead of manual keyframes. It works by:
Rules and mathematical models define movements.
Inputs like environmental factors and user interactions influence animations.
Animations are calculated and rendered dynamically, allowing for adaptive and realistic motions.
Animation rigging in Unity involves setting up a skeleton (rig) for a character or object, which consists of bones and joints. This rig allows animators to create and control movement. Key components include:
Hierarchical structure of bones and joints.
Component that renders a deformable mesh.
Rules that dictate how bones move (e.g., IK constraints for realistic limb movement).
Using Unity's Animation Rigging package, developers can create complex animations by defining these bones, joints, and constraints, facilitating more dynamic and realistic character movements.
Function: Blends the transformations of multiple sources (position, rotation, scale) to a single object.
Use Case: Smoothly transitioning an object between different states or animations.
Function: Controls a chain of bones to follow a target position, typically for limbs.
Use Case: Creating natural limb movements, such as a character’s arm reaching for an object.
Function: Applies a damping effect to an object's transformation, smoothing out sudden movements.
Use Case: Reducing jitter or oscillations in animations, such as camera shake or soft body dynamics.
Function: Orients an object to aim at multiple targets, blending between them based on weights.
Use Case: Ensuring an object (like a head or eye) smoothly tracks multiple points of interest.
Function: Allows an object to inherit transformations from multiple parent objects.
Use Case: Complex parenting setups where an object needs to follow multiple influences, such as holding an object with both hands.
Function: Constrains an object’s position to multiple targets, blending their influence.
Use Case: Positioning an object relative to several control points, useful in multi-character interactions.
Function: Switches an object’s reference between different targets seamlessly.
Use Case: Changing the parent or reference of an object dynamically, such as switching which hand holds an object.
Function: Blends the rotational influence of multiple targets on an object.
Use Case: Smoothing out rotational transitions between different animations or control points.
Function: Overrides the transformation of an object with specified values or influences.
Use Case: Temporarily changing an object’s transformation for specific actions or states.
Function: Distributes a twist along a chain of bones evenly.
Use Case: Creating natural twisting motions in body parts like the forearm or spine.
Function: Corrects unwanted twisting in a bone, ensuring proper deformation.
Use Case: Maintaining the correct shape of a mesh during complex rotations, such as twisting an arm.
Function: Controls two connected bones (like upper and lower arm) to reach a target position.
Use Case: Animating joints such as elbows and knees with natural bending and reaching motions.
Create the desired shape you want to animate.
Press Shift+A then click on Armature to add the base bone.
To see the bone structure easier, go to Data > Viewport Display, then check the In Front box.
With the base bone selected in Object Mode, go into Edit Mode. You can:
Press E to create a new bone at the selected bone.
Press G to move and rotate the selected bone.
Shift-click the armature then the object, then press CTRL/CMD+P. Finally, select "With Automatic Weights".
To improve how the bones bend the objects, you can customize how each bone affects the mesh. To do this, select the mesh/object in Object Mode then switch to Weight Paint. Here you can:
Get weight from Blender Manual
Export the project as a .fbx file and place it in your Unity assets folder.
Get the "Animation Rigging" package from the Unity Registry.
The .fbx file you imported should be in a prefab state. Drag and drop it into your scene. While the "Armature" child object is selected, click on "Animation Rigging" > "Rig Setup". This will add some important components to the object. Additionally, if you would like to see the bones, go to "Animation Rigging" > "Bone Renderer Setup".
In Armature, a Rig child object should have been created. Create a child object for "Rig" for the constraint. Add the desired constraint component on the new object we just created. Each constraint has its own requirements. For this example, we will use the Two Bone IK Constraint. Every constraint requires references to bone objects and source objects. Bone objects are simply the bones in the armature. In this case, we require Root (the base bone), Mid (the second bone), and the Tip (the object at the end of the last bone). You will have to think about the constraint you want and create a bone structure in Blender that aligns with it. In this case, I only need two bones.
We also need source objects which allow us to control our rig. These are typically empty game objects created in the same hierarchy as the object with the constraint. In this case, the target is where we want the tip to be and the hint is where we want the joint to be angled towards.
Additionally, we can visualize any rig object we want with various shapes. Select a rig object then at the bottom right of the scene window, there should be an option to add a visualization. You can change the shape, color, and size. These are only visible in the scene view.