The Making of Crysis 2
Digital Foundry talks with Crytek on Crysis 2, CryEngine 3 and beyond.
Glück points out that while the approach for Xbox 360 was very similar to the multi-core implementation on PC, the PS3 required some special effort.
"Lots of tasks need to be spawned to run on the SPUs whereas on Xenon you have three cores each with two hardware threads. Therefore we re-factored the computational-intensive parts to run as tasks or as threads capable of spawning many tasks," he explains.
"We also implemented special tricks like fibres to run two threads extremely efficiently on a single hardware thread. The PC gained scalability from that as well, running on quad-core is much more efficient than on a dual-core. But in the near future the engine will be even more task-orientated to scale on arbitrary core numbers."
As regular Digital Foundry readers know, a typical approach from Sony first-party developers is to offload graphics processing tasks from the RSX onto the SPUs, effectively running Cell (or at least a percentage of its available resources) almost like a video co-processor. However, the approach with Crysis 2 is quite different, with RAM limitations being the primary issue.
"The SPUs do indeed allow for easing the workload for the RSX. We decided not to go too crazy in this direction as it requires render targets and assets to reside in main memory. We are able to run skinning for example on SPUs as well, but we could not afford the additional memory required in the end," Glück explains.
"It is possible to use the SPUs to support deferred shading, run post-process effects and do triangle culling. But again, it all requires main memory we did not have as our levels are fairly large compared to other games and our SPUs were in fact pretty loaded with particles, animations, physics, low-level rendering and culling already."
Probably the most obvious visual difference between the Xbox 360 and PlayStation 3 versions of Crysis 2 comes down to a difference in basic resolution. Neither game operates at native 720p, with each version using a different framebuffer implementation based on the strengths and weaknesses of the hardware.
"The 1152x720 resolution on 360 simply allows you to maximize eDRAM usage on a deferred lighting engine without having to resort to tiled rendering," says Tiago Sousa.
The process of 'tiling' the Xbox 360's framebuffer means that the image is divided up into two or more tiles, and any geometry that bisects, say, two tiles needs to be processed twice, sapping performance. Keeping to a single tile streamlines performance.
"On the PS3, due to the extremely limited system memory we resorted to downloading memory into video memory," Sousa continues, explaining notes left in the PS3 config files saying that the resolution downgrade saved a relatively immense 14MB of RAM.
"We bumped into severe video memory limitations, so it was a good compromise to save a big chunk of video memory for other usages. Plus, while on consoles we are CPU-bound during combat due to physics, AI, etc, on less intensive situations on the PS3 we are GPU-bound, so the additional quick 10 per cent performance gain was also very welcome."
Sousa's information on the make-up of Crysis 2's processing seems to tie in quite nicely with the results of our performance analysis. We see an Xbox 360 advantage in scenarios where graphics processing is taking centre stage, but in situations where the CPU is really being stressed (for example, during combat) performance seems to hold up better on the PlayStation 3 version of the game.
However, while there are differences in the final versions on all three platforms, the commonalities are legion, and CryEngine 3 implements a range of new effects and visual techniques that weren't available in earlier iterations of the tech. In this sense we are seeing a key technological progression from the core engine that powered the original Crysis.
"From a graphics programming perspective, firstly we switched to a gamma correct HDR rendering, which is the main reason our final lighting result looks so good on every single platform," Sousa enthuses.
"Then the lighting system was completely revamped; there was simply no way to achieve the same results (at interactive frame-rates) with CE2, especially at HD resolutions. We can have many, many more light sources in a scene. We also introduced deferred cube map probes, meaning we can now literally have every surface with HDR reflections. This is something we never had in CE2 and finally introduced for CE3.
"Besides a lot of other significant changes, the aforementioned developments are the main reasons for an increased speed in workflow from an art developer perspective. Art doesn't have to care much with texture/lighting/fog/etc precision issues like in old school LDR rendering engines, or spend time pre-baking lighting at all."
Crysis 2's visuals on console really are miraculous. Crytek has managed to deliver a release worthy of its heritage across three very different platforms.
"We learned a lot with the consoles, especially how to make smarter and efficient usage of scarce rendering resources. In Crysis 1 times, our attitude was, 'oh what the heck, what's one more additional full resolution FP16 target or a couple of full-screen passes, let's just add it.' You can't take such a naive approach for consoles," Sousa says, harking back to the 'open spec' he had to play with on the previous PC-only Crysis titles.
"We could have gone the easy way and simply disabled features for consoles and lower-spec machines, but this time around we wanted everyone to experience our game in the best possible way their favourite system allows. We spent a huge amount of time refactoring, optimising and balancing our rendering pipeline in order to maximise GPU performance for every system."
The optimisations necessitated by the migration onto consoles also ensure a good experience on PC too. A base-level quad-core CPU in combination with the classic NVIDIA GeForce 8800GT - astonishingly - still manages to provide a smooth, responsive experience. While we were producing our Crysis 2 PC tech comparison, one our colleagues in Germany running with a Q6600 and Radeon HD 4850 commented that the game was actually running smoother for him than Bulletstorm.