GPU Volume Voxelization Exploration of the Performance Characteristics of Different GPU-Based Implementations

Total Page:16

File Type:pdf, Size:1020Kb

GPU Volume Voxelization Exploration of the Performance Characteristics of Different GPU-Based Implementations EXAMENSARBETE INOM TEKNIK, GRUNDNIVÅ, 15 HP STOCKHOLM, SVERIGE 2019 GPU Volume Voxelization Exploration of the performance characteristics of different GPU-based implementations GRIGORY GLUKHOV ALEKSANDRA SOLTAN KTH SKOLAN FÖR ELEKTROTEKNIK OCH DATAVETENSKAP GPU Volume Voxelization Exploration of the performance characteris- tics of different GPU-based implementations Aleksandra Soltan Grigory Glukhov Examiner Johan Montelius Supervisor Thomas Sjöland A thesis presented for the degree of Bachelor of Information and Communication Technology KTH Royal Institute of Technology School of Electrical Engineering and Computer Science SE-100 44 Stockholm, Sweden June 2019 page intentionally left blank 1 Abstract In recent years, voxel-based modelling has seen a reintroduction to computer game development through massive graphics hardware improvements. Never- theless, polygons continue to be the default building block of 3D objects, intro- ducing a need for the transformation of polygon meshes into voxel-based models; this process is known as voxelization. Efficient voxelization algorithms take ad- vantage of the flexibility and control offered by modern, programmable GPU pipelines. However, the variability in possible approaches poses the question of how different GPU-based implementations affect voxelization performance. This thesis explores the impact of GPU-based improvements by comparing four different implementations of a solid voxelization algorithm. The implemen- tations include a naive transition from the CPU to the GPU, a non-branching execution path approach, data pre-processing, and a combination of the two previous approaches. Benchmarking experiments run on four, standard polygo- nal models and three graphics cards (NVIDIA and AMD) provide runtime and memory usage data for each implementation. A comparative analysis is per- formed on the basis of this data to determine the performance impact of the GPU-based adjustments to the voxelization algorithm implementation. Results indicate that the non-branching execution path approach yields clear improvements over the naive implementation, while data pre-processing has in- consistent performance and a large initial performance cost; the combination of the two improvements unsurprisingly leads to combined results. Therefore, the conclusive recommendation is using the non-branching execution path technique for GPU-based improvements. Keywords voxelization, GPU, GPGPU, SIMT, thread divergence, Vulkan API 2 Sammanfattning Voxel-baserad modellering har på senare år blivit återintroducerat till datorspel- sutveckling tack vare massiva förbättringar i grafikhårdvara. Trots detta fortsät- ter polygoner att vara standarden för uppbyggnaden av 3D-objekt. Detta gör det nödvändigt att kunna transformera polygonytor till voxel-baserade mod- eller; denna process kallas för voxelisering. Effektiva voxeliseringsalgoritmer tar vara på den flexibilitet och kontroll som ges av moderna, programmerbara GPU-pipelines. Variationen i möjliga tillvägagångssätt gör det dock intressant att veta hur olika GPU-baserade implementationer påverkar prestandan av vox- eliseringen. Denna avhandling undersöker påverkan av GPU-baserade förbättringar gen- om att jämföra fyra olika implementationer av en solid-voxeliseringsalgoritm. Implementationerna inkluderar en naiv övergång från CPU:n till GPU:n, en metod med en non-branching exekveringsväg, förbehandling av data, och en kombination av det två tidigare metoderna. Benchmarking-experiment görs på fyra standardpolygonmodeller och tre grafikkort (NVIDIA och AMD) förser data för exekveringstid och minnesåtgång för varje implementation. En jäm- förande analys görs med detta data som grund för att bestämma den påverkan som de GPU-baserade ändringarna har på prestandan av voxeliseringsalgorit- mens implementation. Resultaten indikerar att implementationen med en non-branching exekver- ingsväg ger klara förbättringar över den naiva implementationen, medans förbe- handlingen av data presterar inkonsekvent och har en stor initial prestandakost- nad; kombinationen av dem båda ledde, inte överraskande, till blandade resul- tat. Den slutgiltiga rekommendationen är således att använda tekniken med en non-branching exekveringsväg för GPU-baserade förbättringar. Nyckelord voxelization, GPU, GPGPU, SIMT, tråd divergering, Vulkan API 3 Acknowledgements Special thanks go to Igor Glukhov for helping us make figures, Michael Schwarz for responding to our email regarding details of the implementation of his al- gorithm, Erik Bauer for translating our abstract to Swedish, as well as Johan Montelius and Thomas Sjöland for answering thesis-related questions. Addi- tionally, we would like to thank the Stanford Computer Graphics Laboratory for publishing the 3D meshes used in our experiments. Finally, we thank Mutate for hosting this thesis for two months. Stockholm, June 2019 Aleksandra Soltan and Grigory Glukhov 4 Contents Abstract 2 Sammanfattning 3 Acknowledgements 4 Contents 5 List of Figures 7 List of Tables 7 1 Introduction 8 1.1 Background . .8 1.2 Problem definition . 11 1.3 Purpose . 11 1.4 Goals . 11 1.5 Research methodology . 12 1.6 Delimitations . 12 1.6.1 Existing algorithm . 12 1.6.2 Single algorithm . 12 1.6.3 GPU-specific evaluation . 13 1.7 Structure of the thesis . 14 2 Background 14 2.1 GPU programmability . 14 2.1.1 GPU computing . 14 2.1.2 Graphics APIs . 15 2.1.3 Compute shaders . 15 2.2 Voxelization . 16 2.2.1 Rasterization . 16 2.2.2 Triangle-box test . 17 2.2.3 Sparse Voxel Octrees . 18 2.2.4 Schwarz and Seidel algorithm . 19 2.3 Related work . 22 2.3.1 Surface voxelization . 22 2.3.2 Solid voxelization . 23 3 Experimental methodology 24 3.1 Tested implementations . 24 3.2 Experimental setup and data collection . 24 3.2.1 Models . 24 3.2.2 Experimental design and implementation . 25 3.2.3 Data collection . 26 3.3 Testing environment . 27 5 3.3.1 Hardware . 27 3.3.2 Software . 27 4 Design and implementation 27 4.1 Design . 28 4.1.1 Naive approach . 28 4.1.2 Non-branching execution path approach . 28 4.1.3 Data pre-processing approach . 28 4.1.4 Combined approach . 28 4.2 Implementation . 30 4.2.1 Naive approach . 32 4.2.2 Non-branching execution path approach . 32 4.2.3 Data pre-processing approach . 32 4.2.4 Combined approach . 33 5 Results and analysis 33 5.1 Major results . 33 5.1.1 Mean runtime performance . 34 5.1.2 Relative runtime performance . 36 5.1.3 Mean runtime performance with pre-processing . 38 5.1.4 GPU memory requirement . 40 5.2 Discussion . 41 5.2.1 Runtime performance . 41 5.2.2 Memory performance . 42 6 Conclusions and future work 42 6.1 Conclusions . 42 6.2 Limitations . 42 6.3 Future work . 43 References 44 Appendix 49 6 List of Figures 1 Graphics pipeline . .9 2 Voxelization . 10 3 Edge function test . 16 4 Triangle plane test . 18 5 Example octree . 19 6 Tile assignment . 21 7 Tile processing . 22 8 Tested meshes . 25 9 Experiment design structure. 26 10 Implementation flow chart . 29 11 Tile data structure . 31 12 Triangle data structure . 33 13 Mean runtime performance results (GTX 1070) . 34 14 Mean runtime performance results (RTX 2070) . 35 15 Mean runtime performance results (RX Vega 64) . 35 16 Relative runtime improvement results (GTX 1070) . 36 17 Relative runtime improvement results (RTX 2070) . 37 18 Relative runtime improvement results (RX Vega 64) . 37 19 Runtime results with pre-processing (GTX 1070) . 39 20 Runtime results with pre-processing (RTX 2070) . 39 21 Runtime results with pre-processing (RX Vega 64) . 40 22 Memory requirement results . 41 List of Tables 1 Algorithm comparison on basis of criteria fulfillment . 13 2 Testbed hardware setups . 27 3 Average voxelization times for different meshes, excluding pre- processing time. 36 7 1 Introduction For decades polygons have been the default building block of 3D models in computer graphics. However, recent claims regarding "unlimited detail" [1], improved scalability [2], and intuitive content manipulation [2] have reignited interest in voxel representation of 3D data. Voxels are discrete cubes used to construct volumetric objects; due to voxels’ comparability to real world atoms, they offer a higher level of detail and greater freedom for manipulation of 3D models. Voxel model representation has long been widely used in medical imag- ing like CAT scans and MRIs [3, 4]; recently, its use in computer game develop- ment has accelerated, with applications such as Global Illumination [5], terrain representation [6], and pathfinding [7]. The process of transforming a polygon representation of a 3D model into a voxel-based one is called voxelization. Several notable algorithms detailing this process come from a 2010 report by Schwarz and Seidel [8]; their binary voxelization methods are the current defining work in the field, having inspired several papers proposing novel approaches to voxelization [9–13]. Schwarz and Seidel utilize the programmability offered by modern GPUs through NVIDIA’s CUDA parallel computing platform, which allows far more flexibility and control over how data is computed and processed on the GPU. Breaking out of the limitations of fixed-function rasterization leads to new approaches like direct voxelization into Sparse Voxel Octrees [8, 14, 15]. Within Schwarz and Seidel’s tile-based solid voxelization algorithm there are opportunities for varying GPU-based implementations, ranging from a simple, naive approach to advanced, multiple-pass techniques with data pre-processing. Therefore, this thesis proposes four different implementations in order to com- pare the effects
Recommended publications
  • Studio Toolkit for Flexibles 14 User Guide
    Studio Toolkit for Flexibles 14 User Guide 06 - 2015 Studio Toolkit for Flexibles Contents 1. Copyright Notice.......................................................................................................................................................................... 4 2. Introduction.....................................................................................................................................................................................6 2.1 About Studio....................................................................................................................................................................... 6 2.2 Workflow and Concepts................................................................................................................................................. 7 2.3 Quick-Start Tutorial...........................................................................................................................................................8 3. Creating a New Bag.................................................................................................................................................................12 3.1 Pillow Bags........................................................................................................................................................................13 3.1.1 Panel Order and Fin vs. Lap Seals.............................................................................................................14 3.2 Gusseted Bags.................................................................................................................................................................15
    [Show full text]
  • Compression and Streaming of Polygon Meshes
    Compression and Streaming of Polygon Meshes by Martin Isenburg A dissertation submitted to the faculty of the University of North Carolina at Chapel Hill in partial fulfillment of the requirements for the degree of Doctor of Philosophy in the Department of Computer Science. Chapel Hill 2005 Approved by: Jack Snoeyink, Advisor Craig Gotsman, Reader Peter Lindstrom, Reader Dinesh Manocha, Committee Member Ming Lin, Committee Member ii iii ABSTRACT MARTIN ISENBURG: Compression and Streaming of Polygon Meshes (Under the direction of Jack Snoeyink) Polygon meshes provide a simple way to represent three-dimensional surfaces and are the de-facto standard for interactive visualization of geometric models. Storing large polygon meshes in standard indexed formats results in files of substantial size. Such formats allow listing vertices and polygons in any order so that not only the mesh is stored but also the particular ordering of its elements. Mesh compression rearranges vertices and polygons into an order that allows more compact coding of the incidence between vertices and predictive compression of their positions. Previous schemes were designed for triangle meshes and polygonal faces were triangulated prior to compression. I show that polygon models can be encoded more compactly by avoiding the initial triangulation step. I describe two compression schemes that achieve better compression by encoding meshes directly in their polygonal representation. I demonstrate that the same holds true for volume meshes by extending one scheme to hexahedral meshes. Nowadays scientists create polygonal meshes of incredible size. Ironically, com- pression schemes are not capable|at least not on common desktop PCs|to deal with giga-byte size meshes that need compression the most.
    [Show full text]
  • Meshes and More CMSC425.01 Fall 2019 Administrivia
    Meshes and More CMSC425.01 fall 2019 Administrivia • Google form distributed for grading issues Today’s question How to represent objects Polygonal meshes • Standard representation of 3D assets • Questions: • What data and how stored? • How generate them? • How color and render them? Data structure • Geometric information • Vertices as 3D points • Topology information • Relationships between vertices • Edges and faces Vertex and fragment shaders • Mapping triangle to screen • Map and color vertices • Vertex shaders in 3D • Assemble into fragments • Render fragments • Fragment shaders in 2D Normals and shading – shading equation • Light eQuation • k terms – color of object • L terms – color of light • Ambient term - ka La • Constant at all positions • Diffuse term - kd (n • l) • Related to light direction • Specular term - (v • r)Q • Related to light, viewer direction Phong exponent • Powers of cos (v • r)Q • v and r normalized • Tightness of specular highlights • Shininess of object Normals and shading • Face normal • One per face • Vertex normal • One per vertex. More accurate • Interpolation • Gouraud: Shade at vertices, interpolate • Phong: Interpolate normals, shade Texture mapping • Vary color across figure • ka, kd and ks terms • Interpolate position inside polygon to get color • Not trivial! • Mapping complex Bump mapping • “Texture” map of • Perturbed normals (on right) • Perturbed height (on left) Summary – full polygon mesh asset • Mesh can have vertices, faces, edges plus normals • Material shader can have • Color (albedo) •
    [Show full text]
  • The Application of Voxel Size Correction in X-Ray Computed Tomography for Dimensional Metrology
    SINCE2013 Singapore International NDT Conference & Exhibition 2013, 19-20 July 2013 The Application of Voxel Size Correction in X-ray Computed Tomography for Dimensional Metrology Joseph J. LIFTON1,2, Andrew A. MALCOLM2, John W. MCBRIDE1,3, Kevin J. CROSS1 1The University of Southampton, United Kingdom; Email: [email protected]. 2Singapore Institute of Manufacturing Technology, Singapore; Email: [email protected]. 3The University of Southampton Malaysia Campus (USMC), Malaysia; Email: [email protected]. Abstract X-ray computed tomography (CT) is a non-destructive, radiographic scanning technique that enables the visualisation and dimensional evaluation of both internal and external features of a workpiece; it is therefore an attractive alternative for measurement tasks that prove problematic for conventional tactile and optical instruments. The data output of a CT measurement is a volume of grey value integers that describe the material distribution of the scanned workpiece; the relative spacing of volume-elements (voxels) is termed voxel size and influences all dimensional information evaluated from a CT data-set. Voxel size is defined by the position of a workpiece relative to the X-ray source and detector, and is therefore prone to axis position errors, errors in the geometric alignment of the CT system’s hardware, and the positional drift of the X-ray focal spot. In this work a method is presented for calculating a voxel scaling factor that corrects for voxel size errors, and this method is then applied to a general X-ray CT measurement task and demonstrated to reduce measurement errors. Keywords: X-ray computed tomography, dimensional metrology, calibration, uncertainty, voxel size.
    [Show full text]
  • Notes on Polygon Meshes 1 Basic Definitions
    CMSC 23700 Introduction to Computer Graphics Handout 2 Autumn 2015 November 12 Notes on polygon meshes 1 Basic definitions Definition 1 A polygon mesh (or polymesh) is a triple (V; E; F ), where V a set of vertices (points in space) E ⊂ (V × V ) a set of edges (line segments) F ⊂ E∗ a set of faces (convex polygons) with the following properties: 1. for any v 2 V , there exists (v1; v2) 2 E such that v = v1 or v = v2. 2. for and e 2 E, there exists a face f 2 F such that e is in f. 3. if two faces intersect in space, then the vertex or edge of intersection is in the mesh. If all of the faces of a polygon mesh are triangles, then we call it a triangle mesh (trimesh). Polygons can be tessellated to form triangle meshes. Definition 2 We classify edges in a mesh based on the number of faces they are part of: • A boundary edge is part of exactly one face. • An interior edge is part of two or more faces. • A manifold edge is part of exactly two faces. • A junction edge is part of three or more faces. Junction edges are to be avoided; they can cause cracks when rendering the mesh. Definition 3 A polymesh is connected if the undirected graph G = (VF ;EE), called the dual graph, is connected, where • VF is a set of graph vertices corresponding to the faces of the mesh and • EE is a set of graph edges connecting adjacent faces.
    [Show full text]
  • Creating Simplified 3D Models with High Quality Textures
    University of Wollongong Research Online Faculty of Engineering and Information Sciences - Faculty of Engineering and Information Sciences Papers: Part A 2015 Creating Simplified 3D oM dels with High Quality Textures Song Liu University of Wollongong, [email protected] Wanqing Li University of Wollongong, [email protected] Philip O. Ogunbona University of Wollongong, [email protected] Yang-Wai Chow University of Wollongong, [email protected] Publication Details Liu, S., Li, W., Ogunbona, P. & Chow, Y. (2015). Creating Simplified 3D Models with High Quality Textures. 2015 International Conference on Digital Image Computing: Techniques and Applications, DICTA 2015 (pp. 264-271). United States of America: The Institute of Electrical and Electronics Engineers, Inc.. Research Online is the open access institutional repository for the University of Wollongong. For further information contact the UOW Library: [email protected] Creating Simplified 3D oM dels with High Quality Textures Abstract This paper presents an extension to the KinectFusion algorithm which allows creating simplified 3D models with high quality RGB textures. This is achieved through (i) creating model textures using images from an HD RGB camera that is calibrated with Kinect depth camera, (ii) using a modified scheme to update model textures in an asymmetrical colour volume that contains a higher number of voxels than that of the geometry volume, (iii) simplifying dense polygon mesh model using quadric-based mesh decimation algorithm, and (iv) creating and mapping 2D textures to every polygon in the output 3D model. The proposed method is implemented in real-Time by means of GPU parallel processing. Visualization via ray casting of both geometry and colour volumes provides users with a real-Time feedback of the currently scanned 3D model.
    [Show full text]
  • Temporal Voxel Cone Tracing with Interleaved Sample Patterns by Sanghyeok Hong
    c 2015, SangHyeok Hong. All Rights Reserved. The material presented within this document does not necessarily reflect the opinion of the Committee, the Graduate Study Program, or DigiPen Institute of Technology. TEMPORAL VOXEL CONE TRACING WITH INTERLEAVED SAMPLE PATTERNS BY SangHyeok Hong THESIS Submitted in partial fulfillment of the requirements for the degree of Master of Science in Computer Science awarded by DigiPen Institute of Technology Redmond, Washington United States of America March 2015 Thesis Advisor: Gary Herron DIGIPEN INSTITUTE OF TECHNOLOGY GRADUATE STUDIES PROGRAM DEFENSE OF THESIS THE UNDERSIGNED VERIFY THAT THE FINAL ORAL DEFENSE OF THE MASTER OF SCIENCE THESIS TITLED Temporal Voxel Cone Tracing with Interleaved Sample Patterns BY SangHyeok Hong HAS BEEN SUCCESSFULLY COMPLETED ON March 12th, 2015. MAJOR FIELD OF STUDY: COMPUTER SCIENCE. APPROVED: Dmitri Volper date Xin Li date Graduate Program Director Dean of Faculty Dmitri Volper date Claude Comair date Department Chair, Computer Science President DIGIPEN INSTITUTE OF TECHNOLOGY GRADUATE STUDIES PROGRAM THESIS APPROVAL DATE: March 12th, 2015 BASED ON THE CANDIDATE'S SUCCESSFUL ORAL DEFENSE, IT IS RECOMMENDED THAT THE THESIS PREPARED BY SangHyeok Hong ENTITLED Temporal Voxel Cone Tracing with Interleaved Sample Patterns BE ACCEPTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE IN COMPUTER SCIENCE AT DIGIPEN INSTITUTE OF TECHNOLOGY. Gary Herron date Xin Li date Thesis Committee Chair Thesis Committee Member Pushpak Karnick date Matt
    [Show full text]
  • Modeling: Polygonal Mesh, Simplification, Lod, Mesh
    The Modeling-Rendering Paradigm Modeler: Renderer: EECS 487: Interactive Modeling complex shapes Vertex data • no equation For a chair, Face, etc. Fixed function transForm and Vertex shader • instead, achieve complexity using lighting Computer Graphics simple pieces • polygons, parametric surfaces, or Clip, homogeneous divide and viewport Lecture 36: implicit surfaces scene graph Rasterize • Polygonal mesh simplification • with arbitrary precision, in principle Texture stages Fragment shader Fragment merging: stencil, depth 3D Geometry Representations 2D: Range Image Represent different kinds oF inFormation: Image with depth inFormation point data, surface data, volumetric data • acquired From range scanner, incl. MicrosoFt Kinect and Google Tango Points Solids • not a complete 3D description: does not include • 2D: range image • Constructive Solid Geometry part oF object occluded From viewpoint • 3D: point cloud • Voxels Surfaces Procedural • Polygonal mesh • Particle system • Parametric surfaces • Spring-mass system Cyberware • Subdivision surfaces • Fractals • Implicit surfaces Curless Range image Tessellation Range surface Funkhouser Funkhouser, Ramamoorthi 3D: Point Cloud Surfaces Unstructured set oF 3D Boundary representation (B-reps) point samples • sometimes we only care about the surface, e.g., when Acquired From range finder rendering opaque objects and performing geometric computations Disadvantage: no structural inFo • adjacency/connectivity have to use e.g., k-nearest neighbors to compute Increasingly hot topic in graphics/vision
    [Show full text]
  • Human Body Model Acquisition and Tracking Using Voxel Data
    Submitted to the International Journal of Computer Vision Human Body Model Acquisition and Tracking using Voxel Data Ivana Mikić2, Mohan Trivedi1, Edward Hunter2, Pamela Cosman1 1Department of Electrical and Computer Engineering University of California, San Diego 2Q3DM, Inc. Abstract We present an integrated system for automatic acquisition of the human body model and motion tracking using input from multiple synchronized video streams. The video frames are segmented and the 3D voxel reconstructions of the human body shape in each frame are computed from the foreground silhouettes. These reconstructions are then used as input to the model acquisition and tracking algorithms. The human body model consists of ellipsoids and cylinders and is described using the twists framework resulting in a non-redundant set of model parameters. Model acquisition starts with a simple body part localization procedure based on template fitting and growing, which uses prior knowledge of average body part shapes and dimensions. The initial model is then refined using a Bayesian network that imposes human body proportions onto the body part size estimates. The tracker is an extended Kalman filter that estimates model parameters based on the measurements made on the labeled voxel data. A voxel labeling procedure that handles large frame-to-frame displacements was designed resulting in the very robust tracking performance. Extensive evaluation shows that the system performs very reliably on sequences that include different types of motion such as walking, sitting, dancing, running and jumping and people of very different body sizes, from a nine year old girl to a tall adult male. 1. Introduction Tracking of the human body, also called motion capture or posture estimation, is a problem of estimating the parameters of the human body model (such as joint angles) from the video data as the position and configuration of the tracked body change over time.
    [Show full text]
  • Photorealistic Scene Reconstruction by Voxel Coloring
    In Proc. Computer Vision and Pattern Recognition Conf., pp. 1067-1073, 1997. Photorealistic Scene Reconstruction by Voxel Coloring Steven M. Seitz Charles R. Dyer Department of Computer Sciences University of Wisconsin, Madison, WI 53706 g E-mail: fseitz,dyer @cs.wisc.edu WWW: http://www.cs.wisc.edu/computer-vision Broad Viewpoint Coverage: Reprojections should be Abstract accurate over a large range of target viewpoints. This A novel scene reconstruction technique is presented, requires that the input images are widely distributed different from previous approaches in its ability to cope about the environment with large changes in visibility and its modeling of in- trinsic scene color and texture information. The method The photorealistic scene reconstruction problem, as avoids image correspondence problems by working in a presently formulated, raises a number of unique challenges discretized scene space whose voxels are traversed in a that push the limits of existing reconstruction techniques. fixed visibility ordering. This strategy takes full account Photo integrity requires that the reconstruction be dense of occlusions and allows the input cameras to be far apart and sufficiently accurate to reproduce the original images. and widely distributed about the environment. The algo- This criterion poses a problem for existing feature- and rithm identifies a special set of invariant voxels which to- contour-based techniques that do not provide dense shape gether form a spatial and photometric reconstruction of the estimates. While these techniques can produce texture- scene, fully consistent with the input images. The approach mapped models [1, 3, 4], accuracy is ensured only in places is evaluated with images from both inward- and outward- where features have been detected.
    [Show full text]
  • Polygonal Meshes
    Polygonal Meshes COS 426 3D Object Representations Points Solids Range image Voxels Point cloud BSP tree CSG Sweep Surfaces Polygonal mesh Subdivision High-level structures Parametric Scene graph Implicit Application specific 3D Object Representations Points Solids Range image Voxels Point cloud BSP tree CSG Sweep Surfaces Polygonal mesh Subdivision High-level structures Parametric Scene graph Implicit Application specific 3D Polygonal Mesh Set of polygons representing a 2D surface embedded in 3D Isenberg 3D Polygonal Mesh Geometry & topology Face Edge Vertex (x,y,z) Zorin & Schroeder Geometry background Scene is usually approximated by 3D primitives Point Vector Line segment Ray Line Plane Polygon 3D Point Specifies a location Represented by three coordinates Infinitely small typedef struct { Coordinate x; Coordinate y; Coordinate z; } Point; (x,y,z) Origin 3D Vector Specifies a direction and a magnitude Represented by three coordinates Magnitude ||V|| = sqrt(dx dx + dy dy + dz dz) Has no location typedef struct { (dx,dy,dz) Coordinate dx; Coordinate dy; Coordinate dz; } Vector; 3D Vector Dot product of two 3D vectors V1·V2 = ||V1 || || V2 || cos(Θ) (dx1,dy1,dz1) Θ (dx2,dy2 ,dz2) 3D Vector Cross product of two 3D vectors V1·V2 = (dy1dx2 - dz1dy2, dz1dx2 - dx1dz2, dx1dy2 - dy1dx2) V1xV2 = vector perpendicular to both V1 and V2 ||V1xV2|| = ||V1 || || V2 || sin(Θ) (dx1,dy1,dz1) Θ (dx2,dy2 ,dz2) V1xV2 3D Line Segment Linear path between two points Parametric representation: » P = P1 + t (P2 - P1),
    [Show full text]
  • Part 2 – Chapter 4: Modelling and Rendering of 3D Objects
    Part 2 – Chapter 4: Modelling and Rendering of 3D Objects 4.1 3D Shape Representations 4.2 Example: Rendering 3D objects using OpenGL 4.3 Depth Buffer - Handling occlusion in 3D 4.4 Double Buffering - Rendering animated objects 4.5 Vertex colours & colour interpolation - Increasing realism 4.6 Backface culling – Increasing efficiency 4.7 Modelling and Animation Tools © 2017 Burkhard Wuensche Dept. of Computer Science, University of Auckland COMPSCI 373 Computer Graphics & Image Processing 2 Polygonmesh The most suitable shape representation Parametric Surface depends on the application => IMPORTANT DESIGN DECISION Subdivison Surface Implicit Surface Constructive Solid Geometry Point Cloud © 2017 Burkhard Wuensche Dept. of Computer Science, University of Auckland COMPSCI 373 Computer Graphics & Image Processing 3 Defined by a set of vertices and a set of faces Faces are (usually) quadrilaterals or triangles The illusion of a solid 3D object is achieved by representing the object’s boundary surface with a polygon mesh © 2017 Burkhard Wuensche Dept. of Computer Science, University of Auckland COMPSCI 373 Computer Graphics & Image Processing 4 Advantages Disadvantages • Easy to define - just • Impractical for everything but the define vertex positions most basic meshes and connectivity • Time-consuming • No control over shape properties (e.g. curvature, smoothness) 1’ 10’ 8’ 6 56’5’ 1 10 8 7 3 3’ 9 2 2’ 4’ 4 © 2017 Burkhard Wuensche Dept. of Computer Science, University of Auckland COMPSCI 373 Computer Graphics & Image Processing 5 Defined as function p(s,t)=(x(s,t), y(s,t), z(s,t)) Direct definition is difficult, but we can use spline surfaces where surfaces are defined using control points, e.g.
    [Show full text]