DirectX 9 Features, Shaders, And Cg, Continued
With the introduction of DirectX 8, hardware shaders were first implemented in consumer level graphics chips. However, their capabilities were still very limited. Complex shaders could not be realized yet. Besides, only integer data could be calculated. The resulting inaccuracies caused incorrect results. In the case of pixel shaders, these would be artifacts, such as "spots." DirectX 9 greatly extended the shaders' capabilities and added the ability to calculate floating-point data sets. Further additions are loops, longer program-code and several other extensions (see table in "3D Features").
Another shot of Dawn's hair.
Programming these hardware shaders is a rather difficult task, however, since their format need is reminiscent of assembler code - making it a job for specialists. 3D ray tracing software employs specialized shader programming languages. NVIDIA has created something very similar with Cg (C for graphics). Developers can now write their shaders in a universally understandable high-level shader language. The Cg compiler then creates the necessary machine code out of these instructions. NVIDIA's Cg is fully compatible with Microsoft's certified HLSL (high level shader language). Cg calculates the shader for the task at hand, regardless of whether it is for DirectX 8/9 or OpenGL. Finally, the Cg language is very similar to those already established in the third ray tracing sector, making these very simple to adapt.
The NVIDIA Timemachine demo. A car is getting older and older.
In summary, it can well be said that shaders are a tremendous step in the direction of photo-realism.
The following are the three most important improvements found in DirectX 9:
- Pixel Shader 2.0: DX9 exposes true programmability of the pixel shading engine. This makes procedural shading on a GPU possible for the first time.
- Vertex Shader 2.0: DX9 dramatically enhances the power of the previous DirectX vertex shader by increasing the length and flexibility of vertex programs.
- High-precision, floating-point color: DX9 breaks the mathematical precision barrier that has limited PC graphics in the past. Precision, and therefore visual quality, is increased with 128 bit floating-point color per pixel.
We already covered the DirectX 9 features in great detail in our article on the ATi Radeon 9700 PRO . GeForceFX offers full DX9 support - and even goes well beyond these specifications.
If you want to learn more about High Level Shader Languages, please go to this article: