What 'optimization' really means in games
Durante talks to game developers and digs into the nitty gritty of what makes PC games well optimized.
High-end effects and their performance impact
If you aren’t getting the performance you expect out of a game, there’s a good chance one of these settings is to blame. These are the biggest obstacles to smooth performance, and should be the first you adjust to hit that 60 fps target.
Image quality
Perhaps the single most performance-intensive setting is also very easy to factor into optimization comparisons: rendering resolution. Since it generally boils down to just two numbers (like 1920x1080) and is available across almost all games, comparing at the same resolution comes naturally. An important fact that sometimes gets overlooked is that rendering effort scales with the number of shaded pixels—4k is roughly four times as expensive as 2k, not two times.
Anti-aliasing is a far more complicated topic when it comes to comparability. In a modern game you might find any of the following:
- Pure screen-space methods, like FXAA or SMAA (1x). They look at the final rendered image and try to find and mitigate aliasing artifacts like stair-stepping using post-processing.
- Temporal accumulation anti-aliasing methods. They render the image at slight offsets each frame and accumulate the results while trying to compensate for movement.
- Multisampling (MSAA) at various levels involves taking multiple samples per pixel at polygon edges.
- Supersampling (SSAA) at various levels uses multiple samples for all pixels.
- Combinations of the above (e.g., TXAA).
These are listed above in ascending order for their expected performance impact, except for the combination category which depends on the cost of its components. Screen-space methods are generally cheap, pure temporal accumulation is only slightly more expensive, followed by multisampling and finally supersampling. Multisampling presents particular difficulty in performance comparisons, since its cost in performance can vary significantly based on the implementation, from very cost-effective all the way to close to supersampling. Supersampling is relatively easy to relate to resolution: Nx supersampling is similar in cost to rendering at an N times higher resolution.
Lighting and shadowing
Surfaces and atmospherics realistically responding to light form the basis of 3D graphics, and at the same time its holy grail. More complex effects are continuously being developed, and given the fidelity available today, further visible improvements often come with a significant performance cost.
The biggest gaming news, reviews and hardware deals
Keep up to date with the most important stories and the best deals, as picked by the PC Gamer team.
In terms of lighting, almost anything that bills itself as volumetric or an approximation of global illumination is often justifiably expensive. This includes high-end implementations of so-called god-rays, which try to replicate the effect of bright light illuminating airborne particles or dust in front of a darker backdrop.
Where there is light, there should be shadows, but sadly this does not occur as naturally in games as it does in the real world. In modern games, there are usually at least two sources of realtime shadows: ambient occlusion, which tries to account for overall reductions in illumination usually based on close-range surroundings, and direct shadowing.
Ambient occlusion, when it was introduced in Crysis, was a significantly expensive effect all by itself. These days, high-quality screen-space ambient occlusion is no longer a huge performance drain. However, new techniques such as voxel ambient occlusion or occlusion based on distance fields, which set out to fix issues inherent in screen space methods, once again come with a significant performance impact at this point in time.
With direct shadows, contact hardening is a difficult effect to replicate in games. This describes the fact that shadow outlines appear sharper and more defined close to the shadow caster, and progressively softer the further the point where the shadow is cast moves away from it. There are a number of different implementations of this behaviour around (e.g., PCSS), but it’s never a cheap effect to replicate.
One important thing to remember when discussing optimization: everything that responds to unpredictable realtime changes—lights moving or changing intensity, players moving, or in the worst case even the terrain being altered—is far more performance intensive than light behaviour and shadows that can be precomputed. If a game has dynamic daylight cycles or terrain deformation, that needs to be heavily considered when discussing the performance of its lighting and shadowing solutions.
Miscellaneous effects
A photographic example of the type of faint reflections often approximated in screen space. Note the contact hardening.
Many other effects that do not fit into either category above relate to simulating the optical behavior of a camera system. These are often not too performance-intensive, with the exception of high quality bokeh depth of field effects. The blurrier an out-of-focus part of the image should be, the higher the potential performance cost.
A relatively recent development often encountered together with Physically-based rendering (PBR) are screen-space reflections. These are less expensive than traditional reflections, which would require rendering large parts of the scene again, but can still have a significant performance impact. This is doubly true if they simulate advanced characteristics such as contact hardening.
Finally, there is a category of effects related to physical simulation, which can cause a significant computational burden on either the CPU, the GPU, or both. For non-gameplay purposes this is most common in the case of hair and cloth simulation, followed by the simulation of fluids, gases, debris, and their dynamic interactions.