Hardware-Accelerated Ray Tracing Improves Lighting Effects in Mobile Gaming

Tuesday 5/9/23 08:06am
Posted By Rodrigo Holztrattner
  • Up0
  • Down0

Snapdragon and Qualcomm branded products are products of
Qualcomm Technologies, Inc. and/or its subsidiaries.

How realistic is the light representation in the mobile games you develop? A big part of the user experience in all games is how well you approximate the real-world model of light, including reflections, refraction and shadows.

War Thunder Mobile, the flagship MMO title from Gaijin Entertainment, has become the first major mobile game to take advantage of ray tracing on the Qualcomm Adreno GPU. Ray tracing is an advanced technique for closely approximating real-world lighting effects in a rendered environment. Because of its high computational cost, ray tracing has been limited to PC and console versions of Gaijin titles. But as this Ray Tracing video shows, the game War Thunder Mobile now incorporates hardware-accelerated ray tracing on a Snapdragon processor, using the Qualcomm Adreno GPU.

Left side of image illustrates ray tracing is on. Right side of image shows ray tracing is off.

On devices with the Snapdragon 8 Gen 2 mobile platform or higher, users see the more-realistic shadows shown on the left of the image above. The result is a more engaging experience for players on mobile.

This post explores ray tracing, describes how Gaijin is using it in their game titles and shows how you can apply it in your games and applications.

What is ray tracing? Why is it computationally expensive?

Ray tracing is an improvement on rasterization, the process most video games use to render computer graphics. Rasterization converts graphics and primitives from three dimensions into the two-dimensional grid of a display’s pixels. It depends on shaders to depict real-world lighting, and game developers have had to hack the visuals in their scenes using algorithms for light calculations. For example, they’ve had to simulate the shadows on tasks that were not linked directly. And on mobile, developers have been limited to four point-lights casting shadows because computing resources have been even more scarce than on PC and console. For that reason, many mobile games haven’t had shadows. Techniques have evolved to estimate the shadows better, but still not realistically.

In ray tracing, an algorithm traces the path of a ray of light. It then simulates how that ray interacts (collides) with other objects in the scene. To simulate real-world lighting and physics in a game, for example, it traces the path of light rays from camera into scene, from light to object to camera, or from light directly to camera. In other words, if a ray of light is traced from position x to position y, does it collide with something? Is that point of collision occluded or not? The technique opens up opportunities for more-lifelike reflection, refraction and shadows. It imitates human vision in the way it processes how light falls and appears, and the effects of light on color perception.

Naturally, it’s computationally expensive to simulate and track every ray of light in a scene. Ray tracing techniques have been used in films and entertainment, where computing resources are plentiful and real-time performance is not at issue. Around 2018, hardware improvements brought the techniques into PC and console gaming, and it was only a matter of time until the evolution of GPUs brought them to mobile gaming.

Ray tracing in mobile gaming

Rather than replace standard rasterization, ray tracing can be used on top of existing pipelines. It provides additional features and can simplify surface light that developers have usually implemented with tricks and hacks. Access to pixel hit information, for example, can improve features like generating shadows and calculating better light properties and reflections.

On the software side, all the main graphical APIs, such as Vulkan, OpenGL, DirectX and Metal, had to be updated to support ray tracing. As the main rendering choice for mobile devices, the Vulkan specification uses a variety of extensions such as acceleration structures, ray tracing pipelines and ray queries. Instead of defining the visible area represented by triangles and shading them respectively, rays are generated for each visible pixel on screen. Light rays can collide with different surfaces and reflect, refract (be absorbed) or both. Many rays can be generated from a single collision, and this calculation can continue as long as it is defined to suit the target quality and performance.

On the hardware side, ray tracing also necessitated engineering and physical changes to the architecture in the Adreno GPU.

Qualcomm Technologies and Gaijin collaborate

In anticipation of the launch of the Snapdragon 8 Gen 2 mobile platform, Qualcomm Technologies, Inc. began working with Gaijin Entertainment on improvements to the mobile version of War Thunder Mobile. We provided commercial devices with the latest Adreno GPU, as well as development tools and driver updates so Gaijin could enable hardware acceleration for ray tracing.

Our team communicated regularly with Gaijin engineers, taking their questions about the API and software stack and relaying replies from internal teams. Gaijin adapted ray tracing to their game quickly, and when they had a stable build, they sent it to us for testing.

The result of the collaboration is that War Thunder Mobile will support Qualcomm Technologies' real-time, hardware-accelerated ray tracing on mobile devices with Snapdragon from day one of the game’s open beta. War Thunder Mobile players will enjoy higher-quality visuals through smooth, ray-traced shadows, with effects like realistic penumbras, translucency and self-shadowing.

Gaijin is looking to take more advantage of ray tracing for greater realism in other lighting effects, such as reflections. Although they’re primarily a developer of PC games, their progress with War Thunder Mobile opens up opportunities in mobile gaming for all the titles in their catalog.

Your turn

You too can take advantage of the capabilities that Gaijin is using.

We’ve made the Vulkan Code Sample Framework available in a GitHub repo so you too can explore Vulkan rendering features on the Adreno GPU. The repo contains a Vulkan framework designed for quickly creating sample content and prototyping. It contains the building blocks you’ll need for creating an Android APK with Vulkan functions and an input system, along with other helper utilities.

You can build sample projects that demonstrate some of the extensions Qualcomm Technologies developed in conjunction with Khronos for Vulkan. You can also use them as a base for your own projects, since they are optimized for performance on mobile chipsets. The image below demonstrates shadow effects (RayQuery capabilities only) from one of the samples.

Keep in mind that although Gaijin is using ray tracing for games, the technique is applicable to other use cases like architect’s scenes and interior design. For example, you could place virtual furniture in a room and let your app detect the light information from the scene. It could apply that information to the furniture in real time, providing a much closer representation of how it would look in the real world.

Even without the Vulkan Code Sample Framework, you can start from zero and implement ray tracing in your apps. Either way, you’ll need one of the commercially available devices with Snapdragon 8 Gen 2 (or higher) mobile platform. Those include devices from Samsung and Xiaomi.

Stay tuned

War Thunder Mobile may be the first major mobile game to take advantage of hardware acceleration for ray tracing, but we’re optimistic that it won’t be the last one.

We’re adding more ray tracing capabilities to the Adreno GPU in the near future for photo-realistic effects in your games. So have a crack at the Vulkan Code Sample Framework and see how you can improve lighting effects in your own games and apps. And look for ray tracing in other game development tools, like the Unreal Engine 5 Metahumans Framework.

Snapdragon and Qualcomm branded products are products of Qualcomm Technologies, Inc. and/or its subsidiaries.