Friday 1 February 2013

Warhammer 40k Dawn of war 2- Shaders and Lighting


Warhammer 40k: Dawn of War 2- Chaos Rising is an expansion to the Dawn of war 2 RTS released in March of 2010. In this game, humans in the future of 40k will face the horrors of thier brothers who are corrupted by the forces of Choas. With this game the shaders, and other effects enhance the viciousness of the game, while immerse the player in the world. 
One place where shaders are apparently used are whenever the forces of chaos destroy major structures. We can tell that this effect is done with applying shaders to 2 different types of simple 2d shape, a circle, and a skyward rectangle. For the skyward rectangle seems to use a similar effect to "the god ray", having a dissipating, strong ray. For the bottom circle, there seems to be a rotating "fog effect" which changes as the long as the effect remains to functioning. With these shaders, this makes the destruction of the building look that much more like the work of choas.

Playing through the game I wanted to see if character lighting/shadow was truly global, and if there were actual lights there in the scene. For this I did a simple experiment, as I found a simple light, the lamp post in the middle of the map, and moved some units on each side.
To the right of the lamp post
To the left of the lamp post
Unfortunately, after examining this, I can see character lighting isn't calculated on the fly, as other "light sources", such as the lamp, don't truly seem to influence the character's shadows. Though the lamp seem to just be a source of light, with glow. However the shadows from the light seems to be non-dynamic, as they're just baked into the environment.

Finally there seems to shaders with the explosions of the game, which is best demonstrated by a brutal artillery strike on my squad.
During the artillery strike

After the artillery strike
We can see the destruction of the ground, there are multiple forces which emphasize the destruction of the battlefield. The deformation of the ground is probably done by changing of the object's vertices and/or change in the normals, into craters, based on the force of the artillery shells which hit.  This is most likely done with a vertex shader, altering all the locations of the vertices and normals. Another effect would be the application of "burnt ground" textures on the these craters, based on where the shells hit, to give it a burnt feeling. However just with a simple texture would be too bland so there seams to the red marks of freshly scorched Earth done by shaders. Each shader seems to apply the this scorched earth in patches, of random size and density to the texture. As we learned, this is passing through the text coord, and color, which makes it a fragment shader.

In the end, these effects are done with shaders, and lighting, make the game feel that much more chaotic. Not only are theses effects possible for us to implement, but also they show us how these effects can add to the immersion of the game. With these effects I look forward to seeing what future RTSs will do, and trying to implement them in future projects.

No comments:

Post a Comment