Appendix C. The CgFX File Format

What Is CgFX?

CgFX is a powerful and versatile shader specification and interchange format. As a file format, it is identical to Microsoft’s .fx Effect format for DirectX 9. However, the CgFX runtime, like Cg, supports OpenGL as well as DirectX 8 and DirectX 9. For artists and developers of real-time graphics, this format provides several key benefits:

  • Cross-API, cross-platform compatibility and portability.

  • Encapsulation of multiple techniques, enabling fallbacks for level-of-detail, functionality, or performance.

  • Support for Cg, assembly language, and fixed-function shaders.

  • Editable parameters and GUI descriptions embedded in the file.

  • Multipass shaders.

  • Render state and texture state specification.

In practical terms, ...

Get The Cg Tutorial: The Definitive Guide to Programmable Real-Time Graphics now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.