PDA

View Full Version : Graphics engine technology



sebastianaalton
04-05-2008, 09:37 AM
Trials 2 Second Edition is the first game released using our new high end deferred rendering engine. This rendering engine is build on top of our multiplatform MT game development libraries and tools. MT game development libraries and tools are also being used on our last game Warhammer 40K: Squad Command, released simultaneously on Sony PSP and Nintendo DS just before last Christmas (2007).

Index:
1. Deferred rendering technology
2. Per pixel realistic phong lighting
3. Advanced per pixel material system
4. Parallax mapping and relief mapping
5. Realtime shadows from all light sources
6. High dynamic range (HDR) rendering and light blooming
7. Motion blur
8. Camera depth of field
9. Volumetric soft particles
10. Screen space ambient occlusion
11. Character and object animation

sebastianaalton
04-08-2008, 06:51 PM
1. Deferred shading technology

Our new graphics engine is a full deferred shading engine. All geometry data (polygons) are first rendered to a screen sized geometry buffer (one geometry pixel per one screen pixel in the final image).

For each pixel, the geometry buffer includes:
- Depth: How far the pixel is from camera
- Normal vector: The pixel surface "direction" in camera space
- Motion vector: How fast the pixel is moving (used in motion blur)
- Material properties: Glossiness, specularity, ambient occlusion and emissive (self illumination)
- Color: The color of the pixel when fully lit
- Lighting shader selector: Stencil buffer bit mask used for lighting shader selection

After all the polygon data has been rendered to the geometry buffer, the engine runs all lighting shaders and post process shaders using only these screen space geometry buffers. No scene polygon data, material data or texture data is needed anymore. This way the scene polygon complexity does not affect the performance of the lighting at all, and the amount of lights does not affect the polygon rendering performance at all. This allows us to render both higher amount of polygons and lights that would be possible with a normal direct rendering architecture. Also deferred shading makes shader management much more straight forward and implementation of many post process filters much more efficient.

External links about deferred shading technology:
GDC technology whitepaper (Shawn Hargreaves): http://www.talula.demon.co.uk/DeferredShading.pdf
Killzone 2 (Guerrilla Games / PS3): http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf

sebastianaalton
04-08-2008, 06:52 PM
2. Per pixel realistic phong lighting

In our engine, the whole lighting equation is done for each visible pixel. Nothing is precalculated or done at vertex level only. This results in smooth real looking phong specular reflections on all surfaces (even those with low polygon count). All surface normal vectors are calculated using high precision tangent space normal maps, calculated with industry leading tools.

External links to phong lighting articles:
Source engine phong shading (Valve): http://developer.valvesoftware.com/wiki/Phong_materials

External links to normal map generation tools:
Polybump (Crytek): http://www.crytek.com/technology/cryengine-2/specifications/
ZBrush (Pixologic): http://www.pixologic.com/zbrush/

sebastianaalton
04-08-2008, 06:52 PM
3. Advanced per pixel material system

Most materials in last generation games had only one 3 channel (RGB) texture map associated to them (for material color), and all other customizable material properties were defined for the whole material surface. Because of this, the whole material surface reflected light identically and this caused games look really plastic and unrealistic. In our new engine we have 13 high resolution per pixel material property channels associated for each material. The graphic artist can define each material property in pixel perfect manner.

List of material properties adjustable in pixel precision:
- Color
- Normal vector (surface pixel direction)
- Height (for displacement mapping, parallax mapping and relief mapping)
- Glossiness (how sharp/blurred specular reflections are)
- Specularity (how much light is reflected)
- Diffuse (how much light is scattered)
- Emissive (how much the pixel glows/emits light)
- Ambient occlusion (how much ambient surround lighting is applied)
- Opacity (how transparent the pixel is)

List of material properties adjustable in material basis:
- All above realtime adjustable (pixel values multiplied by material value)
- Lighting shader selection (for material specific lighting formulas)

All this data consumes huge amount of memory when uncompressed. Our custom compression method cleverly utilizes various existing hardware compression methods to store all this data to the minimum storage space possible while also keeping the quality as high as possible and minimizing any bad compression artifacts. Artists can also customize the compression quality using our content manager and material editor.

[TODO: Add link to some material creation tutorial. Maybe Sipe knows where to find one]

sebastianaalton
04-08-2008, 06:52 PM
4. Realtime shadows from all light sources

Most current generation games use mostly static precalculated lighting, and the only realtime shadows are the "fake" directional shadows projected from the direction of the brightest light source. This looks pretty good on outdoor scenes, as the sunlight is so much brighter than other light sources. You don't notice the missing shadows from explosions and other smaller light sources so easily. However in indoor scenes where the sunlight does not affect, this kind of realtime shadowing system looks pretty bad (Mass Effect character shadows are a good example).

