Take a deep dive into how Remedy’s Northlight engine team updated the technology behind Alan Wake 2 to support the new features of PlayStation 5 Pro.
Alan Wake 2 is taking full advantage of Sony’s PlayStation 5 Pro to enhance the game experience further. Remedy’s Northlight engine team has spent a good amount of time updating the technology behind Alan Wake 2, with the main new feature for the Pro being the addition of ray tracing.
The Quality and Performance modes in Alan Wake 2 are upgraded on the PS5 Pro. They utilize Sony’s new “PlayStation® Spectral Super Resolution” aka PSSR upscaling method. To quote Sony’s marketing language, "PSSR is an AI-driven upscaling that uses a machine learning-based technology to provide super sharp image clarity by adding an extraordinary amount of detail."
Quality Mode
The PS5 Pro Quality mode features ray tracing, which isn't available on the base PS5 version of the game.
Performance Mode
The Performance Mode on the PS5 Pro features significantly higher output resolution and has more visual detail compared to the base PS5. The Pro Performance mode uses approximately the same image quality (render) settings as the base PS5’s Quality mode.
The overall image stability, fog, volumetric lighting, and shadow accuracy have been improved on the Pro.
We shipped Alan Wake 2 on October 27th 2023. The PlayStation 5 and Series X versions offer players the choice between a Quality mode at 30fps and a Performance mode targeting 60fps. We wanted to retain and improve these modes when considering upgrading Alan Wake 2 for the Pro.
When considering potential options to improve the image quality, increasing the rendering resolution is among the easiest routes to go if you have enough GPU power.
We did multiple experiments, including upgrading the 60fps Performance mode output from 1440p to 4k and adding PSSR (Sony’s AI-based upscaling method), which positively impacted image crispness and stability under motion.
Increasing the internal rendering resolution consumes a lot of processing power, no matter how powerful your hardware is. However, in our experiments, even putting all the added power to increased rendering resolution provided a barely noticeable difference in the output image or its quality. Adding more pixels to gain visual quality is not straightforward with the new AI-based upscaling methods.
That being said, there still is a threshold on what resolution image you can feed to modern upscalers and expect good quality reconstruction results. Many different parameters affect the upscaling quality, ranging from the style of content to the choice of rendering algorithms that are used to produce the image. Every engine and artistic direction works in different ways.
When it comes to Alan Wake 2, it seemed a better idea to improve the signal that we feed into the denoising network rather than trying just to add more data. This led us to improve the rendering quality settings of the Pro Performance mode which is closer to what the base PlayStation 5 version’s Quality mode uses.
These upgraded settings provide the Pro version of Alan Wake 2 with a fast response rate combined with a sharper and better-quality image than was previously possible.
Alan Wake 2 is visually incredibly detailed and rich, which are qualities that make it a tough fit for ray tracing, especially compared to our previous game, Control. Still, we do like a challenge here at Remedy. If you have a high-end PC with the right graphics card, ray tracing on Alan Wake 2 looks great, and we are happy that we can now bring ray tracing to the Pro thanks to its upgraded hardware.
With ray traced effects, the detail of the world in Alan Wake 2 can be observed even more accurately than before on the console, and the image is more stable in complex lighting situations.
We’ve always wanted to bring cutting-edge visuals to our games, but everything is always a balancing act between the frame rate, visual quality, technical and hardware constraints, development resources and what we wish to artistically achieve with the game.
Alan Wake 2 did not feature ray tracing on PlayStation 5, but with the Pro’s improved ray tracing features and additional power, we could bring ray tracing to Alan Wake 2’s Quality Mode on the Pro enabling ray traced reflections on opaque and transparent surfaces.
Visually, Alan Wake 2 contains beautifully crafted scenes and lighting setups that can benefit from ray tracing. Ray traced reflections allow dynamic indirect lighting to be brought in from the surrounding scene. They are not limited to using information only from the main camera view shading or coarse and static signed distance fields like our screen space techniques.
However, ray tracing comes with a cost. Each ray must be traced, and its hit evaluated and shaded. Due to the nature of ray tracing, multiple rays must be traced to reach noise-free images. Unfortunately, tracing and shading multiple rays per pixel is still generally too expensive. We must be able to work with noisy images provided by low sample counts, which means we must remove the noise by de-noising. When trying to achieve real-time performance, game engines like our very own Northlight usually resort to using small sample counts and denoising.
In a game like Alan Wake 2, its complex light-material interactions and rich environments can make tracing, shading, and denoising even a single ray tracing effect too expensive to justify the cost depending on the hardware. Geometrically Alan Wake 2 is a very dense game. The usage of a GPU-driven rendering pipeline and its fine-grained culling with the skinning ran on GPU made it possible to create densely populated forest scenes with layers and layers of foliage and trees encountered during Saga’s gameplay segments taking place in the lush environments of the Pacific North-West.
While main camera view shading can effectively cull most of the unnecessary work, uncompromised ray tracing must build an acceleration structure using a large portion of the scene’s objects since ray tracing reaches beyond the limits of the screen-space information. The Pro’s improved hardware made it possible to build the acceleration structure for the most densely populated scenes, which was the major limitation before.
Below, you can see a selection of screenshots that display how ray tracing can transform the image, bringing information from the scene that is not only limited to the main camera view.
You can download uncompressed screenshots from the article here.
Since we had shipped ray tracing on PlayStation 5 and Xbox Series X before with Control Ultimate Edition back in February 2021 and shipped various ray tracing effects for PC with Alan Wake 2, the work came mostly down to selecting desired effects and making PlayStation 5 Pro-specific optimizations.
All the key pieces required by ray tracing such as acceleration structure building pipeline, bindless material access for ray hits that are not in the main camera view and shading model for them were already in place. We chose to include ray tracing in the Quality mode. The decision to include ray traced reflections for opaque and transparent came down to balancing quality and performance, keeping the 30fps frame-rate target in mind.
Let us dive into the technical details of our ray tracing pipeline. Right after the scene has undergone an update and skinning is complete, the acceleration structure, i.e., the bounding volume hierarchy (bvh), is built asynchronously on the GPU. This allows us to overlap non-dependent work that is not bottlenecked by the same limiters as the BVH building. To hit our performance target for bvh building and ray tracing intersection in the shaders, we had to limit the amount objects in the bvh. We keep track of object distances to the camera and only include them if they are within predefined distance with exception that landscape heightfield is always fully included. Including full heightfield provides dark backdrop for long rays that miss all other objects in the bvh.
We also use the cascaded skinned mesh bvh updates on PlayStation 5 Pro. This means that skinned meshes are not updated or rebuilt every frame in the bvh, but rather use cascaded build frame intervals based on distance to the camera. Each mesh has a uniform frame random offset applied to even out the work between frames. On the Pro, special meshes such as characters are built or updated every frame, while other skinned meshes do so based on the cascades starting at half the framerate.
After the bvh has been built, all potentially visible lights undergo culling and are gathered from the scene using expanded volume that is conservative to the potential ray tracing hits far away from the main camera view. Data from these lights is sent to the GPU and can be accessed by the ray tracing shaders.
Ray traced reflections use a deferred ray tracing pass setup, where half-resolution reflection rays are traced in checkerboarded fashion from the main camera surface. Tracing rays in half-resolution helps to gain performance but means that during denoising we must fill in the missing reflection information. Deferred approach is used to let ray intersections run free of register pressure caused by heavy reflection shading. Northlight has a separate main surface defined by opaque and transparent objects. This naturally splits reflections to opaque and transparent based on the surface they are cast from. On the Pro, we also run all ray tracing effects in asynchronously to other effects, since we found that overlapping them with independent work yielded performance gain, even though theoretically the gains should be small at the point they are run during a frame.
Deferred ray tracing starts with a pass, run in half-resolution, that determines reflection directions and does ray-scene intersections producing a geometry buffer that contains relevant data from the secondary surface. This geometry buffer allows material and ray traced hit point data to be accessed later during shading. Single ray direction is chosen based on the surface’s attributes and are selected proportional to bidirectional reflectance distribution function(brdf) used by our shading model. Heavily alpha tested locations can be heavy to trace, so to balance quality versus performance, we resorted to stochastically skipping alpha testing on the reflections rays based on the roughness of the main camera view surface. Also, to gain a little bit of extra tracing performance, the maximum distances that the rays can reach are modulated based on the surface roughness. The rays from the roughest surface, which are usually short and produce noisy reflections, are culled, and proceed use our global illumination evaluation as a fallback.
After the reflection ray pass, a pass is dispatched for sunlight shadow rays. This pass is required, since unlike shadow maps used by small local lights that only span small areas of the scene, the sunlight is visible everywhere. If the secondary surface found by the reflection ray is not inside the area of the scene handled by sun’s shadow map, the sunlight leaks. Reflection rays from the first pass, that find a valid hit, trace this sun light shadow ray. Sun shadow rays are packed using atomics and executed tightly writing shadow data augmenting the geometry buffer.
After tracing the reflection rays and shadow rays, a separate shading pass is run that uses the produced geometry buffer to evaluate reflection shading at the secondary surface. Reflection shading is expensive, since it must pull in and evaluate divergent material data based on the object that was hit. Material and brdf evaluation closely match the one done for the main view. During shading pass, we add in all influencing light contributions from small local lights and the sun. Further bounces are approximated by our global illumination evaluation and environment cube map. We also blend in fog based on how far the ray traveled through our fog volumes. At this point, evaluated reflection is complete but noisy. We must denoise the reflection by blurring and using results over multiple frames.
After shading, both opaque and transparent reflections undergo a set of denoising passes, that remove the unwanted noise from the image produced by half resolution rays. Denoising performs series of blurs where the blur kernel footprint is widened each pass while trying to preserve material detail as well as possible. Denoising usually also resorts to using data over multiple frames averaging the result. Temporal Anti-Aliasing employed in modern games also helps in denoising, since by nature it reuses data over multiple frames.
For PlayStation 5 Pro specifically, we added a new transparent surface reflection denoiser that works well with the PSSR. After denoising, we add our reflections to the final image.
We briefly summarized how the PlayStation 5 Pro ray tracing implementation turned out and which measures we took to balance quality versus performance. To end this rather wordy blog post, please enjoy some screen shots from Alan Wake 2 running on PlayStation 5 Pro.
You can download uncompressed screenshots from the article here.