Friday, March 21, 2008

Spine Rig Part 1: Building a Stretchy Spine

Building a stretchy spine isn't much of a secret anymore. I'm sure there are tons of scripts that build a spine for you, which is a good thing, but here I'll explain how to build one from scratch and what happens under the hood so YOU can build the script.

Here is a generic diagram of things you have to do to achieve a stretchy spine.
Here is a bigger version of the diagram.

As you can see there are a couple of constants as attributes and a variable parameter.
The term 'at creation' means the state before we start to modify any attribute or parameter from that particular object.
The term 'current' refers at the current state, after we modified attributes/parameters/point and so on for the object in question.

Original curve length is an constant and it stores the length of the curve at creation.
The "Original bone length" is the length of the bone at creation.
Stretchiness is a parameter that takes values between 0 ad 1 and it represents the amount of stretchiness in the bones. 
The goal is to compute a scale ratio for the bone length in such a way that the sum of all bones will meet the stretchiness factor. It will be more clear later.

We take the current curve shape and we find out it's arc length. By subtracting the original curve length we'll know if the current curve is longer or shorter and by how much. The next step will be to multiply the "stretchiness" parameter with the result of the subtract. This way we have the exact amount (positive or negative depending if the curve is longer or shorter) that we need to add to the original curve length in respect to the "stretchiness" parameter.

Now that we have the new current length we have to find a scale ratio for each bone. We do that by dividing the new curve length by the original curve length and we find the ratio. The ratio is greater than 1 if the current curve is longer, and between 0 and 1 if the curve is shorter. The ratio of 0 basically means that our current curve length is 0, in other words the curve is collapsed into a single point, very unlikely. It is this ratio that we need to multiply with the original bone length to find out the current bone length.

That was the basics of a stretchy spine which has a parameter, "stretchiness", that controls how much of a stretch we want.
I hope you enjoyed it and please make sure you'll check the next post about stretchy spine implementation in Maya.

Saturday, March 15, 2008

Why vanilla rigs?

Because I like vanilla ice cream? No, actually I don't like vanilla ice cream, chocolate is my favorite. Ok, let's not make this blog about culinary preferences, I'm sure there are others out there with far more experience than I am in that matter.

I DO like vanilla rigs. Why? simple because you take advantage of the package at hand. 
What do I mean by vanilla rigs? Rigs that use only nodes, expressions and other tools made available by the software developers and no custom plug-ins of any kind, free or not. 
I don't have anything against custom stuff but for the purpose of this blog I'd like to keep everything within the boundaries of a specific application.
Productions these days can spread across continents and make use of vast number of applications. Because of that, vanilla rigs will make everybody's life easier.

Ok I think you got my point and it's time to move on to the specifics of this blog.
I would like to create a series of video examples, not necessary tutorials on how to do stuff, and by stuff I mean rigs or rig bits, because everybody has their own way.
So... in the beginning there was a problem. Then there was a solution to that problem. I'll record how to implement that solution and share it with you. I'll let you decide if it's a good solution, a fast solution, a flexible solution or a crappy one. I very much appreciate any comments to the solution. Also any improvements to the solution are welcomed.

I don't have a specific timeline, I do have a full time job, but I would like to post every week or every other week.

Please feel free to suggest problems in either form, comments to an existing entry or e-mailing me directly. 

That's about it.