Automatic Clustering of 3D Objects for Hierarchical Level-Of-Detail Benjamin Wiberg
Total Page:16
File Type:pdf, Size:1020Kb
LiU-ITN-TEK-A--18/033--SE Automatic Clustering of 3D Objects for Hierarchical Level-of-Detail Benjamin Wiberg 2018-06-14 Department of Science and Technology Institutionen för teknik och naturvetenskap Linköping University Linköpings universitet nedewS ,gnipökrroN 47 106-ES 47 ,gnipökrroN nedewS 106 47 gnipökrroN LiU-ITN-TEK-A--18/033--SE Automatic Clustering of 3D Objects for Hierarchical Level-of-Detail Examensarbete utfört i Medieteknik vid Tekniska högskolan vid Linköpings universitet Benjamin Wiberg Handledare Patric Ljung Examinator Jonas Unger Norrköping 2018-06-14 Upphovsrätt Detta dokument hålls tillgängligt på Internet – eller dess framtida ersättare – under en längre tid från publiceringsdatum under förutsättning att inga extra- ordinära omständigheter uppstår. Tillgång till dokumentet innebär tillstånd för var och en att läsa, ladda ner, skriva ut enstaka kopior för enskilt bruk och att använda det oförändrat för ickekommersiell forskning och för undervisning. Överföring av upphovsrätten vid en senare tidpunkt kan inte upphäva detta tillstånd. All annan användning av dokumentet kräver upphovsmannens medgivande. För att garantera äktheten, säkerheten och tillgängligheten finns det lösningar av teknisk och administrativ art. Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsman i den omfattning som god sed kräver vid användning av dokumentet på ovan beskrivna sätt samt skydd mot att dokumentet ändras eller presenteras i sådan form eller i sådant sammanhang som är kränkande för upphovsmannens litterära eller konstnärliga anseende eller egenart. För ytterligare information om Linköping University Electronic Press se förlagets hemsida http://www.ep.liu.se/ Copyright The publishers will keep this document online on the Internet - or its possible replacement - for a considerable time from the date of publication barring exceptional circumstances. The online availability of the document implies a permanent permission for anyone to read, to download, to print out single copies for your own use and to use it unchanged for any non-commercial research and educational purpose. Subsequent transfers of copyright cannot revoke this permission. All other uses of the document are conditional on the consent of the copyright owner. The publisher has taken technical and administrative measures to assure authenticity, security and accessibility. According to intellectual property law the author has the right to be mentioned when his/her work is accessed as described above and to be protected against infringement. For additional information about the Linköping University Electronic Press and its procedures for publication and for assurance of document integrity, please refer to its WWW home page: http://www.ep.liu.se/ © Benjamin Wiberg Linköping University | Department of Science and Technology Master Thesis | Media Technology and Engineering Spring 2018 | LiU-ITN-TEK-A--00/000--SE Automatic Clustering of 3D Objects for Hierarchical Level-of-Detail Benjamin Wiberg Supervisor: Patric Ljung Examiner: Jonas Unger Linköping University SE-581 83 Linköping 013–28 10 00, www.liu.se Abstract This report describes an algorithm for computing 3D object hierarchies fit for Hierarchical Level-of- Detail (HLOD) optimization. The algorithm is used as a pre-processing stage in an HLOD pipeline that automatically optimizes 3D models containing multiple meshes. The algorithm for generating hierarchies groups together meshes in a hierarchical tree using opera- tions on bounding spheres of the meshes. The algorithm prioritizes grouping close objects together in the early stages, and relaxes its constraints toward the end, resulting in a tree structure with a sin- gle root node. The hierarchical tree is then used by computing proxy meshes, i.e. simplified stand-in meshes, for the inner nodes of the hierarchy. Finally, the resulting proxy meshes, together with the generated hierarchy and the original meshes, are used to render the model using a tree-traversing HLOD switching algorithm that renders deeper parts of the tree containing more detailed meshes when more detail is needed. In addition, a minor change to the clustering algorithm is proposed. By swapping the bounding spheres to AABBs (Axis-Aligned Bounding Boxes) in the clustering stage, hierarchies with different proper- ties are generated. This change is shown to generate hierarchies with similar rendering performance as the hierarchies made with bounding spheres, while at the same time resulting in lower space re- quirements for all proxy meshes. Overall, the proposed automatic HLOD pipeline is shown to increase rendering performance for all evaluated scenes in most frames, while never yielding noticeably worse performance than the original model as well. Keywords: hierarchical level-of-detail, mesh simplification, hierarchical clustering, 3D optimization i Acknowledgements First off, I would like to thank everyone at Microsoft, Simplygon Studios in Linköping, where the majority of the work was carried out. My supervisor at the office, Sebastian Wiberg, who has guided me through our many technical discussions, thank you for giving me valuable advice! Anders Östlund for giving me permission to do the thesis at Microsoft. Samuel Ranta-Eskola for helping me refine the extent of the work, keeping a narrow but sharp focus to the thesis. Jukka Tahtinen for helping my find 3D models to use in my work. And to everyone at the office, thanks for the thoughtful discussions, your curiosity toward my work, and the endless joy of pingpong during coffee breaks. It has been a pleasure! Furthermore, I want to thank my advisor at Linköping University, Patric Ljung, for offering key advice on the report and supporting me from the beginning. I also want to thank my examiner Jonas Unger at Linköping University. Finally, I want to thank my wonderful partner Linda who has supported me through the entire work in all ways imaginable, as well as my caring friends and family, some who even read the report and gave critical feedback. June 19th, Linköping Benjamin Wiberg ii Contents Abbreviations v Nomenclature v List of Figures vi List of Tables viii 1 Introduction 1 1.1 Purpose . 1 1.2 Problem formulation . 2 1.3 Delimitations . 2 2 Background 3 2.1 Mesh Simplification . 3 2.1.1 Reduction . 3 2.1.2 Remeshing . 4 2.2 Level-of-Detail . 6 2.2.1 Discrete Level-of-Detail . 6 2.2.2 Continuous Level-of-Detail . 6 2.2.3 Hierarchical Level-of-Detail . 7 2.2.4 Simplygon . 8 3 The Importance of Hierarchies for Hierarchical Level-of-Detail 9 3.1 Effective Object Hierarchies for Hierarchical Level-of-Detail . 9 3.2 Generating Hierarchies Fit for Hierarchical Level-of-Detail . 9 3.2.1 Uniform Grid . 10 3.2.2 Octree . 10 3.2.3 Bottom-up Hierarchical Clustering of 3D Objects . 11 4 Improved Hierarchical Clustering for Hierarchical Level-of-Detail 14 4.1 Bounding Boxes . 14 iii CONTENTS iv 4.2 Bounding Box Proportion Constraint . 15 5 System Overview 17 5.1 Hierarchical Clusterer . 17 5.2 Hierarchy Exporter . 18 5.3 Hierarchical Proxy Mesh Processor . 18 5.4 Hierarchy Importer . 19 5.5 Runtime HLOD Viewer . 19 6 Results 21 6.1 Geometric Complexity and Space Requirements . 22 6.2 Performance Comparisons . 24 6.3 Visual Comparisons . 27 7 Analysis and Discussion 30 7.1 Method . 30 7.2 Results . 30 7.2.1 Performance Comparisons . 30 7.2.2 Visual Comparisons . 30 7.2.3 Comparing Clustering with Bounding Sphere and AABB . 31 7.3 Source criticism . 31 7.4 The work in a wider context . 31 8 Conclusion 32 8.1 Future Work . 32 A Unity UI 35 Abbreviations AABB Axis-Aligned Bounding Box. 2, 13–16, 21, 26–28, 30, 31 AR Augmented Reality. i CAD Computer-aided Design. 3, 8 CLOD Continuous Level-of-Detail. 6 CPU Central Processing Unit. 17 DLOD Discrete Level-of-Detail. 5, 6, 14, 18, 21 GPU Graphics Processing Unit. 3 HLOD Hierarchical Level-of-Detail. i, 1, 2, 6–10, 13, 14, 16, 18, 20, 21, 29–32 LOD Level-of-Detail. 1, 5–7 MR Mixed Reality. i MST Minimum Spanning Tree. 12 SPL Simplygon Processing Language. 18 SSF Simplygon Scene Format. 17, 18 UE4 Unreal Engine 4. 1, 10, 30 VR Virtual Reality. i v List of Figures 2.1 A triangle mesh (left) is simplified using a reduction process, resulting in a new mesh with fewer triangles (right). 4 2.2 A mesh with a wide distribution of surface areas per triangle (left) is turned into a mesh with uniform triangle area and a consistent edge count for each vertex (right) using a uniform remeshing algorithm. Image taken from [2]. 5 2.3 Three versions of the same mesh. Left: the original mesh, center) remeshed using a uniform density function, right) remeshed using a curvature-based density function. Notice that the rightmost mesh uses a few large triangles to represent the any flat surfaces in the model. Image taken from [1]. 5 2.4 An example Discrete Level-of-Detail (DLOD) chain. From left to right: 1) 92832 triangles, 2) 9283 triangles, 3) 928 triangles, 4) 232 triangles. 6 2.5 A HLOD. Level 0 is a single mesh representing the entire model. Lower levels contain consecutively smaller parts of the model with progressively higher triangle counts. The lower levels of the hierarchy are rendered when viewed from a close distance. 7 3.1 Example of a hierarchy that does not work well for Hierarchical Level-of-Detail (HLOD). The subtrees containing the break discs and the tires are both terrible, since they are very spread out. When viewing either of the wheels from a close distance, the algorithm will switch all four wheels to the more detailed version, wasting detail for the other three wheels we don’t see close. 10 3.2 Example of a better hierarchy for HLOD. The break discs and wheels have been grouped together based on position instead of part type. When viewing a particular wheel from a close distance only that wheel will be switched out for its more detailed tire mesh and brake disc, while the other three wheels can still render their aggregated version from level 1.