Community Manager
| CryENGINE 3 Key Rendering Features
Crytek's Principal R&D Graphics Engineer, Tiago Sousa, takes us through a highly detailed and informative presentation on CryENGINE 3 and it's key rendering technologies...
1 Introduction
Crysis 2 posed one of the biggest challenges Crytek's R&D department has ever faced: develop a multi-platform engine and ship a game simultaneously on PC, Xbox 360 and PlayStation 3. After developing a cutting edge PC engine, having to re-adjust the technology to run efficiently on consoles, where memory is one of the biggest limitations, and maintaining scalability for the next engine iteration, was an incredible achievement. A huge engineering effort was required in order to run Crysis 2 on console hardware: a new streaming system, refactoring of many modules (physics, animation and renderer), low level CPU/GPU and multi-core optimizations, etc. This article covers a small subset of this amazing team effort, which made CryENGINE 3 and Crysis 2 run and look great on all main platforms. Hence, we will get into a couple of key rendering features that have made the difference.
2 Gamma Correct HDR Rendering
CryENGINE has supported High Dynamic Range since its first version. For CryENGINE 3, we added gamma correct rendering, among other changes in order to efficiently support each individual platform. The PC specs feature the best HDR quality available due to the general and fast support of FP16 render target formats.
One of the main benefits of HDR rendering is a much bigger color range and precision, which can easily prevent unattractive color clamping and banding visible in many current games. Those visual artifacts are usually a major issue for art departments using LDR rendering.
The following example illustrates an extreme situation with a dark foggy environment and a strong sun light, in both LDR and HDR rendering:
Notice the limited color range and obvious clipping in LDR: the highlights are clipped and the dark areas lack detail. HDR rendering also opens the door to a multitude of physically-based post processing effects, such as eye adaptation, bloom, flares/streaks, motion blur, depth of field, grain, etc.
3 Lighting
In CryENGINE 3, all lights are dynamic and deferred. Therefore, we have a very slim G-Buffer, composed of normals/depth, used later in the 3D pipeline for several purposes. The deferred lighting accumulation is done in HDR on all platforms. Among several techniques, every surface has reflection map applied to it through deferred specular HDR cube maps.
4 Shadows
Shadows are fully dynamic on all specs. A large view distance is used for the sun cascaded shadowmap. Shadows are updated every frame on PC and are amortized over frames on consoles.
On PC high specs, almost every single light projector or main light source casts shadows. On consoles, the amount of lights casting shadows is limited for performance reasons.
5 Screen Space AO and GI
Crytek’s invention, the SSAO, is back and improved using temporal accumulation for enhanced quality on consoles. On high specs, we also use full resolution target and a 2 layers approach for capturing high frequency detail normals. For the final lighting touch, we also use our own custom realtime global illumination solution in addition to standard deferred lights.
6 Deferred Decals
The deferred decals are memory-friendly (memory being the most important resource on consoles) and improve CPU/GPU performance. Another benefit is the superior projection quality. In essence, they work very similarly to light projectors and have comparable drawbacks, since handling moving geometry is troublesome and requires additional work.
7 Characters Rendering
Character rendering techniques taking advantage of deferred lighting on all platforms were researched and implemented, such as deferred skin rendering, hair and fur, eyes, cloth, etc. We developed the skin rendering with screen space sub-surface scattering and self-shadowing. The rendering cost is proportional to the amount of screen coverage from geometry versus the usual approaches using UV space sub-surface scattering. The latter adds an extra constant cost per-character and can be prohibitive for consoles, performance and memory-wise.
Another improvement is the alpha tested smoothing for hair rendering with anisotropic shading for all platforms. It avoids artifacts due to alpha blended approximation issues (for instance shadows and volumetric fog artifacts).
8 Water Rendering
This was primarily the same water rendering approach as in Crysis 1 (the different look is mostly due to cityscape environments instead of tropical environments). We use FFT based normal map using cheap parallax approximation for consoles, and vertex displacement mapping for PC specs. Currently, FFT simulation is done on CPU on its own dedicated thread.
We developed dynamic interaction with wave propagation on all platforms, using vertex displacement version for PC specs. It is worth mentioning that water wave propagation simulation is done on GPU with a cost of just 0.2 ms on consoles and negligible cost on PC specs.
Deferred caustics rendering on all platforms, and panoply of other effects from Crysis 1, like volumetric god rays, water droplets and foam, also made their way onto consoles.
9 Postprocessing
The camera motion blur was greatly improved over Crysis 1. For example, we no longer use the “sphere” around camera approach: we now do a proper re-projection. This allows for a far more accurate motion blur result based on how much a pixel has moved. Object motion blur is supported on all platforms as well as bokeh depth of field.
All post processes are done in HDR, before tone mapping. This allows us to retain bright streaks, which are not commonly used in current-gen games, besides Crysis 1. This is performed on every platform and implemented for optimal performance by batching all techniques in one, costing around 1ms on console platforms. For higher PC specs, we use FP16 formats with additional taps for improved quality.
10 Anti-Aliasing
Although many multiplatform engines often do not use AA on certain platforms, CryENGINE 3 uses a form of amortized MSAA reminiscent of OpenGL accumulation buffer approaches, called Post MSAA. Such an approach works by accumulating sub-samples over frames and reprojecting them to the current frame. It should not be confused with “temporal antialiasing” commonly used on 60 fps games that simply do a linear blending and hence have ghosting for every pixel. The Post MSAA approach is very general and allows for a sub-pixel accuracy solution on all platforms at a cost of just 1ms on consoles, and less than 0.2 ms on PCs at 1080p resolutions.
Due to its sub-pixel accuracy, it minimizes moiré patterns and visible shimmering on surfaces with high frequency characteristics (fences, grids, etc) commonly visible in EdgeAA/MLAA or similar techniques. It works on alpha tested geometry, and performs shader anti-aliasing i.e. on surfaces using Parallax Occlusion mapping, or similar aliasing prone techniques. It also performs post-tone mapping without damaging HDR quality on high contrast areas like regular hardware MSAA approaches.
Such a technique is quite a novelty in the video game industry and it’s very likely Crytek will release improved versions as it has potential to also be merged with different techniques - for example, it’s currently also combined with Nvidia’s FXAA in “Extreme” spec, in order to improve quality further with sub-pixel accuracy results from post MSAA.
11 System Specs and Colors
Besides resolution differences and a couple of custom view distances variations across platforms, we achieved an exact platform image color output on all platforms in the final shipped version of Crysis 2. Multiplatform games usually look “darker” on Xbox 360. This is due to the console hardware performing an additional TV gamma correction step, besides other details, when using gamma correction. Unfortunately this is not a standard; no other hardware does this, so we decided on matching X360 output to PC and PS3 platforms instead.
Any color/contrast/brightness differences are most likely due to an improper HDMI setup for the user's display. To ensure a correct set-up, the user can follow these simple steps:
1. If the TV supports HDMI 1.3 or higher:
- 360: pick “Expanded” in console dashboard display setup, in reference levels
- Ps3: enable “RGB full range” in console display setup
- If incorrect settings are used, the brightness calibration icon might be always visible (too bright), resulting in a lack of contrast (insufficient darks) and visible (color) banding. This very likely also means the TV does NOT support HDMI 1.3 and higher, or is not properly detected by hardware.
2. If the TV does not support HDMI 1.3 or higher:
- 360: pick “Standard” on console dashboard display setup, in reference levels
- Ps3: disable “RGB Full range” in console display setup
- If the user has the wrong setting, the brightness calibration icon will always not be visible, or almost invisible, resulting in crushed darks.
3. Another common mistake from users is not picking the correct resolution to match the display's native resolution, resulting in an additional image upsample from the TV. If the display monitor's native resolution is 1080p, the user should pick it as default on either XBox 360 or PS3.[/list]
12 Sys Specs and Performance
Although it is common practice for multiplatform engines to disable certain rendering features depending on hardware strengths or weaknesses, in CryENGINE3 most rendering code is designed to be general, shared and optimal for consoles. For example, all post processes use exactly the same code path. We also scale the quality up for higher PC specs. Due to a lot of hard work and heavy optimization on GPU/CPU side since Crysis 1, every spec on PC should mostly play at 60 fps at 1080p assuming the user selects the right sys spec for his machine and has a fast enough CPU.
In Crysis 1, a relatively brute force approach was used, where all features on lowest settings would be completely turned off, including HDR rendering, shadows and all post processes. Users were also forced to use lower resolutions for improving performance, which meant a lot of our low end hardware owners would not be able to achieve a decent visual experience of our game at good frame rates. Running Crysis 1 at HD resolutions on highest end hardware in 2007 was simply not possible.
This time around, throughout the entire project, we dedicated a lot of effort to optimization. All features are present across all system specs, including HDR rendering, shadows, motion blur, SSAO, Depth of field and post MSAA. Anisotropic filtering is also used on every system spec, and users can now experience a great gaming experience at 60 fps on PC at HD resolutions, including stereo mode. It should be noted that most other games rely on having completely pre-baked lighting, no HDR rendering and dynamic shadows limited to a few items such as characters, in order to offer a 60 fps experience.
This effort made our lowest specification equal in many aspects and even superior to CryENGINE 2 High specs. The biggest differences from Crysis 1 to Crysis 2 are the vastly improved dynamic lighting and shadowing and highly improved image quality. For this reason, the lowest available spec on PC in Crysis 2 is “High Spec” and the highest spec is “Extreme”.
With higher system specs, more samples or high resolutions are used on certain effects like shadows/post processes/MSAA. Certain features get enabled such as rigid body water simulation or vertex displacement for water. On higher PC specs, we naturally find much more lights casting shadows, more particles and higher view distances for all geometries, lights and shadows.
13 PC vs. Consoles
The lowest PC spec, “High”, is almost the same as the spec used on consoles, besides per-platform differences, such as different texture formats for render targets and different normal map formats on PS3 due to lack of 3Dc support. PC specs also feature improved texture quality, since we do not use streaming for PC due to the vast memory resources available. Anisotropic filtering is enabled for all specs, while on PS3 it is dynamically adjusted and goes up to 16x anisotropic, and on Xbox 360 it is limited to 4x anisotropic in order to reduce the performance cost.
14 Stereo Rendering
On consoles, CryENGINE 3 supports a performance-optimal approach for Stereo, based on depth reconstruction, which allows us to maintain visual quality without having to dramatically decrease the resolution and the rendering view distances, as seen in many other recent console games.
Due to such increased quality on consoles, and with a careful setup of the 3d HUD and a wide range of stereo settings, we provide one of the most comfortable stereo experiences available on the market. Most players will be able to play continuously without eye straining, compared to other techniques which rely on drastically decreasing the image quality. Additionally, the engine supports real dual stereo (also anaglyph mode for debugging), which is likely to be exposed for Crysis 2 in later patches for PC specs.
15 Pushing the Limits
It should be noted that many of these key features are novelties for all platforms and were invented and iterated already by the end of Crysis 1's development (2007): screen space scattering and self-shadowing, PostMSAA (every marketing screenshot features it), deferred caustics/rain approximation, realtime GI, Stereo Rendering, alpha test smoothing, batched HDR post processing and of course our famous SSAO which gave birth to a multitude of screen space algorithms like SSGI/SS Reflections and similar. More in depth technical details will very likely be revealed in the upcoming months.
There are obviously many other important features that contributed to Crysis2 from a performance perspective. Our GPU based occlusion buffer and conditional rendering allow us to significantly reduce the amount of drawcalls on consoles, thanks to a lower GPU and CPU overhead. Crysis 2 also includes all the other well known features from CryENGINE 2, such as our Time of Day system combined with our volumetric fog. New visual features like the HDR flares/streaks, the color grading, the multiple shading models support or the post-processed HUD also helped improve the look of our graphically acclaimed Crysis 2 title.
16 Conclusion
The key rendering features showcased in this article are the result of almost three years of extremely hard multiplatform development, involving a lot of nights and weekends spent at the office for many of the Crytek team members. We hope that literally everyone, on any console platform or any PC spec, will appreciate the end result of our efforts as much as we enjoyed working on our latest game and engine iteration. All of these features are about to be made available to our engine licensees in CryENGINE 3.3.
A big thanks to the entire Crytek team, especially our great R&D graphics programming team, and everyone that contributed to this short but hopefully insightful article; to Michael Endres, Martin Lancaster, and in particular to our Lighting Artist Pierre-Yves Donzallaz for his helpful article review, awesome screenshots, and for always showing our technology in the best possible light.
Tiago Sousa,
Principal R&D Graphics EngineerThis post has been edited 1 time(s), it was last edited by Cry-Adam: Today 13:25. |