光线追踪可实现逼真的光照、反射和阴影,让玩家在 Abyss of Dungeons 的黑暗幻想世界中获得更深层次的沉浸感。虽然在移动游戏中,视觉效果出色的图形至关重要,但实现光线追踪视觉效果等高保真效果一直是一项重大挑战。从历史上看,移动游戏性能限制了高级渲染技术的使用,因此与 PC 和游戏机体验相比,移动游戏的视觉质量不得不有所妥协。
实现光线追踪阴影需要直接从表面追踪光线到光源,与传统的阴影贴图相比,其准确性更高。该流程包括深度预传递、光线查询阴影、降噪处理,以及集成到光照传递。我们使用带有抖动的单个光线,然后进行去噪处理,从而高效地实现了柔和阴影。对于反射,该团队实现了涉及 G 缓冲区传递、光线追踪反射和命中数据存储、材质 ID 转换、解析传递(构建反射图像)和混合传递(将反射集成到主场景)的多阶段流程。CPU 回写、平铺方法、实例批处理和异步 AS build 等优化显著提升了性能并降低了开销,解决了移动设备上这些进程的资源密集特性。
[null,null,["最后更新时间 (UTC):2025-03-05。"],[],[],null,["# Implementing Ray Tracing in Krafton Abyss of Dungeons\n\nYour browser doesn't support the video tag.\n\nWhy Ray Tracing on Mobile Matters\n---------------------------------\n\nRay Tracing unlocks realistic lighting, reflections, and shadows to level up\nplayer immersion in the dark fantasy world of [Abyss of Dungeons](https://play.google.com/store/apps/details?id=com.krafton.dndm). While\nvisually stunning graphics are crucial in mobile games, achieving high fidelity\neffects like ray-traced visuals has been a significant challenge. Historically,\nmobile gaming performance limitations have restricted advanced rendering\ntechniques, forcing compromises in visual quality compared to PC and console\nexperiences.\n\nKrafton Abyss of Dungeons aimed to overcome these limitations.\nThe objective was to integrate ray tracing technology, typically reserved for\nhigh-end platforms, into the mobile version in Unreal Engine 5 (UE5). This\nendeavor sought to significantly enhance player immersion by delivering more\nrealistic and visually rich graphics on mobile devices. The team needed to\naddress performance bottlenecks, adapt complex rendering pipelines like\n[UE5's Lumen](https://dev.epicgames.com/documentation/en-us/unreal-engine/lumen-global-illumination-and-reflections-in-unreal-engine), and ensure stability on varied mobile hardware, marking a\nsignificant step towards bringing console-quality graphics to mobile gaming.\n\nThe Visual Leap from Rasterization to Ray Tracing\n-------------------------------------------------\n\nConventional rasterization is the standard for mobile rendering due to its\nspeed. It projects 3D objects onto a 2D screen pixel by pixel. This method is\nefficient, but simplifies light interactions, resulting in less realistic\nshadows and reflections.\n\nRay tracing offers a different approach. It simulates the actual path of light\nrays and calculates their interactions with objects. This creates highly\naccurate and realistic lighting, shadows, and reflections. However, this realism\ncomes at the cost of computational intensity. Calculating each ray's path and\ninteractions requires significant processing power.\n\n### Comparing Rasterization and Ray Tracing\n\nThe following table summarizes the key differences between rasterization and ray\ntracing:\n\n| Feature | Rasterization | Ray Tracing |\n|--------------|---------------|-------------|\n| Speed | Fast | Slow |\n| Realism | Lower | Higher |\n| Resource Use | Low | High |\n\nThis resource intensity poses a challenge for mobile devices, which have limited\nprocessing power compared to desktops. This limitation has historically hindered\nthe adoption of ray tracing on mobile platforms.\n\nChoosing and Implementing Ray Tracing on Android: A Methodical Approach\n-----------------------------------------------------------------------\n\nFor implementing ray tracing on Android with Vulkan, two primary methods were\nconsidered: Ray Queries and Ray Pipelines. Ray Queries offered a simpler\napproach, enabling manual ray management within shaders, which was more\nstraightforward to integrate into existing systems.\n\nRay Pipelines, however, provided a more scalable solution, allowing Vulkan to\nmanage ray traversal and intersection. Although Ray Queries were initially\nslightly faster in simpler scenes, Ray Pipelines demonstrated better scalability\nand performance for more complex ray tracing applications, making them a\nsuperior choice for long-term development and intricate visual demands. We chose\nto balance initial development ease with future scalability and overall\nperformance, focusing on the long-term visual integrity of the game.\n\nAdapting UE5 Lumen for Mobile: A Monumental Task\n------------------------------------------------\n\nUE5's Lumen, a real-time global illumination and reflection system,\nrevolutionized lighting in game environments. However, it was originally\ndesigned for high-performance PCs and consoles, not mobile devices. Lumen's\ncomplexity and resource requirements presented a major challenge for mobile\nintegration. Adapting Lumen for Android required extensive modifications to\nUE5's rendering pipeline and shader compiler, along with optimizing Acceleration\nStructures (AS) to manage complex scene data efficiently. The team's work aimed\nto bridge the gap, enabling mobile devices to handle the sophisticated lighting\ncalculations of Lumen without sacrificing performance or stability. This\nadaptation effort also contributed to the official Unreal Engine codebase,\nbenefitting the broader game development community and advancing mobile\nrendering capabilities.\n\nRay Tracing Shadows and Reflections: Elevating Visual Realism\n-------------------------------------------------------------\n\nImplementing Ray Tracing Shadows involved tracing light rays directly from\nsurfaces to light sources, offering superior accuracy compared to conventional\nshadow maps. The process included a depth prepass, ray query shadows, denoising,\nand integration into the lighting pass. Soft shadows were achieved efficiently\nusing a single ray with jitter followed by denoising. For reflections, the team\nimplemented a multi-stage process involving a G-buffer pass, ray tracing\nreflection and hit data storage, material ID conversion, a resolve pass\n(constructing the reflected image), and a blend pass (integrating reflections\ninto the main scene). Optimizations such as CPU readback, tiled approaches,\ninstance batching, and asynchronous AS builds significantly improved performance\nand reduced overhead, addressing the resource-intensive nature of these\nprocesses on mobile devices.\n\nPerformance Impact and Optimization Strategies\n----------------------------------------------\n\nSamsung Galaxy S24 Xclipse 940, Top (optimized, blue) Bottom (before optimization, yellow)\n\nThe performance impact of ray tracing, particularly with reflections, was highly\nscene-dependent. In scenes with large reflective surfaces, reflections could\nconsume a significant portion of the frame time (30-40%). Optimizations were\ncrucial to making ray tracing viable. The team employed numerous techniques to\nreduce overhead and increase efficiency: using a tile-based rendering approach\nto minimize wasted processing, batching instances of the same material and\ngeometry to reduce draw calls, building Acceleration Structures only for visible\ngeometries, and using asynchronous compute for AS construction. These strategies\ndrastically cut down on processing time and reduced GPU load, making real-time\nray tracing possible on mobile hardware.\n\nFurther Reading\n---------------\n\nThe Samsung DevTech team's and Krafton's Abyss of Dungeons demonstrated that,\nwith strategic adaptations and optimizations, it is possible to bring high-end\nrendering techniques like ray tracing to mobile platforms. The team successfully\nadapted UE5's Lumen system, implemented custom rendering solutions, and resolved\nnumerous technical hurdles to deliver a visually enhanced gaming experience.\nThis endeavor has not only improved the visual fidelity of Abyss of Dungeons but\nalso provided invaluable insights and techniques for future mobile game\ndevelopment. It highlights the power of collaboration between game developers\nand technology providers to innovate and elevate the mobile gaming experience,\nbringing it closer to the quality found on PCs and consoles."]]