Displacement Maps in 3D Animation

While digging through an old backup hard drive the other day (resolution 1: manage files better) I found a 3d test that I had completely forgotten about. Six months ago, I had a couple of days free, and spent them experimenting with a few different way of creating and using displacement maps for complex organic modeling. I call this post “Remember the Allosaur” (resolution 2: fewer puns).

A displacement map is a texture or procedural map or that can be used to distort or displace the geometry of a 3d model. Generally, this is used to animate flapping flags, rippling water, or swaying vegetation, but with the right tools, it can be a big help in creating complex organic models with simple geometry. I started out with a very simple Allosaurus head and neck, which took about 20 minutes to build, and had all the detail of an early 90s video game character.

This blocky head could be smoothed out by subdividing these original 480 polygons into thousands more, rounding off the hard edges, but I needed a way to control how the new geometry would be generated. I had to paint a displacement map that would add these details. This texture map would be a simple greyscale image wrapped around the allosaur describing what the new high-density mesh should look. The white areas would bulge out, and the black areas would crimp in.

In the image below (click to enlarge), you can see the blocky base model with a simple displacement map applied. Most of the map is close to 50% grey, because the model is pretty close to what I want, but you can see white smudges around the eyesocket, base of the skull, and most notably along the vertebrae of the neck. As I turn up the level of subdivision, the new shape of the model becomes more detailed. At nine subdivisions, there are nearly 75,000 polygons, and fine wrinkles and folds are now obvious around the nose, jaw and eyelids.

To paint my displacement map, I used ZBrush 2, which allows the artist to see the changes to the topography of his model while he paints directly on it. It’s a fantastic new tool for organic modelers, and it was great fun to use. I could spin my character around under the virtual light while sculpting bone structure and musculature directly into the geometry with broad strokes of my Wacom tablet. It’s almost as effortless to use as you could imagine; except that it isn’t.

The creative part is very simple and intuitive, but ZBrush suffers from being the first program to do what it does, and so I had no idea how to use it. The two days I spent building the allosaur were mostly taken up with trying to figure out how to import Lightwave models and UV coordinates into Zbrush, and then how to get a working 16-bit displacement map out. Not to mention trying to get my head around how to use a program that can accomplish any 2d function in 3d space – and almost every 3d function in 2d space. It’s every bit as complicated as you could imagine.

But actually painting the map itself was a breeze, and after rethinking all three dimensions several times, ZBrush started to feel a little like it was defying all the laws of the universe. Above is a detail from the neck area, much emphasized to you can more easily see the individual scales. In the actual map, the skin details are tiny variations of grey on top of the much more dramatic changes of the underlying bone and muscle details (the broader black and white strokes on top of the scales and wrinkles).

This is just a real quick throw-away modeling test, but if I was going to use it as real character for animation, I’d need to rethink the process in order to separate the motions of bones, muscles, and skin. The “proper” way to simulate this is to actually have bones and muscles built, with a layer of skin sliding over the top, but this is a pain to calculate, and there are very few off-the-shelf solutions for this. It can be cheaper and quicker to use “muscle bones” that fake the stretching and bunching of real musculature, and morph targets for extreme muscular distortions and fat jiggles, a method that would work nicely with a few layers of displacement maps.

The animation package messiah will even allow you to attach one displacement map to the polygons (for skin details) and another to the underlying rig so that muscle bulges and skin textures and move independently while still affecting each other. Regardless of which package you’re using, the possibilities for using weight maps, procedurals, expressions, shaders, and morph targets to affect your geometry by altering displacement maps are limitless. Even this very quick-and-dirty experiment, with only a low amount of subdivision and no other texture maps, has a very controllable level of fine detail.

Of course, that I’ve done is nothing ground-breaking or special – after all, I built this six months ago. This is currently a much-used method for detailing organic models, and even creating characters almost from scratch. It requires more polygons when rendering, but it gives you full access to a lower-rez version for animations. That means less geometry for dynamics calculations to worry about, better rigging control, a more convenient way to make changes, an easier initial modeling task, and, at the end of the day, more detail.