Real-Time Ray Traced Ambient Occlusion and Animation Image Quality and Performance of Hardware- Accelerated Ray Traced Ambient Occlusion
Total Page:16
File Type:pdf, Size:1020Kb
DEGREE PROJECTIN COMPUTER SCIENCE AND ENGINEERING, SECOND CYCLE, 30 CREDITS STOCKHOLM, SWEDEN 2021 Real-time Ray Traced Ambient Occlusion and Animation Image quality and performance of hardware- accelerated ray traced ambient occlusion FABIAN WALDNER KTH ROYAL INSTITUTE OF TECHNOLOGY SCHOOL OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE Real-time Ray Traced Ambient Occlusion and Animation Image quality and performance of hardware-accelerated ray traced ambient occlusion FABIAN Waldner Master’s Programme, Industrial Engineering and Management, 120 credits Date: June 2, 2021 Supervisor: Christopher Peters Examiner: Tino Weinkauf School of Electrical Engineering and Computer Science Swedish title: Strålspårad ambient ocklusion i realtid med animationer Swedish subtitle: Bildkvalité och prestanda av hårdvaruaccelererad, strålspårad ambient ocklusion © 2021 Fabian Waldner Abstract | i Abstract Recently, new hardware capabilities in GPUs has opened the possibility of ray tracing in real-time at interactive framerates. These new capabilities can be used for a range of ray tracing techniques - the focus of this thesis is on ray traced ambient occlusion (RTAO). This thesis evaluates real-time ray RTAO by comparing it with ground- truth ambient occlusion (GTAO), a state-of-the-art screen space ambient occlusion (SSAO) method. A contribution by this thesis is that the evaluation is made in scenarios that includes animated objects, both rigid-body animations and skinning animations. This approach has some advantages: it can emphasise visual artefacts that arise due to objects moving and animating. Furthermore, it makes the performance tests better approximate real-world applications such as video games and interactive visualisations. This is particularly true for RTAO, which gets more expensive as the number of objects in a scene increases and have additional costs from managing the ray tracing acceleration structures. The ambient occlusion methods are evaluated in terms of image quality and performance. Image quality is assessed using structural similarity index (SSIM) and through visual inspection. The performance is assessed by measuring computation time, in milliseconds. This thesis shows that the image quality of RTAO is a substantial improvement over GTAO, being close to offline rendering quality. The primary visual issue with RTAO is visible noise - especially noticeable around the contours of moving objects. Nevertheless, GTAO is very competitive due to its performance, the computation time for all GTAO tests were below one ms per frame. At 1080p full-resolution GTAO was computed in 0.3883 ms on a RTX 3070 GPU. In contrast, the computation time of RTAO at 1080p and two samples per pixels were 2.253 ms. The cost of updating and rebuilding ray tracing acceleration structures were also noteworthy. Overall, the results indicate that hardware accelerated ray tracing can be used for significant improvements in image quality but adoption of this technique is not trivial due to performance concerns. Keywords Ambient occlusion, ray tracing, real-time, animation ii | Sammanfattning Sammanfattning Med hårdvaruaccelererad strålspårning på grafikkort som introducerades nyligen möjliggjordes flera strålspårningsbaserade tekniker för rendering i realtid. Detta examensarbete undersöker en sådan teknik - strålspårad ambient ocklusion (engelska: ray traced ambient occlusion (RTAO)). RTAO undersöks och utvärderas för användning i realtidsapplikationer genom en jämförelse med en ambient-ocklusionsmetod som beräknas i bildrummet (screen space ambient occlusion (SSAO)) kallad ground-truth ambient occlusion (GTAO). Detta examensarbete bidrar genom att utvärdera metoderna i testscenarion som inkluderar animerade objekt. Detta medför ett antal fördelar: utvärderingen kan betona visuella artefakter som kan uppstå när objekt rör sig och animeras. Vidare gör det att prestandatesterna kan inkludera kostnader som tillkommer när scener innehåller animerade objekt - detta är särskilt betydande för RTAO som blir dyrare att beräkna när antalet objekt stiger samt har ytterligare kostnader för att uppdatera datastrukturer som används för att accelerera strålspårningen. På så vis närmar sig testscenarion en bred kategori av applikationer som använder rendering i realtid, exempelvis spel och interaktiva visualiseringar. Utvärderingen sker på uppnådd bildkvalité samt metodernas prestanda. Bildkvalitén utvärderas genom structural similarity index (SSIM) samt visuellinspektion. Prestandan utvärderas genom att mäta beräkningstiden i millisekunder. Resultaten visar att RTAOs bildkvalité är tydligt överlägsen GTAO och närmar sig de resultat som uppnås genom förrendering. Det primära problemet med RTAOs bildkvalité är förekomsten av visuellt brus. Detta är extra tydligt runt konturerna på de objekt som är animerade och förflyttar sig. Hursomhelst är GTAO attraktivt då denna metod kan beräknas betydligt snabbare än RTAO. Samtliga GTAOs prestandatester visade på beräkningstider under en millisekund. Vid en upplösning på 1080p med två prov per pixel (samples per pixel) var beräkningstiden för RTAO 2,253 ms. Kostnaden för att uppdatera datastrukturerna för strålspårningen visade sig också vara betydlig i många tester. Sammantaget indikerar resultaten att hårdvaruaccelererad strålspårning kan resultera i en signifikant förbättring av bildkvalité men att det kan innebära en kostnad som kräver betänklighet. Nyckelord Ambient ocklusion, strålspårning, realtid, animation Acknowledgments | iii Acknowledgments I wish to thank my supervisor Christopher Peters for providing valuable advice and feedback. Stockholm, June 2021 Fabian Waldner iv | Acknowledgments CONTENTS | v Contents 1 Introduction1 1.1 Background ........................... 1 1.2 Purpose ............................. 3 1.3 Research question ........................ 4 1.3.1 Research question 1 - evaluating image quality . 6 1.3.2 Research question 2 - evaluating performance . 6 1.3.3 Summary ........................ 7 1.4 Hypothesis ........................... 7 1.5 Goals .............................. 8 1.6 Research methodology ..................... 8 1.7 Delimitations .......................... 10 1.8 Structure of the thesis ...................... 13 2 Background 15 2.1 Ray tracing ........................... 15 2.1.1 Overview of the ray tracing rendering model . 15 2.1.2 Path tracing and the rendering equation . 18 2.1.3 Real-time rendering and rasterisation . 20 2.1.4 Real-time ray tracing . 21 2.2 Ambient occlusion ....................... 25 2.2.1 Ambient occlusion ................... 25 2.2.2 Ray traced ambient occlusion (RTAO) . 28 2.2.3 Screen space ambient occlusion (SSAO) . 29 2.3 Denoising ............................ 30 2.4 Animation ............................ 33 2.4.1 Rigid-body transformation . 33 2.4.2 Vertex-blending or "skinning" . 34 2.5 SSIM .............................. 34 2.5.1 Image quality assessment . 34 vi | CONTENTS 2.5.2 Structural similarity index metric (SSIM) . 35 2.6 Related work .......................... 36 2.6.1 Crytek SSAO ...................... 36 2.6.2 Horizon-based ambient occlusion . 37 2.6.3 Ground truth ambient occlusion (GTAO) . 40 2.6.4 RTAO and SSAO .................... 43 3 Method 45 3.0.1 Overview of the experimental design . 45 3.0.2 Image quality tests ................... 46 3.0.3 Performance tests .................... 49 3.1 Execution ............................ 50 3.1.1 Image quality tests ................... 51 3.1.2 Performance tests .................... 53 4 Evaluation 57 4.1 Results and analysis ....................... 57 4.2 Image quality tests ....................... 58 4.2.1 Scenario IQ.1 SSIM scores . 58 4.2.2 Scenario IQ.2 SSIM scores . 62 4.2.3 Scenario IQ.3 SSIM scores . 65 4.2.4 Visual inspection .................... 69 4.3 Performance tests ........................ 79 4.3.1 Scenario P.1 ....................... 79 4.3.2 Scenario P.2 & P.3 ................... 85 4.4 Discussion ............................ 91 4.4.1 On research question 1 - evaluating image quality . 91 4.4.2 On research question 2 - evaluating performance . 93 4.4.3 On the main research question . 95 4.5 Limitations ........................... 97 5 Future work and conclusion 101 5.1 Future work . 101 5.2 Conclusion . 102 References 105 A Videos 111 A.1 Extended figures . 111 A.2 Scenario IQ.1 videos . 113 Contents | vii A.2.1 RTAO . 113 A.2.2 GTAO . 113 A.2.3 GTAO Full-resolution . 113 A.3 Scenario IQ.2 videos . 114 A.3.1 RTAO . 114 A.3.2 GTAO . 114 A.3.3 GTAO Full-resolution . 114 A.4 Scenario IQ.3 videos . 115 A.4.1 RTAO . 115 A.4.2 GTAO . 115 A.4.3 GTAO Full-resolution . 115 viii | Contents LIST OF FIGURES | ix List of Figures 1.1 An illustration of the difference between constant ambient lightning and ambient occlusion (right image). Ambient occlusion can convey a lot of information about the form of an object and bring out details, while the constant ambient lightning only conveys the silhouette. Image taken from [1]. "Dragon" model, by Delatronic, Benedikt Bitterli Rendering Resources, licensed under CC BY 3.0. ............. 2 2.1 An illustration of a simple pinhole camera model. This camera model, when altered slightly, is a conceptual building block for rendering images with ray tracing. 15 2.2 A simple ray tracing model, describing some fundamental concepts. The image plane is divided into a grid, each cell representing a picture element (pixel). The colour of the pixel indicated in this illustration would be calculated by including the contributions of the reflection ray, the shadow ray