The pixel shader — continued


Vertices


Polygons


Solid, no textures


Per-pixel shading effects


Per-pixel shading effects


Environment mapped

Vertex and pixel shaders in action
It is a well-worn cliché in hardware reviews such as this one to spend some time looking at a manufacturer's demo showing off a product's features. You will have to forgive me for the following, but this demo makes my eyes pop outta my head every time I watch it. And just to prove I'm an incorrigible geek, I get excited about what's happening behind the scenes, not just the eye-popping finished product. It's like when I got my first glimpse of Star Raiders on the Atari 800 back in the day, only about 10 million times better.

NVIDIA's Chameleon demo shows off both vertex and pixel shaders, and it's a great object lesson in the new capabilities GeForce3 brings to the desktop. Since there's about zero software for the GeForce3 at present other than demos from NVIDIA or its partners, this one's worth watching. Well, what really makes it worth watching is the graphics being created in real time by the GeForce3. To give you a good handle on exactly what this demo is doing, I've captured some high-res, low-compression screenshots, augmented by a video of this thing in action.

Vertex shader stills
At the right, you can see screen shots of the demo. The first three pictures aren't exactly stunning, but they will give you a good sense of what the vertex shader is doing. The top picture shows the vertices of the chameleon model used in the demo. These are the points of data the graphics processor manipulates to create motion. Nearly all of those points in the chameleon's torso, from the neck to the base of the tail, are part of a vertex shader program that flexes the entire polygon mesh as the chameleon walks.

The second picture from the top is the same model represented as polygons. It's a relatively high-poly model by most standards. Now look at the picture below it. That shows the model as a solid object. Note how the solid version of the model is lit. The lighting is the work of the vertex shader, and with as many polys as this model has, it looks quite good. However, though the model is detailed enough to look very smooth, it lacks the extra polys necessary to give texture to the chameleon's skin.

Those first three screenshots could have been produced on a GeForce2. What's impressive about the vertex shader is how it animates things, as we'll see shortly. But the pixel shader is up next.

Pixel shader stills
The bottom three screenshots at the right are truly impressive, even as stills. These pictures show the same chameleon model with the same number of polygons, only this time, the model is mapped with color, specular, and bump maps. The first two pixel shader screenshots, with the brown and green chameleons, show how pixel shader effects can create realistic-looking lighting. The final shot, the "liquid metal" chameleon, is everybody's favorite; it uses cubic environment mapping to simulate the model reflecting its surroundings.

Taken together, the vertex and pixel shaders can create the kinds of effects previously reserved for professional, frame-by-frame rendering packages. This isn't quite Shrek or the Final Fantasy movie, but it's surprisingly close.

Moving pictures


See the movie. (5MB)
Download Win32 video codec here.

Now let's set things in motion with a video, so I can really give you a sense of how these things work. Click on the links at the left to get going. (The video is in DiVX :-) format, if you need a non-Win32 codec to watch.) There are several things you should notice when watching the video.

First, you can see my mouse pointer in the video, and the camera jumps around some. The GeForce3 generates this animation in real time, and I can control the motion interactively. The motion is fluid, too.

Next, the torso of the model is bending and flexing as part of a vertex shader program. This model is skinned, and has a 25-bone skeleton. The vertex shader, not the CPU, processes movement calculations. Watch as I move the camera around, especially when it's looking down on the model, and you can see the chameleon's torso move as an organic-looking unit.

Also, notice how the texture of the chameleon's skin shifts along with its colors. These are changing pixel shader effects, including varied specular and reflection maps.

Finally, that's me losing bladder control off camera. Happens every time I watch this demo.