透過光線追蹤技術,玩家可以體驗逼真的光線、反射和陰影效果,進一步沉浸在《Abyss of Dungeons》的黑暗奇幻世界中。雖然行動遊戲需要具備令人驚豔的視覺效果,但要達到高保真效果 (例如光線追蹤視覺效果) 是一大挑戰。以往,行動遊戲效能限制了進階算繪技術,因此與電腦和主機遊戲相比,視覺品質必須有所妥協。
不過,Ray Pipelines 提供了更具可擴充性的解決方案,可讓 Vulkan 管理光線穿越和交集。雖然 Ray 查詢在較簡單的場景中最初速度略快,但 Ray 管道在更複雜的光線追蹤應用程式中展現出更佳的可擴充性和效能,因此是長期開發和複雜視覺需求的絕佳選擇。我們選擇平衡初始開發的簡易性、未來的擴充性和整體效能,並著重於遊戲的長期視覺完整性。
實作光線追蹤陰影時,系統會直接從表面追蹤光線到光源,相較於傳統陰影地圖,可提供更高的精確度。這項程序包括深度預處理、光線查詢陰影、去雜訊,以及整合至照明處理。我們使用單一光線加上抖動,再加上去雜訊,就能有效地產生柔和陰影。針對反射,團隊實作了多階段程序,包括 G 緩衝區處理、光線追蹤反射和命中資料儲存、材質 ID 轉換、解析處理 (建構反射圖像) 和混合處理 (將反射整合至主要場景)。最佳化功能 (例如 CPU 回饋、平鋪式方法、例項批次處理和非同步 AS 建構) 可大幅提升效能並降低額外負載,解決行動裝置上這些程序的資源密集型特性。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間: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."]]