The deferred shading allows our engine to render very high amount of simultaneous light sources in one scene. We wanted each light to cast proper shadows as well... actually we wanted to only light the pixels visible from the light, and skip all others. Our shadowing system actually decreases the lighting pixel shader workload, as the occluders block light and the each light affects less pixels.

Unlike most other games, we do not draw shadows on top of our scene. We calculate each light to the pixels visible to that light and add the brightness of each light affecting the pixel together. This produces physically correct outcome that looks much more natural than the usual "fake" darkening shadows. And our method has no flaws such as the usual double shadow darkening and incorrect specular reflection darkening.

All our shadows and lighting is calculated dynamically on realtime. Every object can animate or break into pieces and we can add and remove any amount of objects from the scene as we please. Sadly Trials 2 Second Edition does not have that much object and light animation, so it's not that good technology demostration for our fully dynamic lighting and shadowing technology. But future games we release will surely utilize the engine better.

[TODO: Add links to realtime shadowing whitepapers]

sebastianaalton
04-08-2008, 06:53 PM
5. Parallax mapping and relief mapping

Parallax mapping is a highly advanced version of normal mapping. Normal mapped surfaces only look bumpy when you look straight towards them, but the effect quickly vanishes when the angle to the surface gets smaller. Parallax mapped surfaces keep the real 3d look much longer when angle between the watcher and the surface decreases.

In addition to per pixel normal map, parallax mapping uses a per pixel height map to simulate the surface bumpiness. Parallax mapping has it's roots on old 2d sidescrolling arcade games. The nearest background layers move the fastest and the furthest move the slowest. This creates a illusion of depth while in reality there is none. Parallax mapping is a hypercharged version of this old trick, transformed into 3d graphics.

Relief mapping takes all this even one step further. Like parallax mapping it also uses a normal map and a height map as the data inputs. However the surface detail is ray traced using the heightmap instead of just applying a parallax shift. This produces real pixel perfect geometry according to the heightmap surface variations. Trials 2 SE v1.06 does not yet have relief mapping support, but it's going to be released in a future patch.

Many new high end games released this year are using parallax mapping. Relief mapping and similar techniques based on raytracing are currently only used rarely, because of their very high GPU usage. I only know about 2 games using technique like this: Crysis (in ultra high mode only) and Unreal Tournament 3.

External links to parallax mapping:
Whitepaper (Terry Welsh): http://www.cs.cmu.edu/afs/cs/academic/class/15462/web.06s/asst/project3/parallax_mapping.pdf
Irrlicht: http://www.irrlicht3d.org/pivot/entry.php?id=6
Youtube video: http://www.youtube.com/watch?v=9gjgbp7LhM0

External links to relief mapping and similar techniques:
Whitepaper (Fabio Policarpo): http://www.inf.ufrgs.br/~oliveira/pubs_files/Policarpo_Oliveira_Comba_RTRM_I3D_2005.pdf
Youtube video: http://www.youtube.com/watch?v=SDLdToWFTeM
Youtube video (Unreal Engine 3): http://www.youtube.com/watch?v=Y_XmxdM4CXQ

sebastianaalton
04-08-2008, 06:53 PM
6. High dynamic range (HDR) rendering and light blooming

sebastianaalton
04-08-2008, 06:53 PM
7. Motion blur

sebastianaalton
04-08-2008, 06:53 PM
8. Camera depth of field

sebastianaalton
04-08-2008, 06:54 PM
9. Volumetric soft particles

sebastianaalton
04-22-2008, 06:10 PM
10. Screen space ambient occlusion

sebastianaalton
04-22-2008, 08:56 PM
11. Character and object animation

Our engine supports wide array of different animation techniques. All object properties can be animated dynamically or by using stored keyframe animation. Single animation data can be used with different bone layouts (in Warhammer 40K Squad Command many completely different units used the same animation keyframes) and unlimited amount of animations can be blended together (with user defined blend weights). Our animation tools compress the animation keyframes using advanced compression methods (reducing the data size on average to less than one percent of the original uncompressed size).

Skinning and other vertex based animation is completely shader accelerated.

sebastianaalton
04-22-2008, 08:58 PM
[UNDER CONSTRUCTION]

sebastianaalton
04-22-2008, 09:01 PM
This technical document is still under construction. I will add the rest of the topics during this and next week. If you find any typos or mistakes or would like to have a more specified description of some technology, please post in this thread or PM me.