Anatomy of a Scene

Posted by unknownworlds 13 years ago

Two weeks ago we we posted some screen shots of the new marines in Natural Selection 2. We were really happy to hear the overwhelmingly positive response to the new marine design.

There were a lot of comments and questions about the renders we posted, so this week I put together a video to show all of the components that make up the rendering system in our engine.

Here’s what you’re seeing in the video:

Wireframe – This shows the geometry that make up the objects visible in the scene. Here you see about 100,000 triangles. Each marine has over 13,000 triangles!

Normal Map – In addition to all of the geometric detail in the models, we get even more detail by using a normal map. The normal map causes flat triangles to be lit as if they were actually more complicated surfaces (here’s a good explanation from our friends at Wolfire). For our models, we generate the normal maps from incredibly high polygon meshes.

Texture Map – The texture map is a hand painted image that specifies the color of the models.

Specular Map – The specular map is also hand painted and tells the rendering engine how shiny the surface is and what color the reflected light should be. For metals this is typically similar to the surface color. For the skin, we use a blue tint to counteract the warm tones of the texture and give the result cool white highlights. The cloth parts are completely black so that they won’t be shiny in the final image.

Gloss Map – The gloss map also helps define the shininess of the surface, but in this case it’s how smooth the material is. For a really smooth surface – like a pool ball – the highlights will be very tight, but for rough materials it will be broad. There isn’t too much detail in the gloss map because this effect tends to be fairly subtle.

Lighting – To determine how bright each pixel in the final image will be, the rendering engine computes a number of lighting passes. Each pass uses the normal, texture, specular and gloss maps to figure out how much light is reflecting off the surface and entering the camera’s lens. Here we’re just showing the lighting passes without the influence of the texture map for clarity. Shadow maps are also used to determine which parts of the scene should be in shadow, although not every light casts a shadow for efficiency.

Ambient Occlusion – The rendering engine applies a screen space ambient occlusion technique to add even more shadowing detail. Ambient occlusion is a measure of how much light from the environment is blocked by nearby surfaces. We use a simple approximation to darken the crevasses that aren’t handled well by the shadow mapping system. The ambient occlusion is applied as a darkening effect over the final lighting; this isn’t physically based, but gives us the results we’re after.

Combined – Here the lighting and texture mapping are shown combined. In practice this is actually done during the lighting passes.

Atmosphere – The atmosphere pass simulates the effect of light hitting tiny particles in the air (here’s another example). This has become one of the "signature" effects of our rendering and you can see it put to extensive use in our other videos.

Color Grading – Also called color correction, color grading is the process of adjusting the brightness, contrast, color levels, etc. of the final image. This gives a lot of control over the scene that can be difficult or impossible to achieve by tweaking the lighting and texture maps.

We hope you’ve enjoyed this "under-the-covers" look at our engine. You can also see our rendering engine at work (with motion blur!) in the teaser video we released on the main site.

Comments are closed.