Do you remember the old nursery rhyme about Fuzzy Wuzzy, the bear who had no hair? This alliterative tongue-twister that continues to delight grade school children and crazed poets expresses just what's missing from computer graphics today. Fuzz. That's because, until recently, rendering realistic fuzzy objects took way too long--from minutes a frame using line drawing to hours a frame with ray tracing. And hair isn't the only type of fuzz missing, the world of grass, leaves, fabric, and fur has also been ignored. Fortunately, the gaming world won't have to view bald creatures much longer, because Jed Lengyel, a researcher at Microsoft, has developed techniques that, combined with the powerful hardware behind Xbox, Microsoft's new gaming console, make rendering realistic real-time fuzz a snap.
Lengyel is an advocate for fuzziness. He likes to start conversations and technical papers with the line, "Make a list of your favorite things, and you will find that many of them are fuzzy." He morphs from a scientist into a poet when he talks about his own favorite fuzzy things. "My wife, my children, my mother, father, sisters, brothers, cousins, my dog, my cat, a fuzzy chick, a furry rabbit, a soft towel after a bath, a favorite shirt, an old couch, nice warm socks, a field of flowers, a forest, grass blowing in the wind, dandelion seeds waiting to fly..."
He hopes that the technology he and other researchers at Microsoft have developed will allow artists to "render not just everything we've ever seen but everything we could ever imagine."
One Perfect, Beautiful Leaf
Lengyel got started in computer graphics when he was in high school. It began with a love of games. "My first machine was the TRS-80 at my junior high school. I would hide out until late in the evening making mountains and space ships with huge pixels. Later, on an Apple II, I made this game with little scrubbing bubbles. You had to clean out the bathtub, and these ants would come along and try to pop you. It was really fun."
"I want to design on a larger scale, like big cities, but I also want to go down in scale, to an individual leaf smoothly. Instead of having each leaf on a tree break up into pixels as they do when you get close, it will turn into geometry with clumps of volume leaves around it. As you get closer you'll be able to see one perfect, beautiful leaf."
Lengyel is a laid-back man who speaks in a soft, slow, purposeful way, but he straightens up in his chair and almost bounces when he talks about the movie that inspired him in his search to make the one perfect, beautiful leaf. "Did you ever see the movie Powers of 10 when you were a kid? That made a big impression on me in elementary school. There's a couple sitting on a blanket in a park. They [the moviemakers] start to do the powers of ten. They jump back and you see the whole park, then they do another power of ten and you see all of Manhattan, and then you see the whole state, the whole planet, and the whole solar system. And then they zoom in by powers of ten until you see the woman's arm and each individual hair and down to the cell and all the way down to the molecules and quarks.
"That's what I want to be able to do. And that's what you want to be able to do when you're in a game. If you're in a racing game and you want to stop and walk toward a tree, the tree should look as real close up as it did far away. I'm trying to make this hierarchy of representations that lets you do that smoothly."
Lengyel had to learn a lot about hair when he designed the algorithms that would make bald spiders into scary, hairy spiders. Geometric hair modeling considers multiple parameters, such as color, diameter, orientation, length, curliness, curl radius, and even curl taper.
"The look of the hair is very dependent on the structure, is it fine or is it soft," says Lengyel. "It's also important to get the lighting right. The way that light interacts with hair is very different than with regular materials like ceramic or rubber. Computer graphics are mostly made out of plastic. Something like Toy Story is perfect for that because all the toys are made out of plastic. But hair lighting is very different. If you shine a light on a patch of plastic, when the light gets right above the surface the area pointed right at the light is the brightest. Hair, on the other hand, is darkest when it's pointing right at the light. It's brightest when it's perpendicular to the light. We went to some pains to model that." Lengyel's lighting model work is based on earlier work by others, including Jim Kajiya, a pioneer in computer graphics who is currently an assistant director at MSR.
Stitching a bunny hair suit
Rendering hair is computationally expensive, and the majority of methods are too slow for real-time hair. Lengyel developed a method to render a furry surface as a series of concentric, semi-transparent textured shells containing samples of the hair volume. In addition, he used lapped textures, developed by Hugues Hoppe at MSR, to solve some of the limitations of the shell method. The lapped texture approach pastes small patches of the same texture over the surface in a way that makes the repetition less apparent than with other techniques. Since the patches share the same texture, they greatly reduce memory overhead.
Another problem with rendering hair is the edges or silhouette of the hairy object. The visual cues at the silhouette play a critical role in perceiving the characteristics of the fur. Lengyel has developed a scheme for rendering textured fins that more closely follow the direction of real hair on a silhouette. The fins are sampled in a direction that is natural to the edges of a furry creature or object.
To build a bunny hair suit, the bunny is first input as a triangle mesh. Two operations are then performed to prepare the bunny for its suit. First, the triangle mesh bunny is measured for its suit, or, in slightly more technical terms, the program computes the lapped textures necessary to cover the surface of the object. Then a geometric model is "grown" of a patch of hair and sampled into the shell and fin textures. The sampling process converts the hair geometry to texture map images. You could think of this as weaving the fabric before it is cut and measured into the proper size for the bunny.
Lengyel says, "This is quite a bit different than what people could do before. What people have done before is drawn each one of these strands of hair as a geometric line. What we are doing instead is drawing very simple polygons that use dense texture maps with a transparency channel to encode the location and color of individual hairs. Each triangle is drawn sixteen times like a stack of slices. Each time you draw a slice it uses a slightly different texture map, so you build up the hair one dot by one dot.
"The other thing we did was to add these fringes (fins) along the silhouette and those really help. There are two different kinds of hair on a bunny; there are these short fuzzy hairs and these long guard hairs. So these not only help, they give you the impression of those longer guard hairs sticking out everywhere. (Now even a computer graphic can have a bad hair day).
Xbox makes it possible
Lengyel needed help to make his techniques usable for game developers. Xbox, Microsoft's gaming console due out in late 2001, provides the hardware to power real-time fur rendering. The Xbox houses a special 3D graphics chip that offers performance the other game consoles can't approach. The 6.4 gigabyte per second memory system is fast. The CPU and the graphics processor share 64 megabytes of memory, which is more than any other console. Also, the Xbox supports compressed textures and has a hard drive, so a large number of fur and surface textures can be streamed in as needed. The chip will be able to animate 125 million polygons per second. In addition, it gives graphics programmers the ability to make their own vertex and pixel shaders. Vertex processing allows detailed movement and facial emotion, while pixel shaders allow artists to mimic reality through altering the lighting and surface effects.
Lengyel explains the Xbox difference, "The graphics performance in the Xbox is so much better, and there's so much more memory on the Xbox. With the vertex shaders and the pixel shaders; we can put our code right down there next to the metal.
"Up until this generation of chip, everything was fixed function, you had one graphics pipeline that you had to use, and so finally with this you can download programs to do just what you want and not all of the extra stuff."
Because developers can program their own shaders, they can give games an individual look, instead of having all games look virtually the same. Before the invention of the technology that is going into the Xbox, shader engines were hard-coded into the chip, giving the developers only one look to use.
Someone as interested in hair as Lengyel is just had to invent a graphical blow-dryer. He uses it to study how hair moves naturally. It's an effect that wasn't possible before Xbox allowed him to program his own shaders. He built a model of a furry bunny to experiment on. "The graphics processor is doing all the blow drying so the light source acts as a wind source and you calculate a direction for every triangle represented in the hair. Then you offset it according to its direction toward the light. I blew dry a stuffed animal just to verify the model somewhat. One of my daughters gave me one of her tiniest stuffed animals. I had it in here for a while but then she wanted it back. There went my research tool."
Feel the Fur
Ray Bradbury wrote a story called "The Veldt" about a house that contained an unusual nursery. The nursery walls were a virtual world that the children could control with their thoughts. The children in the story had created an African veldt, complete with virtual lions that were so graphically real that they became living, breathing creatures.
A quote from the book illustrates the power of the illusion: "The lions were coming...so real, so feverishly and startlingly real that you could feel the prickling fur on your hand..." Though Lengyel's real-fur techniques won't bring quite this level of reality to your screen, he hopes to get "one step closer to the best possible tool for the imagination."