What Does DirectCompute Really Mean For Gamers?

DirectCompute Helps Enable Ambient Occlusion

The GPU’s ability to execute massively parallelized workloads has been amply discussed on Tom’s Hardware. CPUs and GPUs are simply suited to different types of applications as a result of their respective architectures. When you apply an effect to an image, for instance, that operation must be repeated to many thousands of pixel elements simultaneously. If you have a quad-core host processor and a graphics engine with 2000 ALUs, are there any guesses as to which approach has more potential to make efficient use of available compute resources?

In theory, this approach to processing can yield a significant bandwidth increase, since you're going to GDDR5 at up to 4 GT/s rather than system memory at 1600 MT/s or so, along with a massive boost to compute performance and performance per watt when the right algorithms are used. Also consider that, while the CPU remains superior to the GPU in many tasks, the resources and latencies required to communicate between both chips may incur more of a penalty than simply running some tasks entirely in the GPU.

Making use of this additional GPU potential requires additional software work. There are several ways to exploit the hardware's capabilities, and DirectCompute, part of DirectX, is Microsoft’s API that sits between the GPU and applications. In the past, we've covered how early efforts to leverage the general-purpose compute capabilities of the GPU benefited academic and vertical markets like research (think SETI@Home and Folding@Home), scientific modeling, and exploration. From here, GPGPU began to filter down into the consumer market, but only in a very few niches, especially video processing and transcoding. Now, we’re seeing DirectCompute and OpenCL fulfill additional roles. Game developers are starting to implement DirectCompute-based methods for improving rendering, AI, occlusion, lighting, and physics.

Using DirectCompute For Ambient Occlusion

One of the most popular uses of DirectCompute in gaming is ambient occlusion, a shading technology (originally developed by Industrial Light and Magic over a decade ago) that seeks to emulate how light interacts with surfaces and textures. Rays emanate from every surface, and those that reach the background contribute to the brightness of the surface, while a ray that strikes another object offers no illumination, having been absorbed. Thus objects surrounded by other objects are dark, and those with no nearby obstructions are brighter.

If you imagine a corner in a shaded alleyway, the corner will look darker to your eye because less light is able to penetrate into it and bounce out of it. The wall structures inhibit the light in that area apart from any shade from adjacent buildings. Ambient occlusion seeks to account for this sort of “light trapping.” Without it, illumination tends to look flat and artificial.

Gareth Thomas of Codemasters supplied us with the following captures from DiRT 3 to help illustrate. Note in particular the areas around the base of the tires.

“High-definition ambient occlusion is a screen space effect that takes the depth of the scene and computes a darkening factor based on whether that area is in a ‘valley’ or not from the point of view of the depth buffer,” explains Thomas. “For example, the crevices in between the tires in the screenshots should be darker because less bounced light can reach those areas. The HDAO provides us with a term that approximates how much bounced light each pixel can see. This is then incorporated into the lighting model when rendering the scene. It is not a perfect technique because the depth of the scene from the camera’s point of view is not really enough information to correctly calculate ambient occlusion. However, it is certainly better than not using an occlusion term.”

Create a new thread in the UK Article comments forum about this subject
This thread is closed for comments
No comments yet
Comment from the forums
    Your comment