Dynamica user manual

From Physics Simulation Wiki

Jump to: navigation, search

Contents

Introduction to Dynamica

Fig 1. Example of Dynamica rigid body sequence choreographed with the v2.78 activation tools

Fig 1. Example of Dynamica rigid body sequence choreographed with the v2.78 activation tools

Description

  • Dynamica is a high performance rigid body simulation plugin for Autodesk Maya based on the open source Bullet Physics framework. Designed to meet the demands of art direction, Dynamica gives artists the control they need to author complex rigid body simulations.

History

  • Dynamica was originally developed at Walt Disney Animation Studios during the production of the animated feature film Bolt. The plugin source code was donated to the Bullet Physics project and is now distributed under the zLib license.


Installation

Download the latest installation files for your OS/Maya version from the Dynamica Project Page:

Install and enable the plug-in

  • Run the installer.
  • Start Maya and go to Window > Settings/Preferences > Plug-in Manager:

File:installDynamica01.jpg

  • Scroll down to find an entry for Dynamica/Bullet and check the boxes labeled Loaded and Auto load:

File:installDynamica02.jpg

  • Look for a shelf named Dynamica and click the Bullet icon.

File:dynamica-shelf.jpg


Basics

The functionality is provided by four types of custom Maya nodes that interact with each other: dSolver, dRigidBody, dRigidBodyArray, and dCollisionShape. The different nodes can be created through the Dynamica UI. This UI can be accessed by clicking on the Bullet icon in the Dynamica shelf.

dSolver

  • There is only one of these nodes per scene. It controls the global parameters of the simulation, such as time step, gravity, start frame, etc. It is created automatically every time a Rigid Body or a Rigid Body array is created.

dRigidBody

  • There can be multiple rigid bodies in the scene. Each has different attributes that control behavior, such as mass, damping, initial position/velocity, etc. dRigidBodies can be active or passive. An active rigid body is controlled by the forces and collisions in the simulation. A passive rigid body (sometimes called Kinematic) is static or key framed.

dCollisionShape

  • Represents the shape that is used to compute the collisions between rigid bodies. Every rigid body connects to a collision shape. It is recommended that collision shapes be a simple as possible to represent the desired collision behavior. The simpler the collision shape, the faster the simulation. Currently the collision shape available are: sphere, box, infinite plane, convex hull, mesh. The convex hull collision shape and the mesh connect directly to a Maya mesh. The mesh collision shape is more precise for concave meshes, otherwise the convex hull shape should be used, for faster simulation.

dRigidBodyArray

  • Like a rigid body but can contain multiple rigid bodies sharing the same collision shape and simulation parameters. It's the node of choice when the rigid bodies have the same shape and speed is required. The attributes that control the initial configuration are: NumRigidBodies, InitialPosition (Multi), InitialRotation (Multi), InitialVelocity (Multi), InitialSpin (Multi).

Constraints

  • Dynamica supports several different constraints, such as dNailConstraint and others. You can read more about them on the Dynamica Constraints page.


Quick Start

The following are simple examples that show the basic functionalities of Dynamica. All the commands can be accessed by clicking on the Bullet icon in the Dynamica shelf.

