Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
63 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

Contents
 Introduction
 Vertex Shaders
 in the Pipeline

 Why use Vertex
 Shaders?

 Vertex Shader Tools
 Vertex Shader
 Architecture

 High Level View of
 Vertex Shader
 Programming

 Conclusion

 Printable version
 Discuss this article
 in the forums


The Series
 Fundamentals of
 Vertex Shaders



These are screenshots of a Quake 3 level viewer, showing nv15 of nVidia. It is capable of loading any Quake 3 level by converting the Quake 3 shader scripts to vertex and/or pixel shader source on-the-fly.

Bart Sekura, the author of this application, will explain the whole source to you step by step in an upcoming book on vertex and pixel shader programming. The book will be published by Wordware and we are searching for additional co-authors.

We have seen ever-escalating graphics performance in PCs since the release of the first 3dfx Voodoo cards in 1995. Although this increase in horsepower has allowed PCs to run graphics faster, it arguably has not allowed graphics to run much better. The fundamental limitation thus far in PC graphics accelerators has been that they are mostly fixed-function. Fixed-function means that the silicon designers have hard-coded specific graphics algorithms into the graphics chips, and as a result the game and application developers have been limited to using these specific fixed algorithms.

For over a decade, a graphics language known as Pixar Animation Studio's RenderMan has withstood the test of time and has been the choice of professionals for high-quality photo-realistic rendering.

Pixar's use of RenderMan in its development of feature films such as "Toy Story" and "Bug's Life" has resulted in a level of photo-realistic graphics which have amazed audiences worldwide. RenderMan's programmability has allowed it to evolve as major new rendering techniques were invented. By not imposing strict limits on computations, RenderMan allows programmers the utmost in flexibility and creativity. However, this programmability has limited RenderMan to only software implementations.

Now, for the first time, low-cost consumer hardware has reached the point where it can begin implementing the basics of programmable shading similar to the RenderMan graphics language with real-time performance.

The main 3D APIs have evolved alongside graphics hardware.. One of the most important new features in DirectX Graphics is the addition of a programmable pipeline that give you an assembly language interface to the transformation and lighting hardware (vertex shader) and the pixel pipeline (pixel shader). Such a programmable pipeline gives you a lot more freedom to do things never done before.

Shader programming is the new and real challenge for game coders. Face it...

What You Are Going To Learn

This course covers two key aspects of the new Direct3D 8.1 API and teaches you how to use them to produce stunning effects: Vertex Shader and Pixel Shader Programming. From now on, you are going to learn all the stuff necessary to program vertex and pixel shaders for the Windows-family of operating systems from scratch.

We will deal with

  • writing and compiling a vertex shader program
  • lighting with vertex shaders
  • transformation with vertex shaders
  • writing and compiling a pixel shader program
  • texture mapping with the pixel shader
  • texture effects
  • per-pixel lighting with pixel shaders

and much more ...

As with all my other online tutorials in the past, this tutorial will change and perhaps grow in the next couple of weeks a lot. I always update, change or clarify things, sometimes with e-mails from readers in mind. So don't stop writing me e-mails :-). Just watch out for the "Last modification: ..." date at the beginning to get the newest version. You will always find the newest version at www.direct3d.net.

What You Need to Know/Equipment

You need a basic understanding of the math typically used in a game engine and you need a basic to intermediate understanding of the DirectX Graphics API. It helps if you know how to use the Transform & Lighting (T&L) pipeline and the SetTextureStage() calls.

I recommend working through an introductory level text first. For example "Beginning Direct3D Game Programming" might help :-).

Your development system should consist of the following hardware and software:

  • DirectX 8.1 SDK
  • Windows 2000 with at least Service Pack 2 or higher/Windows XP (the nVidia vertex shader debugger only runs on these OS's) 
  • Visual C/C++ 6.0 with at least Service Pack 5 (needed for the DirectX 8.1 SDK) or higher
  • > 128 MB RAM
  • A lot of hard drive storage > 500 MB
  • A 3D graphics card. To be able to get the maximum visual experience from the course examples, you need to own relatively new graphics hardware. All the examples are tested on an ATI RADEON, ATI RADEON 8500 and a Leadtek Geforce3, all with 64 MB. Especially, yhe pixel shader stuff won't run properly on a non-Geforce3/RADEON 8500 board at the time of this writing
  • the NEWEST graphics card device-driver

If you are not a lucky owner of a Geforce3, RADEON 8500 or another new graphic card that supports vertex shaders in hardware, the standardized assembly interface will provide you highly-tuned software vertex shaders that AMD and Intel have optimized for their CPUs. So software vertex shaders are the easiest way to get portable SIMD code for the main CPU suppliers.





Next : Vertex Shaders in the Pipeline