Introduction
While gamers are highly anticipating the imminent release of upcoming titles Doom III and Half-Life 2, CryTek has been quietly plugging away on their CryENGINE that powers Far Cry, which is probably the most highly acclaimed PC title of 2004 to date.
At the beginning of this month we learned more information about CryTek’s shader model 3.0 implementation in Far Cry 1.2, which includes static branching and geometric instancing. Later we learned that CryTek also plans to add high dynamic range (HDR) lighting and ATI’s 3Dc to Far Cry 1.3. This news in particular surprised many, as it was widely assumed as one of NVIDIA’s launch partners for GeForce 6800 and shader model 3.0 that CryTek wouldn’t be in a rush to include support for features that were exclusive to ATI hardware until they became open standards, or it was absolutely necessary. It turns out that not only was this assumption wrong, but it was just the tip of the iceberg, as CryTek has gone back and added many of the same improvements we saw for GeForce 6800 to ATI’s DX9 hardware!
New rendering paths
In addition to adding shader model 3.0 support to Far Cry 1.2, Crytek added a second new rendering path for ATI’s X-series products: pixel shader 2.0b. If you recall the X800 launch, shader model 2.0b was added to the DX9 spec to expose its unique new abilities. ATI refers to them in marketing speak as “DirectX 9 Extended Pixel Shaders”. The chief improvement in 2.0b is increased instruction count, which goes from 160 instructions in RADEON 9800 to 1,536 in 2.0b. ATI has also increased the number of temporary registers to 32 (from 12 in 2.0) and added a facing register.
For ATI X-series owners, Crytek has integrated a variant of one of their key additions in Far Cry 1.2, using PS3.0’s increased number of interpolated registers and static branching to collapse multiple lights into one pass, to achieve the same result on ATI’s cards via 2.0b.
CryTek uses longer, more complex shaders in the X800’s pixel shader 2.0b path to essentially achieve the same result as PS3.0. One slight difference between the lighting engine in Far Cry 1.2’s shader model 3.0 path for GeForce 6800 cards and the 2.0b path for ATI X-series cards is that the ATI cards are limited to up to three lights per pass, while GeForce 6800 can handle up to four. (In shader model 2.0 cards were limited to one light per pass.) According to ATI, “It is possible, with a bit of extra work, for four lights to be calculated in a single pass on ATI hardware, but Crytek has not made the changes that would enable this.”
Besides adding multi-pass lighting for ATI X-Series hardware, CryTek has also added geometry instancing. As we discussed in our Far Cry Performance Part 3 article, this is helpful for rendering multiple examples of the same type of object. In the case of Far Cry, this is used for generating strands of grass, trees, and other types of jungle foliage. Rather than having to upload each of these objects individually, with geometry instancing multiple objects can be created from one geometric model. This reduces the amount of vertex data that must be sent to the graphics core, enhancing performance.