To create a simple rolling sphere

  1. In the Dynamica UI, click on "Create passive plane". It creates an infinite plane centered in (0,0,0). With the rotation manipulator, tilt the plane a little bit.
  2. Deselect the plane. Click on "Create active sphere". It creates an active rigid body with a sphere as collision shape, centered in (0,0,0). With the move manipulator, move it up to (0,10,0). (Important: when creating a rigid body, if something is selected, the newly created rigid body has it's initial position and rotation set to the one of the selected object)
  3. Now roll back the time slider to the first frame and click play (Remember to extend the animation range as necessary).

Note: the simulation is re-initialized on the first frame of the scene - any changes made to the initial position or rotation of active rigid bodies in the viewport must be made on the first frame.

To create a Dynamica rigid body with an arbitrary Mesh

  1. Create a polygonal mesh in Maya, for example, an helix. With the helix still selected, click on "Create active Mesh". A new rigid body is created, with the helix as input to the Mesh collision shape. Alternatively, "Create active Convex Hull" could be used. The convex hull provides faster simulations at the expense of less precise collisions (if the input mesh is convex, there is no difference between Convex Hull and Mesh collision shapes in terms of precision).
  2. Then repeat the same steps of the Simple rolling sphere example.

To create a rigid body array

  1. Create a maya polygonal mesh in Maya, for example a torus. Resize the torus so that the size of the bounding box is around 1x1x1.
  2. With the torus still selected, hit "Create Active Rigid Body Array" in the UI. As small dialog box appears, asking for the dimensions of the array and the offset between the rigid bodies. Enter (10, 20, 10) for the dimensions and (2.5, 2.5, 2.5) as offset.
  3. Create a passive plane as before, then translate the rigid body array so that all donuts are above the plane.
  4. Roll back the time slider to the first frame and click play.

The initial configuration of the rigid body array can be changed by modifying the proper attributes, for example with a mel script. The following is an example mel script that changes the initial configuration of a rigid body array:

proc setConfiguration()
{
    //the name of the rigid body array node
    string $rigidBodyArray = "myRigidBodyArray";

    //set the number of bodies
    setAttr ($rigidBodyArray + ".numBodies") (10 * 10 * 10);
    for($i = 0; $i < 10; $i++) {
        for($j = 0; $j < 10; $j++) {
            for($k = 0; $k < 10; $k++) {
                //set the initial position
                setAttr ($children[0] + ".initialPosition[" + string($i + 10 * $j + 100 * $k) + "]") ($i * 2) (10 + $k * 2) ($j * 2);

                //set the initial rotation to (0, 0, 0)
                setAttr ($children[0] + ".initialRotation[" + string($i + 10 * $j + 100 * $k) + "]") 0 0 0;
            }
        }
    }
}

Kinematic objects

  • Kinematic objects are animated by keying the parent transform of a passive rigid body. If the animation is really fast, it's possible that some objects will leak through the kinematic object. If rapid motion is required, try increasing the number of substeps in the Solver tab of the Dynamica UI or in the dSolver1 node and/or enabling split impulse. The substeps attribute is keyable, which makes it possible to set a different number of substeps along the simulation. This allows users to fine tune the simulation, trading speed for accuracy.

Sample scenes

  • In the subdirectory scenes/ there are some sample setups.

Online instruction movies for usage of the Maya Plugin

You can download (right-click - save) or watch these instruction movies on-line:

Online support forums


Dynamica In-depth

Workflow Overview

The Dynamica tools are designed with art direction and pipeline integration in mind. A typical workflow looks like this:

  1. Mesh preparation: This involves pre-shattering meshes and creating low detail proxy objects to fit the original shapes.
  2. Convert to rigid bodies: Mesh fragments are then converted into rigid bodies (typically convex hulls) and the simulation is run to test collisions and behavior.
  3. Constrain & choreograph: Based on art direction, the rigid bodies are constrained and choreographed using the activation tools. this step is repeated until desired results are achieved.
  4. Bake: The simulation is baked into keyframe data and then re-integrated into further simulation (particles, cloth, fluids, etc.) or pushed down the production pipeline.


Scene organization:

When meshes are converted into Dynamica rigid bodies, the original objects and their rigid body counterparts are captured in transform groups and a display layers. The DynamicaInputMeshes layer is set to reference to prevent accidental selection.

File:Groups.JPGFile:Layers.JPG


When rigid bodies are activated (and the Create Control Sets option is enabled) they are collected in Quick Select Sets for convenience - often a given selection of rigid bodies needs to be retimed - these sets make it easy to re-select the previously selected objects.

File:ControlSet.JPG


Rigid body and constraint properties can be adjusted via the Channel Box or Attribute Editor.

File:RBattributes.JPG



The Tools:

Create Tab

Create rigid body primitives (Sphere and Box) or arbitrarily shaped rigid bodies based on a set of selected mesh objects. Source meshes must have conformed outward-facing normals to prevent collision shape distortion. A user specified collision margin (under the Options tab) can be adjusted to control collision gaps.

Dynamca v2.78 Create Tab


Active Rigid Bodies

Active rigid bodies are controlled by the simulation solver and react to gravity, collisions, and fields.

  • Sphere: Create an active sphere rigid body.
  • Box: Create an active box rigid body.
  • Hull: Create active hull rigid bodies from selection.
  • Mesh: Create active mesh rigid bodies from selection.


Passive Rigid Bodies

Passive rigid bodies do not react to gravity or fields, but are included in collisions. They usually serve as proxy collision shapes for static surfaces in a scene. If passive rigid bodies are keyed and moving, they are considered kinematic - active bodies will collide and react accordingly.

  • Sphere: Create a passive sphere rigid body.
  • Box: Create a passive box rigid body.
  • Hull: Create passive hull rigid bodies from selection.
  • Mesh: Create passive mesh rigid bodies from selection.
  • Plane: Create a passive plane rigid body.


Active Rigid Body Arrays

Active rigid body arrays are collections of like shaped active rigid bodies. The size of the array is controlled by user input in the Create Rigid Body Array panel.

  • Sphere: Create an active sphere rigid body array.
  • Box: Create an active box rigid body array.
  • Hull: Create an active hull rigid body array from selection.
  • Mesh: Create an active mesh rigid body array from selection.

Note: rigid body arrays may not initially be visible if created on a frame other than the start frame.


Constraints

Constraints inhibit the natural (unconstrained) behavior of an active rigid body. Constraints require at least one rigid body to be selected. If a pair of rigid bodies is selected, they are constrained to each other. If three or more rigid bodies are selected, they are constrained to each other in a distance sorted sequence - like a chain. Constraints are force breakable (see the breakThreshold attribute in the Channel Box or Attribute Editor). Rigid bodies can be influenced by multiple constraints.

  • Nail: Pins a rigid body in place or to another rigid body and allows free rotation in any direction.
  • Hinge: Constrains a rigid body in place or to another rigid body and allows rotation about a single axis relative to the z-axis of the constraints transform.
  • Slider: Constrains the translation of a rigid body along a single axis relative to the x-axis of the constraints' transform.
  • 6Dof: Constrains the rotation of a rigid body with 6 Degrees of Freedom. Upper and lower limits can be set for both translation and rotation.

-

Activate Tab

Control the timing of rigid body activation. By default, an active rigid body responds to simulation forces starting on frame 1 - these controls can suspend activation until a specified frame or frame range is reached.

Dynamica v2.78 Activate tab


Frame Range For Rigid Body Control Selected rigid bodies will become active during this range.

  • [First Field]: Activation range start frame.
  • [Second Field]: Activation range end frame.


Make Rigid Bodies Active Along The X, Y, or Z Axis Make selected rigid bodies active along a world axis.

  • +X Axis: activate rigid bodies along the +X axis.
  • -X Axis: activate rigid bodies along the -X axis.
  • +Y Axis: activate rigid bodies along the +Y axis.
  • -Y Axis: activate rigid bodies along the -Y axis.
  • +Z Axis: activate rigid bodies along the +Z axis.
  • -Z Axis: activate rigid bodies along the -Z axis.


Make Rigid Bodies Active In A Radial Or Chain Pattern Make selected rigid bodies active in a radial or chain pattern, starting with the active object in the selection.

  • Outward: Radially activate rigid bodies outwards.
  • Inward: Radially activate rigid bodies inwards.
  • Daisy Chain: Chain activate selected rigid bodies.


Configure & Modify Rigid Bodies (frame range ignored) Restore default active behavior, convert to passive, or set the initial state of selected rigid bodies.

  • Make Active: Make selected rigid bodies active (restores default behavior).
  • Make Passive: Make selected rigid bodies passive.
  • Set Initial State: Set current state to initial state.
  • Clear Initial State: Restore original initial state.

-

Bake Tab

Store simulation as keyframes and optimize the scene size. This operation is not undoable.

Dyanmica v2.78 Bake tab


Frame Range To Bake Set the starting and ending frames for baking.

  • [First Field]: Activation range start frame.
  • [Second Field]: Activation range end frame.


Bake Selected Or All Rigid Bodies

  • Bake Selected: Bake Selected Rigid Bodies.
  • Bake All: Bake All Rigid Bodies.


Bake Options

  • Optimize Channels (Recommended): Remove unneccassary keyframes (significantly reduces data and file size).
  • Delete History (Recommended): Delete history on all baked objects.
  • Delete Empty Nodes (Recommended): Remove empty and orphaned nodes.

-

Options Tab

Control various solver and tool settings.

Dynamica v2.78 Options tab


Solver Options

  • Gravity: Direction and magnitude of gravity in the simulation.
  • Physics Framerate (Hertz): Default is 60. Higher values "speed up" simulation.
  • Substeps: Number of times the simulation is evaluated 'between' each frame step on the timeline. The default value of 1 should work for most simulations.
  • Split Impulse: Enabling Split Impulse will allow the solver to apply positional corrections when deep collision penetrations occur.\nThese corrections do not affect resulting velocities.
  • Solver State: Toggles the state of the solver - like an on/off switch.

Tool Options

  • Collision Margin (creation only): The gap around each collision shape used for collision detection. This value only effects Hull and Mesh rigid bodies during creation. Default is 0.040.
  • Disable Collisions Between Constrained Bodies (creation only): Controls the collisions of rigid bodies which share a constraint. This only effects constraints during creation.
  • Create Control Sets: Creates quick select sets containing rigid bodies modified by activation controls.
  • Toggle Advanced Tools Tab (button): Adds a new tab named Advanced to the Dynamica window containing experimental tools.

-

Help Tab

Documentation, resources, and credits.

Dynamica v2.78 Help tab

Documentation & Resources

  • Online Help: a link to the online wiki
  • bulletphysics.org: Visit bulletphyics.org

Credits

  • Original Plugin: Walt Disney Studios
  • Original Author: Nicola Candussi
  • Modified By: Roman Ponomarev, Erwin Coumans
  • Tools, Features, UI & Maintenance: Michael Baker
  • Original Baking Scripts: RBD
Personal tools