Archive for June, 2009

Katt's Mysterious 3D Lectures – Vector Application: A Better Rivet

You have the aim constraint under your belt. You can guess how a pole vector’s motion will change rotations with a look. You’re feeling a new sense of power and a desire to accomplish… things.

Now what?

Let’s start with something simple. Remember that old standby, the Rivet script, that I mentioned in my last post? Every good tutorial DVD I’ve bought over the years had it. Every rigger I’ve ever met uses it. As scripts go, it’s probably the most useful 2k on

But did you know it’s also broken?

Let me go back for a moment. A year ago, while I was working under a talented rigger who liked the Farenheit Digital system for creating nurbs ribbon rigs, was saddened by the fact that all licenses of Maya at our company were Maya Complete save two: his, and mine. This meant that the standard way of building ribbons, where you attach a Maya Hair follicle to the surface, wasn’t going to work as Maya Hair only comes with Unlimited. He mentioned something about using an aim constraint and a pointOnSurfaceNode or through the decomposeMatrix node to accomplish the same, although it didn’t work as well. So I was tasked with writing a python node plugin that accomplished the task. It worked well and quickly enough; 40 or so of them were live in the final rigs.

However I prefer to keep the number of non-standard nodes in rigs to a minimum. At my current place of work we realized a need for a follicle-like setup again, so I started researching.

At one point we’d thought we could solve the problem with the Rivet script. Rivet takes two edges, lofts them into a nurbs surface with history, then attaches to the surface a locator using a pointOnSurfaceInfo and an aim constraint. When the lofted surface is relatively square and doesn’t deform much, this works fine. When you try to use just the pointOnSurfaceInfo and aim constraint setup on a longer nurbs surface that deforms and bends, however, we found that the locators do not behave properly. Past a certain amount of twisting, the locators would rotate off in odd directions.

I played with the script and found that the pointOnSurfaceInfo node was feeding the surface normal into the aim constraint as the aim vector, with one of the tangent vectors as Up. Because of this, the aim constraint was causing the locator to flip. The way aim constraints work makes up vectors into suggestions, not rules. It also makes the third axis a product of the other two, as I showed in my last post.

In the end it was a simple fix: instead of using the surface normal (which wasn’t an illogical choice), I fed both surface tangents into the aim constraint and let the third axis, the normal, be the derived one. Since the tangent u and v vectors are always orthogonal regardless of how much you distort the surface, and since they always run in the right directions along the surface, you can be certain that the surface normal — a third orthogonal vector — will still end in the right place. (I bet the surface normal is derived from the cross product of the two tangent vectors anyway, internally.) No need for a custom node or to force the loading of decomposeMatrix; so far I haven’t seen any problems with this setup.

Steps for those who want to try this at home:

1) Create a pointOnSurfaceInfo node attached to your nurbs surface. Set it’s U and V parameters to get the output to the right place on your surface.

2) Use the createNode command to make an aimConstraint node.

3) Plug the pointOnSurfaceInfo’s tangentU into the aimConstraint’s target[0].targetTranslate, and the tangentV into the constraint’s up vector.

finishing games

Lately it’s hard for me to finish video games, books, or TV shows that aren’t directly related to my job. I’ve owned Prince of Persia PS3 for months now, but until last week I’d been stuck halfway through the game. I checked my saves and the previous save time was in early March.

It’s not because I didn’t enjoy the game — far from it. I’d say this is the first 3D POP that pays true homage to the original two 2D games while still being something new, fun, and beautiful. Yesterday I realized I had enough time to sit down and plow through the last little bit — about two and a half hours of gameplay — and I did. Straight through until the last boss fight, the game is incredible. If it had ended after the last boss fight, as the Prince is walking down that corridor carrying something I won’t spoil while credits scroll to his left, then I would probably have placed the game somewhere high in my all-time best games pantheon.

But that’s not where it ends. Instead, the developers decided that the ending you’d just witnessed wasn’t right, and allow you to undo it. It makes absolutely no sense. The whole game the Prince is an incorrigible vagabond with a sharp tongue, but he does manage to learn and grow as a character over the course of the game’s events. Later on, he even starts looking to Eleka before checking to see if he himself is injured. The hint of romance that’s there in the beginning of the game, when the two protagonists meet for the first time, is well-played and develops believably through to the end. And yet, all of that falls to the sword-stroke of whomever wrote that little epilogue in order to give Ubisoft an easy out for sequel creation.

I mean, I can’t imagine they did what they did for any other reason than, “If you end it how it ends there, we can’t make an exciting sequel!” I know they’re planning on a trilogy of games. But that doesn’t excuse taking 15 or so hours of good writing and very good voice acting and ruining them through one set of bad choices that don’t make sense when looking at the characters.

It just doesn’t make sense that a team that got everything else right in this game could make such a horrific mistake after they’d already won. I may not get the second and third games, I’m so annoyed.

At least my iPhone and DSi aren’t as disappointing. The kinds of games I can fit in are the kinds I can boot up and play through a level or two of on the train. Lately Rolando has become a minor obsession, and I’m looking forward to Rolando 2 when it hits end of June. On the DSi I took the plunge and did a download of Mighty Flip Champs. It’s a really neat game that utilizes the two screens to make an interesting puzzler that’s fun, quick, easy to pick up, and full of great art and fun sprites. Had I know it was a WayForward game before I’d bought it I’d have been less hesitant. These are, after all, the guys who made Shantae, one of the best platformers on any platform and probably my favorite GBC game ever. I wonder when the DS version will hit? They did a tonne of work on the GBA version and it never saw the light of day.

So yeah… Developers, if you’re trying to tell a good story, also try not to jump a shark in the last five minutes. Me, I’ll be exchanging both Street Figher IV and Prince of Persia when I have a chance.