
Universidade do Minho Escola de Engenharia Departamento de Informática Tiago Manuel da Silva Santos Mobile Ray-tracing April 2019 Universidade do Minho Escola de Engenharia Departamento de Informática Tiago Manuel da Silva Santos Mobile Ray-tracing Master dissertation Master Degree in Computer Science Dissertation supervised by Professor Doutor Luís Paulo Peixoto dos Santos April 2019 ACKNOWLEDGEMENTS Agradeço a todos que me apoiaram, direta ou indiretamente, neste longo percurso académico. Em especial, ao meu orientador, professor Doutor Luís Paulo Peixoto dos Santos que propôs este tema, deu-me sempre boas ideias e por todo o seu apoio. Também, ao professores dos perfis de Computação Gráfica e de Computação Paralela e Distribuída pela excelente formação que deram. A todos os meus amigos que sempre me apoiaram neste longo percurso. Em especial, destaco cinco amigos: João Costa, André Pereira, Miguel Esteves, Eduardo Mendes e Miguel Rego que desde que os conheci me ajudaram muito a ultrapassar diversos obstáculos tanto a nível pessoal como na minha formação académica. Ao grupo Embedded Systems Research Group (ESRG) por me terem acolhido durante uma bolsa de investigação, me tratarem como parte dessa grande família e pelo apoio que sempre me deram. E por último mas não menos importante, à minha família, em especial aos meus irmãos Pedro Santos e Paulo Santos pelos muitos sacrifícios que fizeram para me apoiar e permitir chegar onde cheguei. i ABSTRACT The technological advances and the massification of information technologies have allowed a huge and positive proliferation of the number of libraries and APIs. This large offer has made life easier for programmers in general, because they easily find a library, free or commercial, that helps them solve the daily challenges they have at hand. One area of information technology where libraries are critical is in Computer Graphics, due to the wide range of rendering techniques it offers. One of these techniques is ray tracing. Ray tracing allows to simulate natural electromagnetic phenomena such as the path of light and mechanical phenomena such as the propagation of sound. Similarly, it also allows to simulate technologies developed by men, like Wi-Fi networks. These simulations can have a spectacular realism and accuracy, at the expense of a very high computational cost. The constant evolution of technology allowed to leverage and massify new areas, such as mobile devices. Devices today are increasingly faster, replacing and often complementing tasks that were previously performed only on computers or on dedicated hardware. However, the number of image rendering libraries available for mobile devices is still very scarce, and no ray tracing based image rendering library has been able to assert itself on these devices. This dissertation aims to explore the possibilities and limitations of using mobile devices to execute rendering algorithms that use ray tracing, such as progressive path tracing. Its main goal is to provide a rendering library for mobile devices based on ray tracing. ii RESUMO Os avanços tecnológicos e a massificação das tecnologias de informação permitiu uma enorme e positiva proliferação do número de bibliotecas e APIs. Esta maior oferta permitiu facilitar a vida dos programadores em geral, porque facilmente encontram uma biblioteca, gratuita ou comercial, que os ajudam a resolver os desafios diários que têm em mãos. Uma área das tecnologias de informação onde as bibliotecas são fundamentais é na Computação Gráfica, devido à panóplia de métodos de renderização que oferece. Um destes métodos é o ray tracing. O ray tracing permite simular fenómenos eletromagnéticos naturais como os percursos da luz e fenómenos mecânicos como a propagação do som. Da mesma forma também permite simular tecnologias desenvolvidas pelo homem, como por exemplo redes Wi-Fi. Estas simulações podem ter um realismo e precisão impressionantes, porém têm um custo computacional muito elevado. A constante evolução da tecnologia permitiu alavancar e massificar novas áreas, como os dispositivos móveis. Os dispositivos são hoje cada vez mais rápidos e cada vez mais substituem e/ou complementam tarefas que anteriormente eram apenas realizadas em computadores ou em hardware dedicado. Porém, o número de bibliotecas para renderização de imagens disponíveis para dispositivos móveis é ainda muito reduzido e nenhuma biblioteca de renderização de imagens baseada em ray tracing conseguiu afirmar-se nestes dispositivos. Esta dissertação tem como objetivo explorar possibilidades e limitações da utilização de dispositivos móveis para a execução de algoritmos de renderização que utilizem ray tracing, como por exemplo, o path tracing progressivo. O objetivo principal é disponibilizar uma biblioteca de renderização para dispositivos móveis baseada em ray tracing. iii CONTENTS 1 introduction1 1.1 Context 1 1.2 Motivation 2 1.3 Goals 3 1.4 Applications of Ray Tracing 4 1.5 Document Structure 4 2 state of the art6 2.1 Ray Tracing 6 2.2 Typical CPU features 7 2.3 Key features of Ray Tracing for this work 10 2.3.1 Type of software license 10 2.3.2 Platform 11 2.3.3 Interactivity 11 2.3.4 Progressive 11 2.3.5 Types of Rendering Components 12 2.4 Related work 12 2.4.1 Conclusions 13 3 software architecture - library 14 3.1 Approach 14 3.2 Other approach 17 3.3 Methodology 19 3.4 Library 20 3.4.1 Third parties dependencies 23 3.4.2 Renderer 25 3.4.3 Scene 26 3.4.4 Ray 27 3.4.5 Intersection 27 3.4.6 Material 28 3.4.7 Shapes 29 3.4.8 Acceleration Data Structures 34 3.4.9 Texture 40 3.4.10 Utilities 41 4 software architecture - rendering components 44 4.1 Shaders 45 iv Contents v 4.1.1 DepthMap 47 4.1.2 DiffuseMaterial 49 4.1.3 NoShadows 50 4.1.4 Whitted 52 4.1.5 PathTracer 55 4.2 Samplers 61 4.2.1 Constant 61 4.2.2 Stratified 62 4.2.3 HaltonSequence 62 4.2.4 MersenneTwister 63 4.3 Lights 64 4.3.1 Point light 65 4.3.2 Area light 66 4.4 Cameras 68 4.4.1 Perspective Camera 71 4.4.2 Orthographic Camera 72 4.5 Object Loaders 74 5 android layer 76 5.1 Android specifics 76 5.2 User Interface 78 5.3 Programming decisions 81 5.3.1 Android benefits 82 5.3.2 Android challenges 82 5.3.3 Compatibility 83 6 demonstration: global illumination 84 6.1 Results obtained 87 6.1.1 Whitted Shader 88 6.1.2 Path Tracing Shader 98 6.2 Comparison with Android CPU Raytracer (Dahlquist) 100 7 conclusion & future work 102 7.1 Conclusions 102 7.2 Future Work 103 8 bibliography 104 a api 110 Appendices 110 b loading a scene 124 c execution times 127 Contents vi c.1 Whitted 127 c.1.1 Samsung 127 c.1.2 Nokia 3.1 128 c.1.3 Nokia 7.1 129 c.2 Path Tracing 130 LISTOFFIGURES Figure 1 Illustration of the most common mobile devices - tablet and smartphone (du Net). 2 Figure 2 Illustration of a variety of mobile devices compatible with Android (COOLFINESSE( 2017)). 3 Figure 3 Illustration of a typical ray tracer algorithm (Galaxie). 6 Figure 4 Illustration of a typical cache memory inside a microprocessor (Karbo and Aps.). 7 Figure 5 Illustration of the Classic RISC multilevel CPU pipeline (Dictionaries and Encyclopedias). 8 Figure 6 Illustration of a simple superscalar pipeline (Wikipedia(a)). 9 Figure 7 Illustration of a typical execution of SIMD extension (Bishop). 10 Figure 8 Illustration of the developed graphical user interface. 15 Figure 9 Illustration of the three layers in the application. 16 Figure 10 Illustration of the three layers in Linux native application. 17 Figure 11 Linux native application using the MobileRT. The scene rendered is the famous Cornell Box at 1024x768 and with 20000 spp and 1 spl. 18 Figure 12 Comparison of a scene rendered with MobileRT Path Tracer (left) and with PBRT Path Tracer (right). 19 Figure 13 Illustration of the three layers in the application. 20 Figure 14 Class diagram of the library. 22 Figure 15 The Conference scene rendered with OpenGL ES 2.0 before ray tracing the scene. 24 Figure 16 Illustration of tiling the image plane. 26 Figure 17 Illustration of a ray intersecting a plane (Vink). 31 Figure 18 Illustration of a ray intersecting a sphere in two points (Chirag). 33 Figure 19 Illustration of a ray intersecting a triangle (Scratchapixel). 34 Figure 20 Illustration of traversing a Regular Grid acceleration structure. 37 Figure 21 Illustration of traversing of a Kd-tree acceleration structure. 38 Figure 22 Illustration of traversing a Bounding Volume Hierarchy acceleration structure. 39 Figure 23 Illustration of how Surface Area Heuristic works in Bounding Volume Hierarchy acceleration structure (Lahodiuk). 40 Figure 24 Illustration of San Miguel scene with many textures used. 41 vii List of Figures viii Figure 25 Illustration of the three layers in the application. 45 Figure 26 Illustration of the rendering equation describing the total amount of light emitted from a point x along a particular viewing direction and given a function for incoming light and a BRDF (Wikipedia(g)). 46 Figure 27 Class diagram of the Shaders. 46 Figure 28 DepthMap shader. 48 Figure 29 DiffuseMaterial shader. 50 Figure 30 NoShadows shader. 52 Figure 31 Cornell box rendered with Whitted shader. 55 Figure 32 Cornell box with Buddha model rendered with Path Tracer shader at 992x1200. 59 Figure 33 Illustration of a scene rendered with PathTracer at 496x496 with 10000 spp and 1 spl. 60 Figure 34 Class diagram of the Samplers. 61 Figure 35 Difference between quasi random sequence and pseudo random sequence. 62 Figure 36 Class diagram of the Lights.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages149 Page
-
File Size-