December 16th, 2010
I haven't had time to write any new tech posts during the rush to get the gameplay structure in, but for now I decided to consolidate some previous tech posts into an overview of core rendering in Overgrowth. If you're new to the Wolfire blog, this should be a good intro to the Overgrowth graphics technology!
Since the game primarily takes place outdoors in open environments, I really wanted to capture a natural feel to the graphics. To achieve this I made some decisions that are not appropriate for many other games, like using a forward renderer and baked shadow maps. There are trade-offs to these decisions, but I think they are worth it to give the game its distinct look.
Land and skyThe base for every scene is the land and sky. The sky is based on a panoramic photo, which is converted to a skybox at run-time. The terrain is based on a heightmap, which is then simplified using quadric error metrics and divided into patches for frustum culling. Finally the terrain and sky are combined into a new skybox, and the edges of the terrain are faded to blend in. This new skybox is then blurred to use as a lookup for lighting and fog color. The terrain also has four normal-mapped detail textures, which are blended based on a weight map, and automatically tinted to match the base color map. The detail textures fade away in the distance to avoid any visible tiling, but the heightmap normal mapping keeps the large-scale detail. This same technique is also used for some large objects, like buildings, cliffs and boulders.
ShadowsThe shadows for the environment are created by supersampling traditional shadow maps on the GPU. Ambient occlusion is baked by accumulating shadows from 200 different directions, so it is a lot slower to bake, but does not have to be rebaked when the lighting changes. Character shadows are created dynamically using the traditional depth map technique, but it reads the environment shadow when it's projected so that it doesn't darken areas that are already in shadow. Similarly, when the environment shadow is read, it is also projected back onto the character, so the baked environment shadows are actually cast back onto his body.
LightingTo light objects, the diffuse and specular components are calculated, and then added together. The diffuse and specular components are divided further into direct and ambient components, which are modulated by the baked direct and ambient shadows. The direct components are calculated using the standard NdotL and half-angle methods, and the ambient components are calculated using lookups into the blurred skybox textures. The weighting of the direct and ambient light can be controlled by 'scaling' the sun, which controls how concentrated its light is. Because of the forward rendering, different materials can have special effects like translucency and rim lighting, for example to make fur light up around edges.
Checklist featuresThe rendering also supports many standard checklist features like soft particles, imposters, gamma correct lighting, post processing shaders, automatic texture atlases, and instancing. A number of the traditional techniques have a bit of a twist in Overgrowth, for example, some normal maps have been softened to simulate translucency (such as grass and fur), and the lens flare is based on the anatomy of an eye rather than a camera.
I should have a chance to write some new tech posts soon, but I hope this helps new subscribers catch up for now!