Chapter 7. Realism Through Normal Mapping
The really cool advantage of using shaders is that every step of the rendering pipeline can be customized. For Pixel Shader version 1.1 (GeForce 3), you have just eight instructions available. As such, the programmable pipeline is not so great because all it does is emulate the Pixel Shader instructions with preprogrammed hardware. Pixel Shader 2.0 is much more flexible by allowing many more functions (as you saw in the previous chapter the
pow methods are only available for Pixel Shader 2.0 and up) and enabling you to write more instructions (the limit is 96 here, but some methods require more than one instruction).
Pixel Shader version 3.0 is even better by enabling better flow control, which means you can exit the shader code based on programmed conditions to optimize the performance. Complex shaders in Pixel Shader 3.0 can have up to 512 instructions, and even with very fast graphics hardware, this is a lot. When rendering many millions of pixels it takes a lot of time to execute that many instructions for every single pixel, even when you have 16, 24, or 32 pixel shader units working in parallel. The new NVidia 8800 GTX graphic card has even more shader units working in parallel—it has 128. Sometimes you might want to skip complex calculations if a pixel is not affected by several lights or doesn't lie in the shadow. This way you can still achieve great looking and expensive Pixel shader effects, but you limit them to where ...