Feedback

What's your question?

By: Asked

How does Maya's cMuscleSpline remain procedural while appearing dynamic?

I'm trying to figure out how the cMuscleSpline node works internally and I can't find any technical docs on it. It clearly isn't dynamic in the normal sense, as you can scrub back and forth or jump to any frame and get consistent results. Is it storing a giant array of data as it first sees each frame? Or is it impulse based and doesn't do any dynamic calculations in the first place? Or am I way off base?

Just to clarify, I'm talking about the actual cMuscleSpline, not the cMuscleSplineDeformer.

Add comment viewed 113 times Latest activity 11 months ago

or Cancel

2 answers

  • 0

andrew_74

I've looked into it further, and Julian is correct that cMuscleSpline is managing an internal cache of velocities. These are stored in the jiggleFrame attribute, which is a compound containing a force per control point per frame. The forces for a given frame are only updated if the time step is +1.

Assuming the cache is accurate up to x frames before the current frame, the jiggle offset for a control point can then be calculated using a standard wave equation. Any frame on which the input control point experienced an acceleration would spawn a jiggle wave which decays over time. Add up all the wave equations, evaluating each at the current point and time, and you've got your jiggle offset. Through some limited testing, I think cMuscleSpline is also applying a "drag force" opposite and proportional to the velocity in order to further offset the jiggle if the input control point is still in motion.

A few of the wave parameters are exposed to the user per control point (period (cycle), rest, and 3d amplitude). The remaining parameters can be calculated from velocity and acceleration as stored in the cache.

The only problem I see is how the cache stays up to date. Since the velocities are only re-calculated when the time change is +1, the cache can easily become invalid (i.e. if the animation was changed early in the timeline, but the user hasn't scrubbed over those frames). Ideally, cMuscleSpline would be able to detect when a cache has become invalid and use an MDGContext to re-calculate it as Julian suggested, but it appears that the 2010 implementation does not do this.

or Cancel
  • 0

julian [ Admin ]

It's possible that it manages an internal cache when the time step is 1 frame and time is going forwards.

However, there is a finite time for the system to come to rest (24f by default), so maybe that means it can calculate where things are supposed to be given the positions of controls for only the last 24 frames. Something that happened 25 frames ago can't possibly affect the position of anything now (I think). If that's the case, it can evaluate positions of nodes it needs internally for the last 24 frames without the overhead of evaluating all nodes in the scene. In the API you do this by passing an MDGContext(const MTime&) to the node to be evaluated.

If this is correct, then it is a small 24 frame sim happening on every update, but more likely its a bit of mix and match with an internal cache.

or Cancel