Epic Diaries: The Samaritan

Epic Diaries: The Samaritan

By Mark Rein

June 28th 2011 at 8:00AM

Mark Rein explains what Direct X brings to the table for Unreal Engine developers

Epic recently presented what we would like to see in the next generation of games with our Samaritan real-time Unreal Engine 3 demonstration at the Game Developers Conference in San Francisco.

To take Unreal Engine 3 to the next level, we implemented DirectX 11 support along with NVIDIA’s APEX physics technology, and these features were made widely available in the March 2011 release of the Unreal Development Kit (UDK).

Commercial UE3 licensees have source-level access to these additions. Here’s a round-up of the DirectX 11 features accessible to anyone who downloads the latest UDK build from www.udk.com.

Bokeh depth of field (DOF)

Real world images captured with a camera lens often depict scenes with some parts more in focus than others. The out of focus objects form shapes, such as circles or pentagons, called Bokeh. Artists can control Bokeh shapes and textures in the UE3 post-processing chain.

Doing DOF as a post process works quite well for opaque objects, as each pixel has a depth associated with it.

Translucent rendering, however, cannot work well with a post-processing method. Ignoring the problem can result in translucent objects that are either too much in focus or too blurry, depending on their background.

We solved the problem by giving control over which translucent objects are affected by DOF within UE3’s material settings. Additionally, we’ve implemented new material node that allows artists to adjust shading by fading objects out or blending them to a blurry state.

Tessellation

Because the DirectX 11 tessellation pipeline is programmable, it can be used to solve a large number of graphics problems.

Tessellation works especially well for natural objects with medium-scale details, and UE3's material input enables developers to adjust geometry tessellation on both the edges and the insides of triangles. Tessellation amounts can be controlled by distance from a camera or setup to place more triangles along silhouettes.

A popular refinement algorithm, PN-Triangles, softens the look of coarse models. PN-Triangle tessellation mode smoothes hard edges, converting low-resolution models to curved surfaces, which are redrawn as a mesh of finely tessellated triangles. UE3 also feature support for crack-free tessellation and displacement.

Image-based reflections

Image-based reflections are a part of UE3's DirectX 11 rendering pipeline. This technique is used to render real-time whole scene HDR reflections as seen in Samaritan. The technique works by reflecting an image that is an approximate version of a scene at each pixel, which makes it more efficient than previous reflection techniques, such as planar reflections.

UE3 enables reflections on any surface with varying glossiness and blurriness. This is useful for visuals such as wet roads where puddles mirror reflections, while other parts of the road appear glossy.

UE3 also supports anisotropic glossiness, where reflections are streaked more in one direction, and dynamic components enable all parts of the reflection except for static shadowing to be changed at runtime. UE3 supports dynamic object shadowing as well.

Deferred shading

Deferred shading allows dynamic lights to be rendered much more efficiently. Traditional UE3 lighting is called forward shading because the dynamic lighting is calculated while rendering a scene’s meshes.

With deferred shading, material properties such as diffuse color are stored in render targets, called G-Buffers, while rendering the meshes in the absence of lighting. Later, in a deferred pass, each light looks up the material properties from the G-Buffers for a given pixel and calculates lighting based on that.

Lights rendered with deferred shading are about 10 times faster than lights rendered with forward lighting. In Samaritan, the opening scene had 123 dynamic lights, and all lighting was done using deferred shading except on character skin and hair.

Full scene anti-aliasing

UE3 supports full scene anti-aliasing in DirectX 11 through multisample anti-aliasing. MSAA is a hardware feature that shades pixels only once but evaluates the depth test multiple times per pixel. In UE3, deferred passes like lighting and shadowing work correctly with MSAA by detecting geometry edges and shading per-sample along those edges.

UE3 materials have a feature that multisamples the edges of masked materials. This is especially useful for creating realistic hair and foliage.

Screen-space subsurface scattering

Subsurface scattering refers to light that penetrates the surface of an object, scatters through its interior and exits at a different location. This is why subsurface scattering makes skin appear more luminous.

UE3’s subsurface scattering is a screen-space effect that blurs the light incident on the object's surface to other nearby points on the surface. The blur attenuates the lighting based on the world-space distance between the incident and exitant points to model absorption of light by the interior of the object.

For help getting started with these features, visit http://udn.epicgames.com/Three/
DirectX11Rendering.html