Sign in with
Sign up | Sign in

Programming The Vertex Shader, Continued

High-Tech And Vertex Juggling - NVIDIA's New GeForce3 GPU
By

Here are a few examples that list the number of instructions required by a certain operation:

Vector Cross Product 2
Division 2
Square Root 2
Multiply Vector with Transpose Matrix 4
Transform To Clip Space, Lit It With One Single Directional Light In World Space, Then Output A Texture Coordinate 7
High Precision Log 9
High Precision Exp 9
Low Precision Sinus / Cosinus 9
High Precision Sinus / Cosinus 13
Transform To Clip Space, Lit It With One Single Specular Light In World Space, Then Output A Texture Coordinate 18
4 x 4 Matrix Inversion 38
17 simple point light sources 126

The Xbox is supposed to have two parallel vertex shaders, while GeForce3 has only one. The 'hardwired T&L' unit cannot be used parallel to the vertex shader. GeForce3 can only process one vertex after another.

NVIDIA supplies small libraries for common 'vertex program modules' as well as 'vertex programs for fixed functions'. It also offers a program (NVLink) that is able to create vertex programs for you. Here is an example program for two-sided lighting:

What always has to be kept in mind is:

  • A vertex program must not contain more than 128 instructions. This restricts the number of possible (specular) lights as well as the number of possible matrices for skeletal animations.
  • The longer the program the longer the execution time and the lower the triangle rate.
  • Use conventional 'hardwired' T&L if vertex programming is not required.
  • Switching between a small number of programs is fast, switching between a large number of programs is slow(er). This sounds as if GeForce3 is caching the vertex programs.
  • One vertex goes in, one vertex comes out - the Vertex Shader cannot create new vertices, write to other vertices or receive information about other vertices in the same frame.
  • The end product has to be a transformed and lit vertex, the program has to make sure of that.

All in all the Vertex Shader specs are very impressive and offer a huge number of possibilities. However, a peep at the specifications of the Xbox shows that in GeForce3 the vertex shader is still in its early days.

A World Of New Opportunities - What The Vertex Shader Can Do

I've got to admit that the heading of this paragraph may be a bit too juicy. It is virtually impossible to list all the things developers are able to do with the new programmable vertex processor of GeForce3. However, I can at least give you a list of the fanciest features that can be realized with NVIDIA's new flagship processor.

Skeletal Animation - Matrix Palette Skinning

We already learned that the Vertex Shader allows a considerably large number of matrices for character animations. This means that the days of NVIDIA's pretty useless 2-matrix-skinnig are finally over. Faces, limbs or clothes can now be animated very realistically. NVIDIA claims that up to 32 matrices (=bones) can be used per vertex for animations. A look at the 128-instructions limitation shows however, that less than 32 'bones' seem to be more realistic. Nevertheless, even 20-matrix-skinning is already a very impressive achievement.

Morphing And Key Frame Animation

An easier way of creating semi-realistic animation is to define two different stages of an object and then let the vertex shader create interpolation steps in between those two stages. This way you can change a face from smiling to angry, as already shown by ATi with the Radeon, a chip that is already capable of morphing and key frame interpolation. NVIDIA's example is a swimming dolphin.


Another one is this here:

React To This Article