Friday, April 10, 2015

"Stick Shift" technical tricks / backstage Unity peek

This is a high level discussion of how I achieved certain effects in Stick Shift. It spoils the game, so I recommend you play it and/or read my artist's statement.

The "car" in Stick Shift is actually (a) two different cars, one for each camera, and (b) neither car actually moves, ever.

When you want to create an illusion of motion, or at least have something read as motion, then you generally have two options in games: move the object around the world, or move the world around the object. Because I wanted to focus on the gestures in the drivers seat, it didn't make sense to actually simulate a road. A scrolling panoramic image of a city street, blurred and stretched horizontally, would give enough of an impression of motion.

The real benefit of having two different cars is that I could build, stage, and light them differently according to each camera's needs. In one car, I can pose my dude "Dylan" pretty nicely in the seat. In the other car, though, his arm needed to be able to reach a strangely posed gear shift stick. "Arm-Dylan" is actually posed strangely inside the steering wheel due to the sitting animation. But that's okay, the player never actually sees it so it doesn't matter.

I also hid / deleted any part of the car that the player doesn't see. These are essentially two junker cars floating in space that are bizarro reflections of each other.

To give the impression that they're basically the same car, I tried to synchronize certain events (e.g. the lights and shadows) so the viewer will understand it's the same kind of space. The main weakness in my camera setup is that the through-line / continuity isn't well-established, like I'm technically breaking the 180 degree rule here, kind of. Unfortunately it couldn't be helped with my particular needs, one camera had to point at dude straight-on and the other had to point toward the dashboard and gear stick. I'm pretty sure Warhol didn't care about continuity, anyway.

Unfortunately I had to invest a little in the facial animations for this game. For Succulent, I could get away with some cheekbones and a jaw. In this one, I had to use an actual facial rig capable of communicating basic expressions and reactions. Very few triple-A games would animate a face like this anymore, the results are always exaggerated and silly versus something like blend shapes and facial morphs, introduced and adopted widely starting in 2004 with Half-Life 2. However, I didn't have the time to setup these blendshapes and I had this model with existing face bones, so it had to do.

When animating faces, I usually start with the eyes, the "window to the soul." Note how many bones are clustered around the eyes. Eyes are pretty important and give us lots of cues about emotional states. If you're ever talk with someone and you're barely emoting with your eyes, that might mean you're being kind of creepy / unknowable to your conversation partner. As Tyra Banks says, you need to "smile with your eyes."

Animating the face was slightly easier than animating the goo dripping out of the exhaust pipe for Ending A. I opted to use Unity's built-in animation tool for this because I wanted to animate properties other than mesh properties, but I ended up scaling back my plans when it was taking so long.

The goo is basically two quads that slowly extend and contract across 16 seconds. Once you get past initial interface hurdles, the difficult in animation is in knowing what stuff looks like. It was surprisingly difficult to find reference material of things dripping out of pipes, so I had to settle for watching several videos of people drooling -- surprisingly, there are a lot of drooling videos on YouTube. Who knew?

I still didn't really get the animation right, but it was "good enough" and I moved on.

Oh, and I actually took the time to sit down and model out the exhaust pipe, catalytic converter, and accompanying brace. The pipe and converter are actually two different objects, so I could have them move and rotate and swell at different (but subtle) rates. I hope the car nerds appreciate it.

But probably my favorite effect / most beloved game art trick is the "dissolve" effect on the title screen. By pairing an alphatest shader with a gradient alpha mask, you can adjust the alpha cutoff value to dynamically show or hide pixels. It's the same way you would achieve a "shield dissolve" or tattered effect on something, or in BioShock 2 they used it to have a character slowly write a message on a window. It's very versatile.

Anyway, I hope learning about these techniques was interesting / useful to you. Bye!