BACHELOR's THESIS GPU-Based Real Time Rendering of 3D-Video
Total Page:16
File Type:pdf, Size:1020Kb
2010:011 HIP BACHELOR'S THESIS GPU-based real time rendering of 3D-Video Kennet Johansson Luleå University of Technology BSc Programmes in Engineering BSc programme in Computer Engineering Department of Skellefteå Campus Division of Leisure and Entertainment 2010:011 HIP - ISSN: 1404-5494 - ISRN: LTU-HIP-EX--10/011--SE GPU-based real time rendering of 3D-Video Kennet Johansson Supervised by Roger Olsson (MIUN) Abstract This thesis was the result of a project to create a rendering pipeline capable of rendering a variable number of disparate views from a V+D (video plus depth) video source for usage with a lenticular display. I initially based the work on a thesis written in 2006 by one E.I. Verburg at the Technische Universiteit Eindhoven called 'GPU-based Rendering to a Multiview Display' but lack of implementationsal details led me to create my own algorithm focusing on multiple render targets. Within I explain the background of the project, about 3D video and formats and the details of the rendering engine and the algorithm that was developed with a final discussion on the practical usefulness of the resulting images, which amounts to the algorithm working but being potentially unnecessary due to the rapid increase in GPU processing power. Sammanfattning Detta examensarbete var resultatet av ett projekt för att skapa en renderingspipeline kapabel att rendera ett variabelt nummer av skilda vyer från en V+D (video plus depth) videokälla för användning med lentikulära displayer. Jag baserade först arbetet på ett tidigare examensarbete skrivet av en E.I. Verburg vid Technische Universiteit Eindhoven kallat ' GPU-based Rendering to a Multiview Display' men avsaknad av implementationsdetaljer ledde mig till att skapa min egen algoritm fokuserande på användning av multiple render targets. I detta dokument förklarar jag bakgrunden till projektet, om 3D video och format och detaljerna kring renderingspipelinen och den utvecklade algoritmen samt en slutgiltig diskussion om dess praktiska användbarhet, villken kommer fram till att algoritmen fungerar men är möjligen onödig på grund av den snabba ökningen av prestanda hos grafik processorer. Abbreviations and terms • fps: Frames per second. A measurement of rendering efficiency. • API: Application programming interface. • GPU: Graphics processing unit. • OpenGL: A free multi-platform graphics API. (1.2) • Shading language: A miniature programming language for writing programs for the GPU. • GLSL: OpenGL shading language. A shading language developed alongside OpenGL. (1.2.1) • Vertex shader: A program run on the GPU which primarily manipulates the positions of the vertices of the geometry that make up graphical objects. • Geometry shader: A program run on the GPU which primarily manipulates the shapes that are created from the vertices and which ultimately are rasterized to produce the fragments. • Fragment shader: A program run on the GPU which primarily manipulates the so called fragments which ultimately become the output pixels. • V+D: Video plus depth, a 3D video format (1.1.2.1). • MRT, MRTs: Multiple render targets. A feature of modern GPUs where multiple colors can be output from the fragment shader at the same time. Index 1. Introduction.............................................................................................................................1 1.1 Background..................................................................................................................1 1.1.1 Realistic 3D..........................................................................................................1 1.1.2 3D-video..............................................................................................................1 1.1.2.1 3D-video formats..........................................................................................2 1.2 OpenGL and general graphics.................................................................................3 1.2.1 GLSL, the GPU and general shader programming..............................................3 1.3 Purpose and goal..........................................................................................................4 1.3.1 Technical specification.........................................................................................5 1.4 Related work................................................................................................................5 2. Methods...................................................................................................................................7 2.1 Engine..........................................................................................................................7 2.1.2 Rendering.............................................................................................................7 2.1.2.1 Passes...........................................................................................................7 2.1.3 Utilities.................................................................................................................8 2.1.3.1 Content creation/loading..............................................................................8 2.1.3.2 Mathematics.................................................................................................9 2.1.3.3 Other utilities................................................................................................9 2.2 View Rendering...........................................................................................................9 2.2.1 Micro-polygon displacement mapping................................................................9 2.2.2 Multiple render targets.......................................................................................10 2.2.3 Multiple views with MRTs.................................................................................10 2.2.4 Implementation..................................................................................................11 2.2.4.1 Data............................................................................................................11 2.2.4.2 Initialization................................................................................................11 2.2.4.3 Shaders.......................................................................................................13 2.2.4.4 Geometry shader........................................................................................13 2.2.4.5 Rendering...................................................................................................13 2.2.4.6 Optimizations.............................................................................................14 2.2.5 Multiple views without MRTs............................................................................14 3. Results and future work........................................................................................................16 3.1 Visuals........................................................................................................................16 3.2 Performance...............................................................................................................17 3.3 Conclusion.................................................................................................................19 4. Discussion.............................................................................................................................21 5. References.............................................................................................................................22 1. Introduction This section contains some basic information on the background of the project (section 1.1) as well as general information about relevant concepts and tools (section 1.2), the technological specifications that I sought to meet (section 1.3) and finally some information on related work (section 1.4). 1.1 Background This thesis work was done for the Realistic 3D research group at the Mid Sweden University over a period of about 8 weeks in the spring of 2010. I received a proposal to write a rendering engine for extrapolating compressed 3D-video in response to my application for thesis work relating to systems- and/or graphics programming, which I've made the focus of my studies. The following sections briefly describe the research as well as information about 3D video and 3D video formats. 1.1.1 Realistic 3D Realistic 3D is a collective term for a number of research projects being conducted at Mid Sweden University. The focus of the research is on the capture, coding, synthesis and uses of auto-stereoscopic 3D-video in entertainment as well as other areas, for example medicine. [1] 1.1.2 3D-video The meaning of 3D-video is video which when viewed correctly gives the impression of depth. This effect is created when the observers eyes view an object or scene from different angles. Today there are two sets of technologies for creating this effect: • Stereoscopy: The traditional kind of 3D video utilizing specially designed peripherals that either filter the light shown on the screen in such a way that the eyes see two different views or which are otherwise capable of showing two different video streams. • Auto-stereoscopy: Display devices that are capable of creating a 3D effect without the use of peripherals. For plain stereoscopy alternatives include 3D glasses of different sorts including the familiar usually red-blue anaglyphic[2] glasses as well as newer models which