Senior Rigger Rafael Villar at Moonbot Studios recently shared some insight on rigging optimization for the RiggingDojo email newsletter. Check it out for some amazing rig speed optimization tips!
Rigging Optimizations: MY FRAMES!?!
Looking for that magical 24+
Coming off the heals of a freshly submitted project and the next one not due to start for a couple of weeks, it dangerously appears as if my department has the time to actually R&D. So what is the first thing a Rigger should do when faced with the time necessary to look into improvements?
Keep the Animators at bay…
My name is Rafael Villar and I’m a graduate of FullSail University with a B.S. in Computer Animation. With several years of experience in the industry, I can honestly say that one of the most overlooked aspects of a rig is interactive performance. Sure, I know why you chose that extra follicle, or added that lovely wrap deformer to your high res mesh. It gives the most ideal deformation that you can muster, and may I say that it looks just gorgeous. But a statue it will stay if your friendly neighborhood Animator cannot move it without pulling his/her hair out.
This is the most recent problem we faced here at Moonbot Studios having shipped our most recent project which will be making its way to the public this week. Taking Flight.
And with the Animators gathering their polite pitchforks in the next room, it was clear what we needed to do.
Optimizing the rigs.
Taking a rig from one of our past & future projects, Numberlys, I decided to hunt down what was causing the bottleneck in playback.
So with a simple animation cycle on one of our Numberlys, Guy 1, I am seeing about 5 frames per second on my aging Macbook Pro. Animators were reporting results in that ballpark as well, so my frustration is their frustration.
One of the fastest ways I have recently found to diagnose a rigs performance in Maya 2015 is to take it into Maya 2016. New in 2016 is their Profiler tool. Make sure that if you are using this tool you set the Evaluation method to ‘DG’ in the preferences menu under Animation. This ensures you get the same behavior as Maya 2015, if that is your desired year, or Parallel Eval might make you think that Autodesk has actually solved your problems in this area. Haha! Never. Get out.
Immediately I can see the culprits in this rig light up like a Christmas tree thanks to the profilers efforts.
- -Wrap deformers
- -SOuP Plugins – Ray Project, Peak
- -A pose deformer plugin
Well how much of a hit is this really? What do these little time readouts actually mean, how does one quantify this into something more tangible. DELETE, DELETE, DELETE. That’s right, take a butchers knife to all that hard work you have done and remove the nodes that have identified themselves as Animator back pain. Just make sure to Save As something else, we’re not mad.
After busting down the rig to nothing more than its basic skinning nodes I can see that I have jumped from 5-7 frames per second to about 22 frames per second. Here, I am brushing up against the limitations of the hardware, very little we can do about that for now, but I’ll take anything I can get. The problem now is I have obviously gotten rid of key components to my rig that allow it to deform or function ideally. Before I talk about a potential solution for this, I want to go over some of the nodes I deleted. Some were more egregious than others, even ones of the same nodetype.
- -Follicle #37 – This random follicle seemed to be computing a little heavier than the other nodes of the same kind. After looking into the issue further, it was evident that #37 was resting especially close to a UV border, perhaps causing Maya to think a little harder than needed. Considering its position or rearranging the UV’s to be more favorable could yield better performance.
- -RayProject – This is an instance where the need for a node exceeds the performance limitations it brings. Sometimes a particular type of deformation is art directed and that limits the options available to you. Potential R&D would be looking into Maya’s shrinkWrap node to see if it yields the same result and/or better performance.
- -Peak node- This was a node used in the arms/limbs setup that would allow for rounded/stretchy/cartoony elbows on the fly. In hindsight after completing previous projects, it is clear that this setup was not ideal and we should take this back to the drawing board. Our bad. Looking back and seeing where one has come up short is sometimes more important than patting ourselves on the back for a job well done.
Even with being more calculated in our node adjustments as we were above, we still have the problem of too much going on at any one time. And having different LOD’s that the Animators can toggle between is closer to an ideal setup but they shouldn’t all exist in the rig simultaneously.
This. Sometimes the simplest answer, is the last one to dawn on you.
But we shouldn’t attempt to maintain 3 different versions of the rig, right? A Lo, Mid, and Hi? Yes and no.
The adjustment to our workflow we need to make is simply adding an additional step after rig assembly or a publishing tool. This will assess the number of LOD’s in the rig, and save out a version of the rig with only that LOD available, deleting the additional ones as we go.
- Rig_hi – This is the final version of the rig that will make it to shading and lighting. This version has all of the bells and whistles needed to achieve the most ideal level of deformation time allowed. Plugins, complex deformers, etc. 95% – 100% of final animation.
- Rig_mid – In this version we have the same geometry as in the Rig_hi but everything is limited to skin clusters. This will allow the Animators a very close approximation of final performance without the heavy performance hit.
- Rig_lo – Or proxy version. This will have simplified geometry that holds silhouette but yields best performance. Depending on the density in geometry we would either go with skinning, parenting, or constraining. Make sure to assess the pieces of geometry so you do not have too many constraint nodes.
Along with all of this comes a tool that will replace the current LOD based on what is available. This will give the Animators the ability to toggle rigs/LOD as necessary.
Maya 2016 and the list of performance improvements that we get for FREE!
That was easy.
No seriously. Parallel evaluation and gpu override have such particular use cases that in all practicality it would limit what a rig can achieve if you tried to use only deformers that are currently supported by Maya. I am sure this will change as Autodesk gets to updating their vanilla deformers and as 3rd party developers begin to support parallel eval. But out of the box, performance boosts will be few and far between.
One example is the inability to achieve gpu override when using follicles, wraps, or anything that depends on a mesh to determine its own evaluation.
Elsewhere! One set of plugins that we employ in our rigs comes from SOuP, Peter Shipkov.
Specific nodes include:
- Morph – A multi threaded blendshape node on steroids, you can choose the number of cores used while this deformer chugs away on hundreds of target shapes or more.
- Retarget – A faster wrap deformer with features exceeding what you get in the vanilla version.
- gpu & interactive caching node – Bread and butter. With the gpu version of this node, it skips a number of linear DG evaluations that Maya is often bottlenecked with when deforming geometry. The gpu also draws right into the viewport. After drawing, it then caches the frame information and continues to display that cache unless something in the rig changes and then the gpu will evaluate only on that frame. Something like this can help turn out an appreciable performance increase in a lot of situations so feel free to explore.
So make sure to stop by the SOuP forums, introduce yourself and if you found something in SOuP useful, show your support by Donating.
Last but not least!
Why not just create our own custom nodes for every solution! Why yes Billy! But no…
Time. Sure, every Rigger, TD, and technical person in the industry collects a paycheck each week or so to take home. While at work, in production, and crunched, Time is the real currency. The constant evaluation of whether or not you have the time to delve into a custom node is one that will always be present. For the purposes of this write up and the real world time before the next project starts, sometimes you have to look at the tools you have and see where you can just simplify.
Share your tips!
For me, I am always interested in knowing more about performance tips & tricks so if you know of any that would be useful in squeezing out a few extra frames to get that magical 24+, I would love to hear about it. Rav@RavRigs.com
Snr.Rigger, Moonbot Studios.