Starcraft 2: Technology and engine dissected
New details about the engine Blizzard uses for Starcraft 2 are available. So for example a Shader Model 2.0 graphics card is required in order to deal with the Deferred Renderer. The developers also say to stress the graphics card more than the main processor.
Starcraft 2 has to fill the shoes of the excellent but already ten years old predecessor and the Brood War add-on. Especially the graphics of the still very popular game are rather out of date when compared to modern games and Starcraft 2 is supposed to cut in right there, but Blizzard wants to get good performance even on older systems.
Some facts from the development document first:
• Up to 500 units (Peak!) with 1 million Vertices altogether displayed at the same time (Multiplayer)
• The engine offers a gameplay and a story mode
• More than 8,000 lines of unique shader code
• Shader Model 2 graphics card (Radeon 9800/Geforce FX) required for MRT support (Multiple Render Targets)
• HDR Rendering with MRTs in 16 Bit FP format
Requirements of the RTS game Starcraft 2
In a pdf document the developers reveal a lot of details about the Starcraft 2 engine. Accordingly, Blizzard is fully aware that in a real-time strategy game like Starcraft 2, the game mechanics and the simultaneous visualization of up to 500 units cause a high basic load for the CPU. Therefore they try to primarily stress the graphics card and not the processor with visual calculation. They especially kept an eye out for the minimization of the so called Batch-Count. Those geometry groups have to be calculated by the CPU one after another and thus can slow the system down if there are too many of them.
Thus Blizzard decided to use Deferred Rendering with a Multiple Render Target approach. Thereby the illumination information for all pixels is distributed and saved to the individual RGBA channels of the four MRTs - including the pixel depth (Depth Value), Per Pixel Normal, Ambient Occlusion Term and the unlighted Diffuse and Specular material colors.
Since a lot of information for each pixel is already stored in the MRTs, it's just logical to use it for additional effects. Lighting, volumetric smoke and fog, dynamic Ambient Occlusion and Depth of Field can be generated with the Depth Values while the Normal values can be used for dynamic Ambient Occlusion (see Mouseover picture); Diffuse and Specular texture values can be utilized for illumination.
The dynamic Ambient Occlusion (which can be switched off and replaced by pre-calculated versions) requires a lot of calculations. At first it has to be evaluated how strong or weak the occlusion effect has to be. Pixels in the middle of a smooth surface get less occlusion, pixels near to an edge, in corners of virtual objects or similar things, are darkened. Additionally 8 to 32 other pixels are accessed and their Depth Value is compared to the pixel which is actually worked on. Depending on how much those surrounding pixels are above the Z value of the pixel in question they affect the created shadow effect.
In order to appear realistic, the distribution of the samples has to be as coincidental as possible. To achieve this they are created form a 2D texture with 8x8 random vectors. This operation would overstrain every texture cache of the graphics card and thus is done with a decreased Z-Buffer value.
Later on the grainy pattern is removed via a Gaussian filter to receive a smooth transition.
In Story Mode the engine additionally offers a Blur effect to emphasize the dramatic effects of the simulated image focusing. The required calculations actually need Dynamic Branching so a Shader Model 3 graphics card would be necessary. But so that those players who have one of the widespread SM 2 cards can also play Starcraft 2, Blizzard decided to take a shortcut. Four pre-blurred pictures are, based on artificially defined focus points of the camera, calculated and a blurred-sharp-blurred transition between them is calculated.
Like every other Deferred Renderer, the Unreal Engine 3 or the X-Ray Engine of Stalker for example, the Starcraft 2 Engine also has fundamental problems with transparent objects. But since those transparent objects only play a minor role in Starcraft 2 and occur in rare situations only, Blizzard marked those few objects in the code so that normal "Forward” Rendering is used for them. This had been a more economic decision than developing a special render path for those objects.
Update:Starcraftwire.net informed us that they already featured an article which is, like ours, based on the AMD document. As it is written with a different focus, it offers additional information for those interested in Starcraft 2.
PC-Spiele 2016: Games-Liste mit Release-Terminen