- CgFX is a handy tool for hardware shader development. It will help software guys, especially if the project (either a game or an interactive presentation) is first developed in 3d studio max. I guess this tool will be popular in workgroups that include both Cg programmers and 3D designers.
- From the designer's point of view, CgFX, regrettably, cannot be considered a fully functional tool. There are several reasons: the narrow specialization of the shader and the lack of ready-made shader libraries. The task of writing the library by yourself is too hard because of non-trivial programming that requires special skills and knowledge.
- Besides NVIDIA GPUs, there exist (and even flourish!) graphics processors from ATI. I mean that CgFX may not run smoothly on RADEONs. Well, the compatibility with the FX format may solve this issue, but practice makes the final judgment.
- Now, there is a clear trend in the video technologies development – interactive 3D graphics. It means that the graphics processors will no longer serve as CPU helpers in “software” 3D rendering. That’s rather sad.
CgFX Shader Execution Speed
Just for you to know how fast pixel shaders are, I include the results shown by a GeForce FX 5200 graphics card at executing some pixel shaders in the max viewport.
The testbed was configured as follows:
- Intel Pentium 4 2000MHz CPU;
- 512MB PC2700 DDR SDRAM;
- GeForce FX 5200 (250MHz GPU, 300MHz 128-bit DDR) graphics card;
- Windows XP SP2;
- 3ds max 5.1 with SP1 (the service pack provides 3d studio max compatibility with DirectX 9).
I used NV_Shaderball.max model and shaders coming with the CgFX plug-in for 3ds max 5. The test method (transformation of the viewport) has been described in our previous articles.
The test scene contains a model of a spherical object made of relatively few polygons (about 4,000), two directional light sources and a camera. The camera window (the scene default setting) was switched to the perspective view window. Then I loaded a shader file in the Connection Editor and measured the performance. The results are listed in good old frames per second (fps).
So, now you will see the test results and screenshots of the viewport (interactivity in numbers).
BumpReflectCg.fx – DirectX 8, assembler, bumpmap, texture:
The second number refers to the viewport zoom. I included it because the zoom speed differs greatly from any other transformation in most tests.
BumpReflectCgDX9.fx – DirectX 9, bumpmap, texture:
This is a DirectX 9 analog of the previous shader. It doesn't use Assembler, but features richer visual effects and parameters and thus is executed slower than its analog.