Cascaded Voxel Cone-Tracing Shadows a Computational Performance Study
Total Page:16
File Type:pdf, Size:1020Kb
Bachelor of Science in Computer Science June 2019 Cascaded Voxel Cone-Tracing Shadows A Computational Performance Study Dan Sjödahl Faculty of Computing, Blekinge Institute of Technology, 371 79 Karlskrona, Sweden This thesis is submitted to the Faculty of Computing at Blekinge Institute of Technology in partial fulfilment of the requirements for the degree of Bachelor of Science in Computer Science. The thesis is equivalent to 10 weeks of full time studies. The authors declare that they are the sole authors of this thesis and that they have not used any sources other than those listed in the bibliography and identified as references. They further declare that they have not submitted this thesis at any other institution to obtain a degree. Contact Information: Author(s): Dan Sjödahl E-mail: [email protected] University advisors: Stefan Petersson DIDA Hans Tap DIDA Faculty of Computing Internet : www.bth.se Blekinge Institute of Technology Phone : +46 455 38 50 00 SE-371 79 Karlskrona, Sweden Fax : +46 455 38 50 57 ii ABSTRACT Background. Real-time shadows in 3D applications have for decades been implemented with a solution called Shadow Mapping or some variant of it. This is a solution that is easy to implement and has good computational performance, nevertheless it does suffer from some problems and limitations. But there are newer alternatives and one of them is based on a technique called Voxel Cone-Tracing. This can be combined with a technique called Cascading to create Cascaded Voxel Cone-Tracing Shadows (CVCTS). Objectives. To measure the computational performance of CVCTS to get better insight into it and provide data and findings to help developers make an informed decision if this technique is worth exploring. And to identify where the performance problems with the solution lies. Methods. A simple implementation of CVCTS was implemented in OpenGL aimed at simulating a solution that could be used for outdoor scenes in 3D applications. It had several different parameters that could be changed. Then computational performance measurements were made with these different parameters set at different settings. Results. The data was collected and analyzed before drawing conclusions. The results showed several parts of the implementation that could potentially be very slow and why this was the case. Conclusions. The slowest parts of the CVCTS implementation was the Voxelization and Cone- Tracing steps. It might be possible to use the CVCTS solution in the thesis in for example a game if the settings are not too high but that is a stretch. Little time could be spent during the thesis to optimize the solution and thus it’s possible that its performance could be increased. Keywords: Shadows, Voxel Cone-Tracing, Rendering, Real-Time iii ACKNOWLEDGEMENTS I would like to thank my thesis advisors Stefan Petersson and Hans Tap for their help. I would also like to thank the Stanford Computer Graphics Laboratory for use of the Stanford Dragon 3D model that I use for computational performance measurements. Lastly, I would like to thank Tobias Pogén for his opposition feedback that helped make the thesis better. iv CONTENTS ABSTRACT ......................................................................................................................................................... III ACKNOWLEDGEMENTS ................................................................................................................................ IV CONTENTS ........................................................................................................................................................... V 1 INTRODUCTION ........................................................................................................................................ 6 1.1 AIM AND OBJECTIVES ............................................................................................................................. 6 1.2 RESEARCH QUESTION ............................................................................................................................. 7 2 BACKGROUND & RELATED WORK .................................................................................................... 8 2.1 VOXEL CONE-TRACING .......................................................................................................................... 8 2.2 VOXELIZATION ....................................................................................................................................... 8 2.3 CONE-TRACING ...................................................................................................................................... 9 2.4 CASCADING ............................................................................................................................................ 9 3 METHOD .................................................................................................................................................... 10 3.1 VOXELIZATION ..................................................................................................................................... 10 3.2 DEFERRED RENDERING ........................................................................................................................ 12 3.3 CONE-TRACING .................................................................................................................................... 12 3.4 CASCADING .......................................................................................................................................... 13 3.5 PERFORMANCE MEASUREMENT ........................................................................................................... 15 3.6 VALIDITY THREATS .............................................................................................................................. 16 4 RESULTS .................................................................................................................................................... 17 4.1 CASCADE COUNT .................................................................................................................................. 17 4.1.1 Desktop ............................................................................................................................................ 18 4.2 CASCADE SIZE ...................................................................................................................................... 19 4.2.1 Desktop ............................................................................................................................................ 20 4.3 CASCADE RESOLUTION ......................................................................................................................... 21 4.3.1 Desktop ............................................................................................................................................ 22 4.4 VERTICES IN SCENE .............................................................................................................................. 22 4.4.1 Desktop ............................................................................................................................................ 23 5 ANALYSIS AND DISCUSSION ............................................................................................................... 25 5.1 CASCADE COUNT .................................................................................................................................. 25 5.2 CASCADE SIZE ...................................................................................................................................... 25 5.3 CASCADE RESOLUTION ......................................................................................................................... 26 5.4 VERTICES IN SCENE .............................................................................................................................. 27 5.5 RELEVANCE OF CVCTS ....................................................................................................................... 28 5.6 FUTURE OF CVCTS .............................................................................................................................. 28 6 CONCLUSION AND FUTURE WORK .................................................................................................. 29 6.1 VOXELIZATION ..................................................................................................................................... 29 6.2 CONE-TRACING .................................................................................................................................... 29 6.3 VISUAL FIDELITY OF SHADOWS ............................................................................................................ 29 REFERENCES .................................................................................................................................................... 30 v 1 INTRODUCTION Shadows are a natural and necessary part of most 3D applications. Since its creation by Williams in 1978 [ 1], Shadow Mapping (SM) has become the standard way of implementing shadows in real-time 3D applications today. It’s a commonly used technique since SM is simple to implement and both cheap and fast to run performance wise. The downside is however that SM often suffers from artefacts such as shadow acne and aliasing [2]. Simply put SM works by rendering the 3D scene to