Implementing Ray Tracing in Krafton Abyss of Dungeons

Why Ray Tracing on Mobile Matters

Ray Tracing unlocks realistic lighting, reflections, and shadows to level up player immersion in the dark fantasy world of Abyss of Dungeons. While visually stunning graphics are crucial in mobile games, achieving high fidelity effects like ray-traced visuals has been a significant challenge. Historically, mobile gaming performance limitations have restricted advanced rendering techniques, forcing compromises in visual quality compared to PC and console experiences.

Krafton Abyss of Dungeons aimed to overcome these limitations. The objective was to integrate ray tracing technology, typically reserved for high-end platforms, into the mobile version in Unreal Engine 5 (UE5). This endeavor sought to significantly enhance player immersion by delivering more realistic and visually rich graphics on mobile devices. The team needed to address performance bottlenecks, adapt complex rendering pipelines like UE5's Lumen, and ensure stability on varied mobile hardware, marking a significant step towards bringing console-quality graphics to mobile gaming.

The Visual Leap from Rasterization to Ray Tracing

Conventional rasterization is the standard for mobile rendering due to its speed. It projects 3D objects onto a 2D screen pixel by pixel. This method is efficient, but simplifies light interactions, resulting in less realistic shadows and reflections.

Ray tracing offers a different approach. It simulates the actual path of light rays and calculates their interactions with objects. This creates highly accurate and realistic lighting, shadows, and reflections. However, this realism comes at the cost of computational intensity. Calculating each ray's path and interactions requires significant processing power.

Comparing Rasterization and Ray Tracing

The following table summarizes the key differences between rasterization and ray tracing:

Feature Rasterization Ray Tracing
Speed Fast Slow
Realism Lower Higher
Resource Use Low High

This resource intensity poses a challenge for mobile devices, which have limited processing power compared to desktops. This limitation has historically hindered the adoption of ray tracing on mobile platforms.

Choosing and Implementing Ray Tracing on Android: A Methodical Approach

For implementing ray tracing on Android with Vulkan, two primary methods were considered: Ray Queries and Ray Pipelines. Ray Queries offered a simpler approach, enabling manual ray management within shaders, which was more straightforward to integrate into existing systems.

Ray Pipelines, however, provided a more scalable solution, allowing Vulkan to manage ray traversal and intersection. Although Ray Queries were initially slightly faster in simpler scenes, Ray Pipelines demonstrated better scalability and performance for more complex ray tracing applications, making them a superior choice for long-term development and intricate visual demands. We chose to balance initial development ease with future scalability and overall performance, focusing on the long-term visual integrity of the game.

Adapting UE5 Lumen for Mobile: A Monumental Task

UE5's Lumen, a real-time global illumination and reflection system, revolutionized lighting in game environments. However, it was originally designed for high-performance PCs and consoles, not mobile devices. Lumen's complexity and resource requirements presented a major challenge for mobile integration. Adapting Lumen for Android required extensive modifications to UE5's rendering pipeline and shader compiler, along with optimizing Acceleration Structures (AS) to manage complex scene data efficiently. The team's work aimed to bridge the gap, enabling mobile devices to handle the sophisticated lighting calculations of Lumen without sacrificing performance or stability. This adaptation effort also contributed to the official Unreal Engine codebase, benefitting the broader game development community and advancing mobile rendering capabilities.

Ray Tracing Shadows and Reflections: Elevating Visual Realism

Implementing Ray Tracing Shadows involved tracing light rays directly from surfaces to light sources, offering superior accuracy compared to conventional shadow maps. The process included a depth prepass, ray query shadows, denoising, and integration into the lighting pass. Soft shadows were achieved efficiently using a single ray with jitter followed by denoising. For reflections, the team implemented a multi-stage process involving a G-buffer pass, ray tracing reflection and hit data storage, material ID conversion, a resolve pass (constructing the reflected image), and a blend pass (integrating reflections into the main scene). Optimizations such as CPU readback, tiled approaches, instance batching, and asynchronous AS builds significantly improved performance and reduced overhead, addressing the resource-intensive nature of these processes on mobile devices.

Performance Impact and Optimization Strategies

Samsung Galaxy S24 Xclipse 940, Top (optimized, blue) Bottom (before optimization, yellow)

The performance impact of ray tracing, particularly with reflections, was highly scene-dependent. In scenes with large reflective surfaces, reflections could consume a significant portion of the frame time (30-40%). Optimizations were crucial to making ray tracing viable. The team employed numerous techniques to reduce overhead and increase efficiency: using a tile-based rendering approach to minimize wasted processing, batching instances of the same material and geometry to reduce draw calls, building Acceleration Structures only for visible geometries, and using asynchronous compute for AS construction. These strategies drastically cut down on processing time and reduced GPU load, making real-time ray tracing possible on mobile hardware.

Further Reading

Krafton's Abyss of Dungeons demonstrated that, with strategic adaptations and optimizations, it is possible to bring high-end rendering techniques like ray tracing to mobile platforms. The team successfully adapted UE5's Lumen system, implemented custom rendering solutions, and resolved numerous technical hurdles to deliver a visually enhanced gaming experience. This endeavor has not only improved the visual fidelity of Abyss of Dungeons but also provided invaluable insights and techniques for future mobile game development. It highlights the power of collaboration between game developers and technology providers to innovate and elevate the mobile gaming experience, bringing it closer to the quality found on PCs and consoles. Check the detailed ray training optimizations in the Samsung developer site.