How Sony Santa Monica mastered PlayStation 3
From the archive: the inside story on God of War tech - updated with a PS3 vs PS4 GOW3 performance test.
We're currently working on our analysis for Sony Santa Monica's remastered edition of God of War 3 for PlayStation 4, but in the meantime we thought we'd republish our original tech interview with the team, produced in the wake of God of War: Ascension's release and covering the development of both of Kratos' PS3 outings. Originally, this piece was published with a frame-rate analysis video of the spectacular opening level of God of War 3 on PlayStation 3. We've swapped that out with a new performance test, featuring both PS3 and PS4 versions of the game, compared head-to-head. That 1080p60 remaster we discussed with SMM at the end of this article, almost two years ago? Well - there it is.
As we reach the end of the current-gen console era, it's safe to say that it is the difficult, flawed, but ambitious PlayStation 3 that has offered up the most technologically advanced console games of the age. The complex hardware set-up may have banjaxed even the best third-party developers in its early years, but PS3 owners have been spoiled by a range of state-of-the-art gaming epics from Sony's own in-house studios - foremost amongst them, God of War creator Sony Santa Monica.
God of War 3 was a watershed moment in the history of the PlayStation 3. At the time, few believed that Naughty Dog's Uncharted 2 could be matched or even bettered in terms of sheer technological accomplishment, but Kratos' PS3 debut raised the stakes still further. The third game's legendary titan boss set-pieces looked and played with an almost CG-like level of polish, astonishing many with its breathtaking per-pixel lighting, rich detailing and pristine motion blur effects. The sheer scale of ambition on display here was simply breathtaking and even today, God of War 3 ranks as one of the best platform exclusives on the market.
The evolution of God of War 3 - especially from its E3 2009 debut to its March release the following year - remains one of the most dramatic transformations we've seen from preview code to release, and stands as testament to a remarkable era where PS3 game development progressed in colossal leaps and bounds. But understandably, the Sony Santa Monica team look back on this time a little more pragmatically.
"After E3 we had a big back-log of optimisation opportunities and ideas that we wanted to try, and optimisation finally became one of our primary foci. We also doubled the graphics engineering team just around E3," recalls Santa Monica Studio's graphics engineer Cedric Perthuis.
Fellow graphics engineer Ben Diamand also confirms it was a hectic spell for the studio after the unveiling, and many tweaks in the build-up to the game's release came down to the wire. "There were so many major technical improvements that went in between E3 and shipping," he says. "Morphological anti-aliasing (MLAA) got added which improved edges dramatically and saved substantial amounts of frame-rate."
"One of the big takeaways was that of the limits imposed by the engine to ensure good performance were restricting artist creativity, so we tried to remove or push those limits as far as possible."
The MLAA technology represented a break-through for developers at the time. Developed by SCEE's own Advanced Technology Group (ATG), it's now a popular edge-detection process that can cost-effectively remove jagged edges from each frame - one of a range of GPU tasks that were hived off to the Cell processor's surrounding Synergistic Processing Units (SPUs). Crucially, for Santa Monica Studio's effects artists, this freed up processing cycles and allowed them to add to the spectacle in other ways.
"At E3, the SPU code for shadows was literally turned on the night before - no joke - so dramatic quality and performance improvements were made from then until we shipped. Many effects such as depth-of-field, motion blur, crepuscular 'god' rays and refraction were either added or improved in quality and speed," says Diamand.
"A number of culling improvements were made and portions of code got moved to the SPUs towards the end to ease the load on the CPU. We also ran a very expensive tools pass on many of our shaders, trying to eke out a few more cycles. Among the more dramatic things on the art side was the addition of proper - more or less - high-dynamic range (HDR), bloom, and tone mapping."
However, despite a warm reception at the crucial E3 conference, not everyone in attendance was enamoured with the results. Certainly the fight with Helios was impressive, but less than stellar feedback on some design choices made the developers think about how to fine-tune the visuals still further.
"I recall one person describing it as if the screen were smeared with a bit of Vaseline, which was a bit of a kick in the pants, and made me redouble efforts in that area," Diamand shares. "When HDR went in, the artists could do true exposure adjustment and could create lights with real range to them. And while the artists did a great job with it, it was really in God of War: Ascension that they perfected their material and lighting usage."
Three years on, God of War: Ascension shows how this drive to continually add new tools and push back boundaries carried straight over from the third game's development. To broaden the creative palette of the studio's many graphics designers, more advanced tools for texturing the environments received special attention.
The rise of God of War: Ascension
"One of the big takeaways [from God of War 3] was that the limits imposed by the engine (to ensure good performance) were restricting artist creativity, so we tried to remove or push those limits as far as possible without losing any performance. One example is the number of UV sets we allowed. We pushed it to three UV sets per mesh," Cedric Perthuis says, referring to a form of texture mapping used to wrap around specific shapes in the geometry. For complex character models such as Kratos, independent textures are needed for body parts unique to him, each wrapping around the head, torso and limbs - all of which form an editable "UV set" when laid out flat.
"[Ascension] also has more game systems competing for CPU and SPU time. A tremendous amount of time was spent 'under the hood', optimising systems and moving even more of the engine to the SPU."
Allowing multiple UV sets for the surrounding environment, however, also makes it possible to develop a far richer, more natural look to cracked mountain-sides and mossy cavern walls. According to Pethuis, this turns out to be a bit more expensive in terms of data size and vertex input bandwidth for the PS3 hardware, but the results are clearly worth it.
"With this we could now add layers of debris, dirt or grass and make those layers span smoothly across several geometries, while previously we had to add extra transparent meshes going across multiple other meshes, which wasn't always giving good results and could be fairly expensive too," he says.
"Pretty much every system saw its limits pushed," Perthuis adds, highlighting how other engine changes doubled or tripled the number of game objects the engine could handle. He also describes how the organic look of the environments has a basis in its more sophisticated "procedural mesh deformation for foliage and herbs, influenced by wind and collision."
However, even with such improvements in place, the sense of pushing back the frontiers on PS3 didn't feel as pronounced this time around as it was during the development of God of War 3 - something the team are ready to admit.
"From a graphics 'technical' perspective, to a large degree God of War: Ascension was more refinement on the graphics front," Diamand confirms, highlighting that his focus over the last three years has been "less in making whizz-bang graphics improvements, and instead doing a ton of optimisation work."
Even so, the changes beyond the back-end are still legion, with "shadows, many more models, more geometry, and significantly more use of multilayer shader features and effects" standing as the key areas of advancement.
"I thought we hit 11 in God of War, but Ascension belies that. Ascension also has more game systems competing for CPU and SPU time. A tremendous amount of time was spent under the hood, optimising systems and moving even more of the engine to the SPU."
"God of War: Ascension has more (and better) shadows, many more models, more geometry, and significantly more use of multi-layer shader features and effects."
These new game systems pertain to the game's lighting and animation - with the pay-off as far as playability goes being Kratos' new Life Cycle ability. With the Amulet of Uroboros to hand, giant structures can be healed or decayed to varying degrees, allowing our leading demi-god new platforming routes through stages, and a unique time-shifting dynamic for the many puzzles. However, the idea of terraforming the surroundings by manipulating time poses a particular challenge for designers when it comes to also reversing the game's many effects and its lighting.
"The material part was unusual but rather simple," Perthuis says, describing how lighting from the SPU could be "used to reveal or hide material layers or reveal or hide objects... we extended this to particles, lights, and every object. Then we added time to it which was a tremendous challenge. Getting our particle system to work both to advance time and go back in time was quite difficult. Synchronising the whole scene with lights, on and off states, baked physics destructions, light animations, and post-effects transitions was extremely time-consuming."
Due to the sunlight's directional lighting while outdoors, having structures - such as the lift mechanism at the start of Delos Island - shatter to pieces and reassemble relied on the shadows being dynamic, rather than baked into the environment. This turned out to be another trade-off in offering this mechanic. However, getting the technology in place to achieve real-time lighting on multiple flying pieces of debris did have a hand in encouraging the team to implement the Life Cycle mechanic in the first place.
"We had the idea to use special lights to do transitions between two layers of a given material. This would allow us to do transitions based on where the object was located in the world, without having to bake it and create a special instance of the geometry for that location. It was also more flexible and more lightweight than our traditional way of defining layer blending for materials. From there, we discovered that those lights could be dynamic, and suddenly it became something we could exploit for gameplay."
When it comes to particle effects in particular, Ascension stands as a vaulting leap over what was possible in God of War 3. Combat is on the centre stage for much of this prequel, with the friction sparks, licking flames and lightning strikes imbued in Kratos' weapon-based attacks showing this off vividly. Getting such combat effects to this level proved a vital area of exploration for the art team - but once again, this had its genesis in the engineering department first.
Particles ramped up to 11
"The particle system was greatly improved, the idea was to give artists more control to achieve better results with less particles." On top of this, Perthuis reveals light collision and physics attributes are factored in to these effects too. "We also added emission of real meshes via our particle systems, which allowed for debris to be part of destruction reactions. Our artists are in control of the list of objects and effects to render, they decide how many of them they want and make sure it stays in frame."
"Our effects team did a great job adding all kinds of new and pretty effects to the game," Diamand adds, "and we had a new programmer, Ivan [Gavrenkov], who contributed greatly to making sure that the look and performance of effects were both top notch."
"If you lock at 30... then in close quarters combat you never have the option of a more responsive combat experience. By unlocking the frame-rate, you give the content people... a big say in how the game plays."
For many of Sony's top studios, getting the Cell's SPUs working on various tasks is cited as the key to getting the best results from PS3. When it comes to latter-day titles of the generation, such as Killzone 3 or God of War: Ascension, the use of MLAA is seen as integral to this process. As one of the cleanest and most cost-efficient methods for removing jagged edges from an image, the downside to MLAA's use is a theoretical 20ms turn-around across the console's SPUs. Cedric Perthuis confirms the efficiency this edge-detection algorithm, stating it has become approximately "five to ten per cent cheaper via some additional optimisations, which came in right after God of War 3 shipped."
Another design choice that carries over to God of War: Ascension is the studio's approach to frame-rate locking. As before, the priority is placed on pushing for a prettier game running at an unlocked frame-rate, where usual form elsewhere is to target 60 or lock to half that update. For those wary of the judder effect that running between these two rates can cause on 60Hz displays - standard to many households - this comes across as a curious decision.
"This is mostly about giving designers and artists freedom, and maybe some extra rope." Ben Diamand explains. "If you lock at 30 - our targeted minimum frame-rate - then in close quarters combat you never have the option of a more responsive combat experience. By unlocking the frame-rate, you give the content people, as opposed to the programmers, a big say in how the game plays. It's then their choice whether to load up a scene with pretty, but potentially expensive art, or whether combat demands a better frame-rate and controller response."
On locking to 30fps, Perthuis agrees on this point: "We have the option in our engine, but we find that the higher the frame-rate, the better the game feels. By unlocking the frame-rate we can achieve 35-45fps at a lot of places in the game. The general conception is that an irregular frame-rate is disturbing for the player because the animation feels irregular and not very smooth.
"That would be the case if our frame update time, which is the same as our animation time, was locked on the irregular frame-rate. It's not locked to anything either, it's floating in relation with the GPU, and it ends up being fairly random. And this is by having a randomised animation frame time around our average GPU time that we make unlock frame-rate work. The noise helps to smooth the visuals. We also have very heavy camera and object motion blurs which blends everything nicely."
Indeed, the use of camera and object-based motion blur defines the God of War series' cinematic look - often at its very best during the game's signature boss battles. Detail rarely diminishes when the camera zooms to the bigger picture, such as during a spectacular opening Hecatonchires city set-piece where Kratos fights inside a rotating prison block.
"Almost everything you see in the distance, if you ever zoom into it, is exactly the same geometry. In some respects, this is pretty damn impressive, but in others, there were some missed opportunities to make the game consume less GPU time."
But despite the results, Ben Diamand notes that the team ran out of time to fully optimise every facet of the game's design. For instance, level-of-detail (LOD) scaling is used in many games to reduce the quality of an object or texture once it moves far into the distance. It's a worthwhile tweak that eases up hardware resources, while often being invisible to many players when implemented subtly.
"Testing, tuning, re-writing, re-thinking"
For Ascension, however, this sky-high level of detail is the constant, and Diamand assures us that little trickery is used to reduce it.
"Alas, art pretty much ran out of space (and to some degree time) to do any serious LODing, although there was some. As a result, almost everything you see in the distance, if you ever zoom into it, is exactly the same geometry. In some respects, this is pretty damn impressive, but in others, there were some missed opportunities to make the game consume less GPU time."
The question remains, then, how performance remains above the 30fps mark for much of Kratos' prequel adventure, and whether any of these optimisations are actually even necessary bearing in mind the existing performance level in these areas.
"Usually when the camera zooms out we see more of the sky, which has a simple shader," Perthuis clarifies. "So we often get a reduction in fragment shader processing and an increase in vertex processing which makes performance fairly even."
Zooming out of the action is habitual during boss battles especially, letting the player see the full scale of the action. Areas such as the Delphi Temple show off mammoth structures, which often involves the in-house engine moving very quickly between environments, with plenty of vertex data and textures streaming in. Given that no mandatory installation to the PS3's hard drive is enforced in any form, the live streaming of assets has to be managed carefully for Ascension.
"Levels are streamed in and out, and travelling on the statue is not much different than going through rooms and corridors," Perthuis says, with regards to Kratos riding the three serpents around Delphi Temple - another of the game's notable set-pieces. "On God of War 3 we only had full level streaming, while on Ascension we can stream individual assets, and if you could measure the HDD and Blu-ray activity you would see permanent streaming of texture, geometries and game objects. We load different pieces of the statue at different detail levels based on your position."
Diamand looks back to the experience of programming this sequence, reflecting on "a lot of testing, tuning, sometimes rewriting, sometimes re-thinking an effect or a camera shot or set of assets to better fit what the engine is capable of."
"There's no magic though - just a lot of really talented people working really hard to make the best thing we can imagine."
"Surprisingly, a couple of multiplayer levels actually tore into graphical performance far more than some of the single-player levels. It was a bit of a scramble at the end fitting everything in."
Putting single-player to the side for a moment, another much-touted addition to the God of War package in Ascension is its multiplayer mode, the core design of which has a surprising amount in common with the solo campaign. From a development standpoint, having a shared codebase helped to streamline the development process - though specific changes were made.
"This is the same engine," confirms Perthuis. "By optimising for multiplayer we also gain in performance for single-player. All of our post-effects can be toggled on and off, or their quality can be adjusted. There are some post-effects which are never turned on in multiplayer, such as depth of field."
With up to eight players charging around at once, other compromises have to be put in place to ensure a sufficient overhead for performance. There are far more variables in this mode, and the team needed to account for all players appearing in view at once, or producing concurrent effects.
"It was mainly achieved by having simpler geometry for the environment in the level. The amount of optimisation done by artists simplifying their geometry was quite high for those levels. As a result, the geometry part of the multiplayer levels can usually be rendered at least twice as fast as the single-player levels, which leaves time to render more characters and more special effects," reveals Perthuis.
Regarding the convenience of having both modes sharing the same codebase, Diamand confirms changes are indeed "radical from a gameplay perspective, in that many systems were updated or even rewritten, but graphically it's the identical engine."
"Surprisingly, a couple of multiplayer levels actually tore into graphical performance far more than some of the single-player levels," he says, perhaps as a reference to the demanding Labyrinth of Daedalus stage built around dangling prison blocks. "It was a bit of a scramble at the end fitting everything in, both in terms of memory and performance."
The challenges of PlayStation 4
Looking to the future, it's all about the next-generation platforms and bearing in mind the results Sony Santa Monica achieved on PS3, we can only begin to imagine what one of the best teams in the business can attain on its successor. With Sony's PS4 now a known quantity to developer and consumer alike, both Perthuis and Diamand are quick to sing the praises of the announced details - and as usual, its 8GB pool of GDDR5 RAM stands as a particular high point.
"It's definitely got its share of interesting challenges - filling up that much memory from disk takes some time. From a technical standpoint, the DDR5 part is perhaps more interesting to me. But the 8GB part makes me pretty happy, too, since I think it makes a powerful PR statement," Diamand says.
"Our approach is not really 'to the metal'... it never really has been... yes, we optimise, sometimes a lot, but we try to be smart about when and where."
With high definition remasters of the series already a proven success on PS3, the potential in a deluxe 1080p60 rendition of the God of War series on PS4 is compelling. Kratos' first two outings scaled up remarkably well to 720p and it's easy to see how well the rich detail in current-gen God of War titles would translate at 1080p to the next generation. But would such a port be easy, bearing in mind how closely Sony Santa Monica tailored its code for the PS3's unique architecture?
"Our approach is not really 'to the metal'," clarifies Ben Diamand. "It never really has been, and people are surprised every time we say this. Yes, we optimise, sometimes a lot, but we try to be smart about when and where. As for God of War and PS4, I couldn't possibly comment on anything 'future'..."
Perthuis gives us his take:
"It could be done. The PS4 hardware is such a big leap forward in terms of graphics power compared to the PS3 that we probably wouldn't need to go that far. Most if not all of the SPU techniques we developed and used on PS3 were there to reduce the RSX workload. With the PS4 GPU we probably wouldn't need those techniques."
With God of War: Ascension available now, the future is an open canvas for Sony's Santa Monica Studio - now free to work on whatever new projects it chooses. It's a whole new world of opportunity: technical boundaries will move drastically for the next-generation due to the more developer-friendly architecture of the PS4. However, some might suggest that the astonishing visual presentation of the PS3 God of War games owed much to the complex, some might even say infuriating hardware set-up of the current-gen Sony platform. In moving towards the more comfortable coding environs of the x86 architecture, will Sony Santa Monica miss working with the legendarily exotic SPUs?
"Yes?" Diamand concludes. "Can I say that?"
"You always miss loved ones," adds Perthuis.