Gamebryo Element

The engine supports pixel and vertex shaders in a modular fashion; that means the programmer can write a new mini-shader and the artists (or programmers) can combine several of those into a single object material. Here’s a very nice image showcasing Gamebryo’s out-of-the-box standard material. It illustrates how the object becomes more visually appealing after every shader module you add:


Some of the shader modules that ship with the engine are:

  • Normal and Parallax mapping
    • For a given material, the lighting will differ based on the polygon’s orientation, thus normal; the lighting can look like it was done with many more polygons when changing the normal per-pixel using a normal map texture, thus. This is a DX8-level effect; parallax mapping requires DX9 (or, arguably, DX8.1) and extends this by shifting the position of the perceived object slightly based on a height map.
  • Cubic (and spherical) environment maps
    • Cube maps are used for reflection and other similar effects; cubes have 6 faces, so the scene is being re-rendered from 6 different perspectives (or 5, if you don’t need the bottom or top one, because the reflector is a rectangle and you are above or below it). Remember your basic physics course and consider a ray getting reflected by water, towards one of the faces of that cube. You can then determine what pixel of the cube it hit, and that’s used to compute the final color.

      This can be generated every frame (dynamic; much more expensive; often done for water etc.) or it can be static.
  • Projected light and shadows
    • That’s traditional shadow mapping, although it wasn’t very clear to us what specific variant of it; so more about that in the interview. We’ll also consider doing an article exclusively on shadowing in general in the future, so stay tuned...
  • Toon shading
    • In order to give a toon-like look to shading, instead of running the normal lighting equations, a simple lookup in a table is done per-pixel based on the surface’s normal. Good values in that table will result in a pretty basic but effective cartoony look; to intensify that, it is also possible to intensify the edges with silhouette detection based on depth (distance) or the normal.
  • Dark maps
    • We thought this was like the anti-matter of light maps, and it turns out that’s pretty much the case – see interview for a short answer on the subject.

The scene could be rendered in either a normal frame-buffer, or an HDR one. If you are rendering things in HDR, then you also need to tonemap the scene based on its average luminosity, since nobody’s monitor is HDR yet. That’s a full-screen pass, which is done by rendering a single big rectangle (two triangles) over the scene.

Gamebryo also has with these other full-screen effects:

  • Blurring: Blur filters such as Gaussian ones could make the entire image blurrier, but that’s often not the goal, obviously – sometimes, you’ll blur exclusively the scene’s “over-brightness” to make the highlights look smooth with HDR; and sometimes you’ll do it on a per-pixel basis, for example with motion blur.
  • Night vision: While implementations vary (and we aren’t too sure of the one in Gamebryo), this is often done by just varying the colors based on a lookup table, to give more of a green/blue look to things. Some noise is likely added too.
  • Edge detection: As explained above, this can be combined with toon-style non-photorealistic rendering (NPR) for better results. You can say a pixel is on an edge when the depth and normals around it are highly irregular

There’s more to an engine than just what it can do with shaders though; for example, before DirectX 10, things like fog and alpha testing were done in the fixed-function pipeline. Many things which used to be done there are already in the pixel or vertex shader stages with DirectX 9, though. One example of this is texture coordinate animation. This is used for approximations of effects such as smoke, explosions or moving water (think rivers or waterfalls, for example).

Basically, imagine a texture which can be tiled (that means you can put it next to itself, and it won’t look wrong, only repetitive); if you scroll an infinitely tiled version of it horizontally or vertically, if it has the right properties, it’ll look like it’s actually moving. This is only a cheap hack, but it is basically free in terms of performance, so it’s an interesting trade-off if it looks “good enough”, or simply for last-gen games.