Thursday, 26 August 2021

Constraints Are Not The Answer To Every Problem

We use constraints a whooooooole lot in rigging, don't we?
They're a no nonsense catch-all solution for when you just want an object to follow another object. Don't care about its hierarchy or none of that, I just want it to follow! Why all these questions? I just want life to be simple!

Well fine. But need I remind you, we are riggers. "Simple" was never in our future.

You may have heard people online saying "Ew! Constraints! Don't use constraints! Constraints are terrible!" So let me fill you in on what they're talking about.
Look at your average constraint in the node editor:

That's an awful not of connections. And that's just a vanilla constraint - once you start messing around with multiple targets, the number of connections increases. Constraints are a nuclear solution to a surgical problem. They take in all kinds of information from the driver object(s) and driven object to make sure that there are a very few curve balls one can throw at it. Every single connection in a network adds a little extra to a rig's evaluation time (how quickly Maya runs and responds when the animator is using the rig). So it's because of all these connections that people say constraints are "slow" or "heavy.

Matrix Constraint

If you don't understand how to manipulate matrices in Maya, have a look at this post first:

https://rigjuice.blogspot.com/2021/08/important-math-matrices.html

A big chunk of how matrices are useful in Maya is in achieving constraint like effects without heavy constraint nodes.
Let's talk about how the actual effects of constraints are uniquely useful over direct connection.

When trying to get an object to follow another, there is often a lot of messy context and complication that means a direct connection just won't cut it. If two hierarchies are spatially identical then direct connections from members of one to members of the other would usually be enough. But what if the hierarchies don't match? Perhaps you need a joint to follow the orientation of a control but the orientation of said control isn't coming form just that control's rotate values? Perhaps the parent above that control is also rotating, and maybe that parent has a different pivot position than the control, so you've gotta do a bunch of trigonometry to figure out how much rotation of that parent ends up being how much shift in the orientation of the control, and then add that to the rotation coming directly from that control with some math nodes and then who knows what else!
Or you can throw up your hands and say "Orient constraint!" [mic drop]

Such a shame there's no other way when things get that complicated...
Oh wait. Matrices.

This is super handy and I want to make sure nobody gets left behind, so I'll take it one step at a time.
Let's make a cube and... I dunno, a locator.

Monday, 9 August 2021

Useful Scripts: Copy Override Colour

Here's a script I use eeeeeevery day. Turning on an object's override colour is a pain. You have to go into the node editor, open a bunch of nested dropdown menus, use an annoying slider that somehow corresponds to a list of colours in no particular order, and the attribute editor doesn't let you do this for multiple objects at once, so you have to do this for each and every object, and maybe you'll do it to the object's transform when you meant to do it to the shapes, and... there's got to be a better way!

Say you have a bunch of objects, you want them all to have the same override colour. One of them already has the correct colour, but rather than do all that stuff again for each object, simply select the already coloured object, shift select the remaining objects, then run this script!

Sunday, 1 August 2021

Important Math - Matrices

Alright. This is the big one.
If you can master matrix math, Maya will truly bend to your whims.

Let's start by going over Maya objects' transform data. An object's transform consists of four attributes, each broken down into three dimensions. You're perfectly familiar with the first three: Translate, Rotate, and Scale. But the forth? It's called Shear. You might have seen it in the attribute editor a few times but avoided making eye contact.

Take a moment to play with some shear values to see what it does. I always get confused and think it's called "Skew", because that's what it does. It skews the object