Under the Bonnet: SHIFT 2 Unleashed - 2
Slightly Mad talk AI, Helmet Cam and capturing the thrill of the race
Aware that competitors were likely to copy it, we were eager to keep innovating in this space and so for SHIFT 2 Unleashed we wanted to take it to the next level with the Helmet Cam. By attaching the camera to the driver's head rather than their body we were able to achieve an even more authentic and immersive perspective on the action - one that now leaned laterally when approaching corners and tilted to counter-balance camber. We also used depth of field effects to draw attention to the apex of the corner so it became a great learning tool too. If Cockpit Cam was akin to a first-person shooter then this was pulling inspiration from flight sims.
Initially we included a reflective visor with the Helmet Cam too - but we found that the additional reflections caused too much of a distraction when racing. The perception was that in reality your eyes tend to look 'through' the visor and don't even register it when racing. In the game however it ultimately felt like driving through dirty glass though so it was removed.
Since the camera was now adjusting when approaching corners we also had to do careful balancing so that it felt natural and was complimenting where your natural eyeline was going. Initially it was quite distracting - the equivalent of driving a tank and rotating the turret whilst attempting to keep going in a straight line. A set of simple parameters allowed us to tweak the settings rapidly and allow the team to iteratively re-test and we nailed the behaviour fairly early on in the project.
In the same way that MP3 compression removes subtle detail from audio to compress it, we analyse the entire frame context and if there is a lot of foreground detail you won't miss background subtleties.
We use a three phase light pre-pass approach for our deferred renderer. The main reason we chose this as opposed to a two-phase approach was because being a racing game, we needed to focus on high quality rendering of diverse material types, ranging from rubber and cloth all the way up to paintwork, glass and carbon fibre. While a BRDF-lookup texture approach allows for decent material variety in a two-pass deferred renderer, it doesn't cut it when you need to implement a totally different lighting model (carbon fibre, brushed metals).
Also, our most important visual components are the cars, which need high quality environment mapping. We tried every encoding possible for the normals channel of the G-buffer before deciding that it wasn't possible to get an acceptable quality level for bodywork reflections. So, we dropped back to the cheapest normal encoding (888 view space XYZ, which helped a lot with PS3 performance) and use those for general lighting. For bodywork reflections we re-evaluate the normal mapping in the third phase of the light prepass render. It's more expensive, but the quality you get makes it worthwhile.
With a new lighting engine it's meant we've been able to get both 'temperature' and additional gameplay into the game. Lighting is one thing - talented artists can easily recreate a stunning sunset or a starry sky, but with the advanced techniques our engine is capable of we've now been able to temporarily blind the player with dazzling sunlight as they approach a corner or cast individual shadows across their dashboard when racing at night.
Not only do these effects look spectacular but they also invoke an emotional reaction from the player; concentration when approaching a tough corner, fear when descending into the pitch black darkness, or apprehension seeing the headlights of a car behind sweeping across your dashboard knowing that one wrong mistake and they're going to overtake. So lighting in SHIFT 2 Unleashed is an integral part of heightening the challenge when racing, not just making the environments 'look pretty'.
With 100 different track locations in the game spanning 15 different countries we also wanted to make sure they were both distinguishable and true to their geography for easy recall by the player. Regardless of track layout the sun and 'temperature' of the West Coast Willow Springs track therefore intentionally looks distinctive to that of the East Coast Laguna Seca despite sharing common geological traits such as ground composition and vegetation. As you play through Career therefore, a forest-based Belgian track immediately followed by a forest-based Italian track will look different to each other and ensure individuality and variety.
It's a slightly modified version of the pre-release Edge code. It's very easy to integrate in the pipeline and is placed between the HDR tone-mapping phase and motion blur. It can be quite fussy tuning-wise but we managed to find a good balance between too much edge detection - which produces too much blurring - and not enough, which leaves you with jagged edges.
We take the view that both graphical and gameplay quality are critical to the experience of our games so we throw everything possible in, and then optimise via a range of in-house tools.
I don't think there was ever a silver bullet; rather every area was optimised individually. We used a number of approaches including controlling level of detail on light shaders, clipping light cones to geometry, running large chunks of the rendering logic on SPU on PS3, dynamically prioritising shadows based on light occlusion tests, MLAA instead of MSAA on PS3 etc.
Asset-wise, we profile the render cost of each vehicle (and each upgrade thereof) in a fixed scene in order to determine which vehicles need to be modified for performance and similarly we profile each track location using an automated camera system that moves around the track monitoring performance and identifying hotspots for optimisation.
We also use dynamic variation of detail in order to keep the performance up when it starts to drop due to a heavy load from some particular situation. In the same way that MP3 compression removes subtle detail from audio to compress it, we analyse the entire frame context and if there is a lot of foreground detail you won't miss background subtleties. In the same way that if you are driving very slowly you notice a lot more detail.