Dynamica user manual
From Physics Simulation Wiki
Introduction to Dynamica
Fig 1. Example of Dynamica rigid body sequence choreographed with the v2.78 activation tools
- 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.
- 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.
Download the latest installation files for your OS/Maya version from the Dynamica Project Page:
- Precompiled versions of the Dynamica plugin can be downloaded from http://code.google.com/p/bullet/downloads/list
- The source code of the Dynamica plugin has its own repository at http://dynamica.googlecode.com
Install and enable the plug-in
- Run the installer.
- Start Maya and go to Window > Settings/Preferences > Plug-in Manager:
- Scroll down to find an entry for Dynamica/Bullet and check the boxes labeled Loaded and Auto load:
- Look for a shelf named Dynamica and click the Bullet icon.
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.
- 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.
- 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.
- 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.
- 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).
- Dynamica supports several different constraints, such as dNailConstraint and others. You can read more about them on the Dynamica Constraints page.
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
- 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.
- 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)
- 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
- 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).
- Then repeat the same steps of the Simple rolling sphere example.
To create a rigid body array
- 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.
- 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.
- Create a passive plane as before, then translate the rigid body array so that all donuts are above the plane.
- 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:
- 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.
- 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:
- Maya Plugin Intro (28Mb)
- Using Maya Force Fields (17Mb)
- Creating Donuts (11Mb)
- Creating Peanuts, used in upcoming Bolt Movie (29Mb)
- Part of Bolt trailer with Peanuts shot (26Mb)
Online support forums
- Visit the Bullet forums for physics authoring tools support and feedback
- Dynamica discussion on CG Society forums: http://forums.cgsociety.org/showthread.php?f=86&t=675357
- Return to main wiki page of Maya Dynamica Plugin
The Dynamica tools are designed with art direction and pipeline integration in mind. A typical workflow looks like this:
- Mesh preparation: This involves pre-shattering meshes and creating low detail proxy objects to fit the original shapes.
- 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.
- 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.
- 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.
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.
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.
Rigid body and constraint properties can be adjusted via the Channel Box or Attribute Editor.
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.
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 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.
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.
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.
Store simulation as keyframes and optimize the scene size. This operation is not undoable.
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.
- 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.
Control various solver and tool settings.
- 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.
- 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.
Documentation, resources, and credits.
Documentation & Resources
- Online Help: a link to the online wiki
- bulletphysics.org: Visit bulletphyics.org
- 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