Some tips and tricks on how to optimise your simulations.
The rendering of constraints is often more expensive than actually solving them physically. Hide these if you don't need them to gain a potential 30-50% of performance (!).
Gain another 5-10% performance by hiding all Ragdoll nodes, i.e. Locators. Rigids are much faster to draw than constraints, but you can never have too much performance.
Rigid bodies have an
Enabled state to exclude it from a simulation, but it will still partake in most evaluation and still cost precious CPU cycles.
In Maya 2016, an attribute was introduced for exclude nodes from Parallel Evaluation called
.frozen. Ragdoll now supports this attribute to a limited extent.
This operation is completely non-destructive and affects nothing but the nodes you select.
The more you freeze, the more performance you gain, and that includes Maya's native nodes. So go ahead and freeze the controls as well.
The optimisations are coming from deep within Maya and is mostly outside of our control. And it isn't perfect. How Maya chooses to evaluate nodes is sometimes a mystery, and sometimes even frozen nodes get included in evaluation. For the technically minded, you can read more about the attribute and behavior here.
Ragdoll is an "iterative" solver, which means it will make quick attempts at resolving contacts and constraints multiple times until it reaches an acceptable solution.
The more attempts you allow, the closer to the true solution it will get, at the cost of performance.
rdScene.iterations is how many iterations are given to each rigid body. Greater numbers means you can use higher values for
Guide Strength and
Limit Strength, at the expense of performance
This number is multiplied with
rdRigid.positionIterations which is the final value involved in determining how many iterations are spent solving a given rigid.
- 4 scene iterations and 8 rigid iterations brings a total of 32 iterations for each rigid, which is a decent value, in the upper-end of what is typically necessary.
- This number can be tweaked on a per-rigid level too, if you know that one or more rigids are more important than others you can reduce it for the rest to save on performance.
Every frame in Maya is divided into this amount of "substeps" which makes Ragdoll look at your animation in slow motion.
The more time it has to respond to contacts and resolve constraints the easier of a time it will have, at the expense of performance.
- 4 substeps is a good number, suitable for the average simulation
Ragdoll ships with two separate solvers called
- Temporal Gauss-Seidel
- Projected Gauss-Seidel
TGS (the default) is better suited for full-body dynamics, whereas PGS is better suited for lots of independent rigid bodies, like a brick wall.