Once upon a time (cont.)

One thing that significantly improves image quality for the end-user is per-pixel atmospherics, again something that will become more and more recurrent in the future as the early Z-only pass is used for all kinds of neat effects.

Mike: Testing indicated the a z only pass did not prove to be a huge win, this is mainly due to the openness of the outside parts of our maps. We did, however find that the additive lighting method for the atmosphere light cost dearly on all but the high specification machines. This was mainly [due] to the complexity and number of texture lookups present in the Megatexture shader, in trying to solve this problem we tried a number of different approaches, the method we finally settled at (megadrawmethod 3) was to use a combined ambient and lit approach and introduce the shadowing via a multiplicative full screen pass. This is in fact not dissimilar from the dynamic shadowing method employed in quake 3 for characters.

The final result is not as correct an image but the gains allowed us to run on a significantly lower spec machine, the method effectively halved the amount of overdraw for a typical scene and at the same time reducing the number of batches required on average by a third. Megadrawmethod 0 was of course kept to allow users to enjoy the highest quality rendering where their machine is capable.

Atmosphere enabled

Atmosphere disabled

The final new graphical feature of note is the use of soft particles. This changes the alpha value of particle pixels as they approach solid surfaces so they aren't clipped abruptly. This has been supported by the game on the high end NVIDIA cards for a while but requires the latest AMD drivers because certain extensions are needed.

Arnout: Soft particles require a depth texture. There are several ways to achieve this. You could render the depth of fragments to a colour buffer during the initial depth pass, you could use an FBO with a depth (or depth/stencil texture as is more commonly used due to packing) texture attached, or you could do a straight texture copy from the main depth buffer. Because we already use the alpha channel of our main framebuffer, we'd have to switch over to rendering to an FBO to get a depth texture. Because we require a stencil buffer as well, GL_EXT_packed_depth_stencil would be required.

A downside of rendering to an FBO is that without GL_EXT_framebuffer_multisample you won't get multisampling. Besides that one you will also need GL_EXT_framebuffer_blit to resolve the multisampled buffer.

Many other non-graphics foundations were also changed. The built-in "boxes and ragdolls" physics engine was significantly improved especially to make it more network friendly. The networking code was also changed to reduce the amount of information being passed around, with Area of Relevance being the biggest change. In this system the engine will break networking traffic in a Level of Detail fashion not too different from what graphics cards do, with fall back positions of varying network fidelity as entities get farther away or occluded. The engine is also fairly threaded with many sub-systems like sound, bot A.I., MegaTexture and the renderer (with the 1.2 patch) operating on their own threads.

Click for a bigger version