Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the...

74
Johannes Gutenberg Universität Mainz Department of Computational Geometry Institute of Computer Science Bachelor of Science Thesis Feature Sensitive GPU-based Computation of Swept Volumes Julian Brummer 1. Reviewer Dr. Andreas von Dziegielewski Department of Computational Geometry Johannes Gutenberg Universität Mainz 2. Reviewer Univ.-Prof. Dr. Michael Wand Department of Visual Computing Johannes Gutenberg Universität Mainz Supervisors Univ.-Prof. Dr. Elmar Schömer, Dr. Andreas von Dziegielewski January 2, 2017

Transcript of Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the...

Page 1: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

Johannes Gutenberg Universität Mainz

Department of Computational GeometryInstitute of Computer Science

Bachelor of Science Thesis

Feature Sensitive GPU-based Computation ofSwept Volumes

Julian Brummer

1. Reviewer Dr. Andreas von DziegielewskiDepartment of Computational GeometryJohannes Gutenberg Universität Mainz

2. Reviewer Univ.-Prof. Dr. Michael WandDepartment of Visual ComputingJohannes Gutenberg Universität Mainz

Supervisors Univ.-Prof. Dr. Elmar Schömer,Dr. Andreas von Dziegielewski

January 2, 2017

Page 2: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

Julian Brummer

Feature Sensitive GPU-based Computation of Swept Volumes

Bachelor of Science Thesis, January 2, 2017

Reviewers: Dr. Andreas von Dziegielewski, Univ.-Prof. Dr. Michael Wand

Supervisors: Univ.-Prof. Dr. Elmar Schömer, Dr. Andreas von Dziegielewski

Johannes Gutenberg Universität Mainz

Institute of Computer Science

Department of Computational Geometry

Staudingerweg 9

55128 Mainz

Page 3: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

Abstract

In manufacturing systems, like automotive engineering, swept volumes play animportant role in designing and analyzing motions of mechanical parts. Suchmotions may be user-designed scenarios, e.g. installation trajectories created inCAD applications or actual movements measured from real world experiments.The resulting swept volume can be used to check for potential collisions, validatesafety distances to neighboring components or, more importantly, to design thesecomponents, such that they do not interfere with the blocking geometry.

There are several ways to describe a swept volume. In this thesis we give a volumetricrepresentation, as well as a GPU-based method to sample this volumetric data froma solid undergoing series of rigid transformations. Two variants of this samplingmethod are presented. The first method is more efficient, but restricted to watertightmeshes and densly sampled motions, while the second variant is also applicable tonon-closed meshes and sparsely sampled trajectories. However, we always requireour input models to have correctly oriented faces and normals.

The main part of this work is concerned with recent methods to extract an explicitboundary surface of the volumetric data sampled from the swept solid. Differenttechniques are discussed with respect to their ability to reproduce sharp featuresof the original mesh. Unfortunately, most of these methods are not able to han-dle thin-shelled geometry sufficiently. Therefore, we present a modified surfaceextraction method that is applicable to such areas. Finally, an adaptive contouringmethod is discussed, that is able to maintain thin and sharp features during meshsimplification.

The work in hand covers theoretical and practical aspects of swept volume com-putation, implicit modeling, surface extraction and mesh simplification. Thus itmight be relevant for anyone with interests in motion planning, collision detection,3D-modeling or sculpting.

iii

Page 4: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

Zusammenfassung

In Produktionssystemen, wie dem Fahrzeugbau, nehmen Swept Volumes einewichtige Rolle beim Erstellen und Analysieren von Bewegungen mechanischerBauteile ein. Bei solchen Bewegungen kann es sich sowohl um benutzerspezi-fische Szenarien, z.B. Einbaubahnen aus CAD Applikationen, als auch tatsächlicheBewegungsmessungen von realen Experimenten handeln. Das überstrichene Volu-men kann unter anderem verwendet werden um potenzielle Kollisionen zu erkennen,Sicherheitsabstände zu benachbarten Komponenten zu überprüfen, oder wichtigernoch diese Komponenten so zu entwerfen, dass sie sich nicht mit der blockierendenGeometrie überschneiden.

Swept Volumes lassen sich auf verschiedene Weisen beschreiben. In dieser Arbeitpräsentieren wir eine volumetrische Darstellung, sowie einen GPU-basierten Ansatzum diese volumetrischen Daten von einem Körper unter starren Transformationen,zu bestimmen. Zwei Varianten werden beschrieben. Die erste Methode ist effizienter,jedoch beschränkt auf wasserdichte Modelle und dicht gesampelte Transformatio-nen, während die zweite Variante auf beliebige Dreiecksnetze und Bewegungenangewendet werden kann. In jedem Fall wird erwartet, dass die Flächennormalender Eingabemodelle korrekt sind.

Der Hauptteil der Arbeit beschäftigt sich mit aktuellen Methoden um eine ex-plizite Außenfläche aus den volumetrischen Daten zu rekonstruieren. Es werdenverschiedene Techniken verglichen und deren Fähigkeit scharfe Kanten des Orig-inalmodells wiederzugeben untersucht. Unglücklicherweise, können die meistendieser Techniken dünnwandige Modelle nicht ordentlich abbilden. Deshalb stellenwir einen modifizieren Ansatz vor, welcher sich auch auf diese Bereiche anwendenlässt. Abschließend zeigen wir ein adaptives Verfahren um simplifizierte Oberflächenzu rekonstruieren, welche die dünnwandige Bereiche und scharfen Kanten desModells erhalten.

Die vorliegende Arbeit befasst sich mit den theoretische und praktische Aspekte derBerechnung von Swept Volumes, impliziter Modellierung, Flächenrekonstruktionund der Simplifizierung von Dreiecksnetzen. Sie ist daher empfehlenswert für jedenmit Forschungsinteressen in Richtung Bewegungsplanung, Kollisionserkennung,3D-Modellierung oder 3D-Skulpturierung.

iv

Page 5: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

Acknowledgement

I would first like to thank my advisors Univ.-Prof. Dr. Elmar Schömer and Dr. Andreasvon Dziegielewski of the Department of Computational Geometry at JohannesGutenberg Universität Mainz for their extensive support during the research andimplementation of this work.

I would also like to thank Dr. Rainer Erbes of the Department of ComputationalGeometry at Johannes Gutenberg Universität Mainz for providing some of the inputscenarios, as well as a code sample of a related project.

Last but not least, I want to express my deepest gratitude to my family for theirencouragement throughout my years of study and during the writing of this thesis.

v

Page 6: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction
Page 7: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

Contents

1 Introduction 1

1.1 Motivation and Problem Statement . . . . . . . . . . . . . . . . . . . 1

1.2 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.2.1 Volumetric Data . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.2.2 Distance Function . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2.3 Isosurface Extraction . . . . . . . . . . . . . . . . . . . . . . . 4

1.2.4 Dual Surface . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.3 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.4 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2 Related Work 7

2.1 Volume Sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2 Surface Extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3 Mesh Simplification . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3 GPU-based Swept Volume Sampling 11

3.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.2 Sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.2.1 Intersection Criterion . . . . . . . . . . . . . . . . . . . . . . . 12

3.2.2 Sparsely Sampled Trajectory . . . . . . . . . . . . . . . . . . . 13

3.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.3.1 Intersection Detection . . . . . . . . . . . . . . . . . . . . . . 14

3.3.2 Sign Determination . . . . . . . . . . . . . . . . . . . . . . . . 17

3.3.3 Sampling Hermite Data . . . . . . . . . . . . . . . . . . . . . 17

4 Surface Extraction 21

4.1 Octree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

4.1.1 Octree Creation . . . . . . . . . . . . . . . . . . . . . . . . . . 21

4.2 Surface Components . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

4.2.1 Surface Component Identification . . . . . . . . . . . . . . . . 23

4.2.2 New Surface Component Identification . . . . . . . . . . . . . 24

4.3 Vertex Placement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

4.3.1 Quadratic Error Function . . . . . . . . . . . . . . . . . . . . 28

4.4 Polygonization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

vii

Page 8: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

4.4.1 Minimal Edge . . . . . . . . . . . . . . . . . . . . . . . . . . . 314.4.2 Minimal Edge Traversal . . . . . . . . . . . . . . . . . . . . . 314.4.3 Polygons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

4.5 Adaptive Contouring . . . . . . . . . . . . . . . . . . . . . . . . . . . 334.5.1 Vertex Clustering . . . . . . . . . . . . . . . . . . . . . . . . . 334.5.2 Polygonization . . . . . . . . . . . . . . . . . . . . . . . . . . 36

5 Results 395.1 Stationary Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395.2 Swept Volumes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435.3 Simplification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

6 Conclusion 496.1 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

6.1.1 Sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496.1.2 Surface Extraction . . . . . . . . . . . . . . . . . . . . . . . . 51

Bibliography 55

viii

Page 9: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

1Introduction

A swept volume determines the outer boundary of the space occupied by an object,often called the generator, during a motion. It can be intuitively defined as the set ofpoints touched by the generator, while performing a series of rigid transformations,i.e. translations and rotations. Computing an exact swept volume boundary is acomplex process, since it requires a robust technique to handle intersections betweensurfaces and to detect boundary primitives. Hence, previous work has mainly focusedon approximating the swept volume, while keeping within a certain error boundary,which is sufficient for most applications.

1.1 Motivation and Problem Statement

Swept volumes are of considerable importance in the area of motion planning, mo-tion analysis and NC machining verification. They are effectively used to determinerobotic work-spaces and to design collision-free paths for manufacturing systems,like installation trajectories or removal paths. These motions may come from CADapplications or arise from measured data, e.g. the vibration of a car engine.

In fact, this work was extensively motivated by the request of a German car manufac-turer, measuring the movement of a car engine during test drives. A densely sampledseries of rigid transformations (Ti)i=1,...,n, Ti ∈ R4×4, n > 105 was computed fromdata of displacement sensors, tracking the motion of the engine relative to the chassisof the car. Figure 1.1 shows a similar setup using a high resolution CMOS-Sensor tosimultaneously track reference points fixated on the engine and chassis of the car.The sensor evaluates the measured data and returns the position and rotation of thereference points relative to the coordinate system of the chassis. This is one of thescenarios addressed in the following thesis.

In another scenario, we consider installation trajectories of assembling parts, wherea motion is usually sampled much sparser, i.e. n is small relative to the movementdescribed by (Ti)i=1,...,n.

1

Page 10: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

Fig. 1.1: EngineWatch motion tracking setup. Source: AICON 3D Systems [15]

In either case we are interested in the space occupied by the given generator,transformed by (Ti). An explicit surface approximating the outer boundary of thisspace is desired, which we can export to CAD applications for further processing.

1.2 Background

In many applications, e.g. computer animated movies or games, 3D objects arestored and processed as triangle meshes, since modern graphics hardware is able toprocess these primitives very efficiently. However, objects can also be representedimplicitly, e.g. by a parametric function or volumetric data.

1.2.1 Volumetric Data

There are several ways to describe an object volumetrically. A simple approach isto partition the space into same-sized cubes (voxels) and mark any voxel that isoccupied by the object, i.e. is (partially) on the inside of the solid. Another commonstructure is a discretely sampled 3D scalar field, where each point contains values ofa volumetric function, for example the distance to the nearest surface of the mesh.An advantage with such representations is that constructive solid geometry (CSG)operations, like union or intersection, can be implemented efficiently on volumetricdata. This is the main reason why these representations are quite popular in implicitmodeling and swept volume computation.

2 Chapter 1 Introduction

Page 11: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

1.2.2 Distance Function

A surface S ⊂ R3 can be implicitly described by a volumetric function f(x, y, z),evaluating the distance from a point p ∈ R3 to the surface S. Since representing anarbitrary model with an explicit distance function is difficult, f is usually sampledover a (uniform) grid.

Signed Distance Function

A signed distance function f : R3 → R assigns for every point p ∈ R3 the shortestdistance from p to the surface S, such that:

p ∈ S ⇔ f(p) = dist(p, S) = 0

Furthermore, p is on the outside of S, if f(p) > 0 and on the inside if f(p) < 0,which is often referred to as having a positive or negative sign, respectively. Thus iftwo adjacent sample points have different signs the surface passes through the edgeconnecting these points.

Note that for a continuously differentiable distance function f and p ∈ S the gradient∇f(p) can be interpreted as the surface normal at p. For example the signed distancefunction of the unit sphere can be defined by f =

√x2 + y2 + z2−1, with the surface

normals

∇f(p) = λ ·

px

py

pz

Sampling the normals of S is quite useful to detect sharp features of the surface. Thesampled values f(p) plus ∇f(p) are called the Hermite data of the distance functionf at p.

Directed Distance Function

A directed distance function f : R3 → R3 assigns for every point p ∈ R3 the distancein (positive) x, y and z direction from p to the surface S:

f(p) =

distx(p, S)disty(p, S)distz(p, S)

Again, positive and negative values can be used to indicate that a sample point is onthe inside or outside of S, respectively.

1.2 Background 3

Page 12: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

1.2.3 Isosurface Extraction

An isosurface of a volumetric function f is defined by the set of points satisfyingf(x, y, z) = c, where c is referred to as the isovalue. Thus the boundary surface of fis the isosurface to the isovalue c = 0.

Extracting an isosurface from a sampled volumetric function, such as a distance field,has been studied extensively since the popular Marching Cubes [2] method. A briefsummary over recent surface extraction methods is given in the next chapter of thisthesis.

1.2.4 Dual Surface

A surface S1 is said to be dual to a surface S2, if each vertex of S1 corresponds toexactly one face of S2 and vice-versa.

1.3 Objectives

In real world scenarios, swept volumes are often computed for complex mechanicalobjects, like the vibrating car engine mentioned above. These models usually exhibitsharp features, i.e. edges and corners or contain thin-shelled geometry, like thetwo-sided tubes of the engine cover in Figure 5.1e. The method presented in thiswork is supposed to reproduce these features sufficiently.

Since the generator can be of high complexity (triangle count) and the motion can bedensely sampled, an efficient implementation is required to generate the volumetricdata from such inputs.

Naturally, the presented method should be able to approximate the outer boundaryof stationary, as well as of moving objects. Furthermore, we want the method to beapplicable to sparsely sampled motions.

Extracting a boundary surface from fine-grained volumetric data can produce a highlyover-tessellated mesh, especially in planar regions. A feature sensitive simplificationmethod should be provided to reduce the complexity in those regions, while retainingsharp and thin features of the input model.

4 Chapter 1 Introduction

Page 13: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

1.4 Outline

Chapter 2

This chapter provides a survey of previous work, related to swept volume com-putation. It is mainly concerned with techniques to sample volumetric data andsubsequent surface extraction methods. These methods are compared with respectto their ability to reproduce sharp and thin features of the original mesh.

Chapter 3

In the third chapter, we present a GPU-accelerated technique to sample the Hermitedata of a distance function from a solid swept over a uniform grid. An efficientmethod is described to compute intersections between grid edges and faces of themesh. Furthermore, we give a rule to detect intersections contributing to the outerboundary of a swept volume and discuss a way to handle sparse sampled motionssufficiently. Finally, implementation details are revealed, including the involvedshader stages, data structures and graphics language specific settings.

Chapter 4

The fourth chapter is concerned with a recent method to extract a boundary surfacefrom the Hermite data sampled in the previous chapter. We extend this methodto thin-shelled meshes, providing a novel approach to identify surface componentswithin cells, whose edges can be intersected twice. Finally, an adaptive contouringmethod is described to extract a simplified surface from the sampled data.

Chapter 5

We have applied the presented method to several academic and real-world inputs,including the vibrating car engine and assembly path scenario mentioned above.In this chapter we present the results of our method. First, we examine the meshreconstruction of stationary models, using different contouring techniques. Next,we visualize multiple swept volumes resulting from different generators, which aretransformed by sparsely and densely sampled motions. Finally, simplified boundarysurfaces generated by the adaptive contouring method are presented. Furthermore,we measured the runtime and memory consumption of our implementation fordifferent scenarios.

Chapter 6

In the last chapter we summarize the capabilities and constraints of the presentedmethod. We discuss possible improvements and give a prospect of future work onthis project.

1.4 Outline 5

Page 14: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction
Page 15: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

2Related Work

Based on the wide variety of applications, the computation of swept volumes isan active field of study. A lot of research has been done on this topic, includingdifferential equation methods, envelope theory and volumetric approaches.

The review of this chapter is limited to volumetric methods, due to the timeframe ofthis work. For a complete survey see the paper of Blackmore et al. [1].

A volumetric approach usually involves three steps: Volume Sampling, SurfaceExtraction and Mesh Simplification. The first step samples the swept volume, e.g. asa distance function over a uniform grid. Next, a boundary surface is extracted fromthe sampled data and finally, a simplification technique is applied to the resultingmesh. Note that some techniques may combine the last two steps and directly extracta simplified surface.

2.1 Volume Sampling

Depending on the succeeding surface extraction method, different volumetric repre-sentations for polygonal meshes have been proposed.

Dziegielewski et al. [4] presented a compressed voxelization method, where avolume is initially defined by cells occupied by the generator. In addition, theauthors described a technique to compute offset voxel layers coating the initialvolume in order to extract a conservative boundary. However, a voxelization methodcan not be used to detect sharp features of the mesh.

Frequently, signed distance functions, as presented in section 1.2.2, are used todescribe a model volumetrically. These distance functions are often sampled, usingray-casting to compute intersection points between the mesh and edges of the grid.Several spatial index structures like uniform grids or hierarchical structures, such asspace partition trees, can be used to reduce the number of intersection tests [16].

Recently, graphics hardware accelerated techniques to sample volumetric data havebeen suggested. Kim et al. [11] computed a directed distance function, by rendering

7

Page 16: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

slices of the mesh under orthographic projection, where each pixel corresponds to agrid point of the slice. The distances are stored in a depth buffer and their signs aredetermined using a front propagation scheme. Chapter 3 of this thesis describes asimilar approach to sample the Hermite data of a distance function.

2.2 Surface Extraction

Multiple methods have been developed to display volumetric data directly. Forexample a voxelized mesh can be displayed by rendering a cube for any occupied(boundary) voxel. Another approach uses ray-tracing to sample the color of a pixel,based on the intersection of the ray with the volume and local light information[8]. However, it is often desired to extract an explicit boundary surface of a sweptvolume, e.g. for further usage in CAD applications.

The extraction of a surface from volumetric data has been studied for almost threedecades. One of the first and perhaps most known algorithms is Marching Cubes(MC), published by Lorensen et al. [2] in 1987. Despite its age this algorithm is stillfrequently used due to its simplicity. A typical application is the reconstruction of a3D model from medical data, such as CT scans. The input of MC is usually a uniformscalar value field, which contains density or distance values. These values are theninterpolated over the edges of the grid, in order to find intersection points with adesired isosurface. Naturally, MC can be applied to a directed distance field withoutessential modifications. For a density field, a user defined density threshold is givento specify the boundary surface, which passes through grid edges at this value. Afterthis initial phase, MC traverses over the cubic cells of the grid, which gave thealgorithm its name. For each cell, up to four polygons are created, connecting theedge intersections of that cell. The connectivity within a cube is defined by theinside/outside classification of its corners, i.e. the signs of the distance values. Thesurface components within a cell can be pre-computed for each sign configurationand are commonly stored in a look-up table with 28 entries. The algorithm terminatesafter each cell of the grid has been processed. MC can be efficiently implementedusing an octree, where homogeneous cells (cells that do not exhibit a sign change)are maximally collapsed. Unfortunately, MC is not able to reproduce sharp featuresof a mesh, since vertices are restricted to edges of the grid.

An Extended Marching Cubes (EMC) [13] approach has been suggested, that is able toplace an additional vertex within a cell containing a sharp feature, which is detectedby examining the normals of the associated edge intersections. If those normalsexceed a user defined angle a feature vertex is created and then connected with thecell edges by generating a triangle fan. In addition, if two adjacent cells contain a

8 Chapter 2 Related Work

Page 17: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

feature, the triangle pair connected with their common face, has its common edgeflipped, to form a feature edge.

Dual methods such as Dual Contouring (DC) developed by Ju et al. [20] are ableto represent sharp edges and corners without explicitly testing for such featuresnor performing any edge flips. DC generates a Quadric Error Function (QEF) fromthe Hermite data (exact edge intersections and normals) of an intersected cell andcreates one vertex placed at the minimizer of that QEF. Figure 2.1 shows a 2Dcomparison of the vertex placement for Marching Cubes, Extended Marching Cubesand Dual Contouring.

Fig. 2.1: A signed grid with edges tagged by Hermite data (upper left), its Marching Cubescontour (upper right), its Extended Marching Cubes contour (lower left), and itsdual contour (lower right). Source: Ju et al. [20] (2002) : Dual Contouring ofHermite data, p. 2.

Furthermore, DC is able to extract a simplified mesh from an octree by combiningthe QEFs of child cells and create one representative vertex within the parent cell.This simplification is performed in a bottom-up traversal over the octree, as long asthe error evaluated at a created vertex is less than a user defined threshold. Finally,the algorithm iterates over minimal edges (an edge that contains no smaller edge)of the octree. For each minimal edge exhibiting a sign change a polygon is createdthat connects the representative vertices of the cells containing this edge. Onedisadvantage of their method is that the simplification is limited by the thickness ofthe mesh, since each cell is only able to contain at most one vertex.

The authors addressed this issue in a further developed algorithm which they entitledDual Marching Cubes (DMC) [19]. This method generates a surface that is dualto the one generated by MC, hence the name. For each cell representing a leaf of

2.2 Surface Extraction 9

Page 18: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

the octree up to four vertices are placed at features within that cell. Each vertex isassociated with exactly one of the faces generated by MC. Then only vertices that aretopologically connected on the surface are clustered together during a bottom-uptraversal of the octree. The clustering is maintained in an independent vertex tree,storing the position and error for each vertex. Finally, the polygons are generatedsimilar to DC, by connecting vertices associated with minimal edges. In contrast toDC, any ancestor of the vertex associated with a minimal edge can be chosen fora polygon according to a user defined error threshold. Similar to DC, this methodis able to reproduce sharp features of the mesh. One advantage over DC is thatdisconnected regions are maintained during simplification, thus simplification is notso much limited by the thickness of a mesh. However, since an edge is initially limitedto one intersection, handling thin-shelled meshes requires an excessive subdivisionof the underlying octree. In Chapter 4, a modified version of DMC is described ingreater detail, which is able to handle two intersections per edge.

2.3 Mesh Simplification

While some contouring methods have been extended to extract simplified meshesfrom volumetric data, the complexity of a mesh can also be reduced in a post-processing step.

Garland et al. [6] presented a simplification method based on vertex pair contraction.The algorithm iteratively contracts two vertices, that are either close to each otheror connected through an edge, to a single vertex. These vertex pairs are orderedascendingly by the local error caused by their contraction, which is evaluated usinga quadratic error metric. The error metric is defined as the sum of quadratic distanceto the planes, that meet at the vertex pair. The minimizer of this error metric ischosen as the new target vertex of the contraction. The algorithm stops once thedesired amount of vertices is reached or any new contraction violates a user specifiederror threshold.

Hoppe [7] extended this simplification method to vertices with appearance attributes,such as vertex normals or texture coordinates. Therefore, a new quadric error metricwas presented, measuring the geometric and attribute error of a contraction. Inaddition, the author described a memoryless simplification method, as well as a sidecondition to preserve the overall volume of the input mesh.

10 Chapter 2 Related Work

Page 19: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

3GPU-based Swept VolumeSampling

This chapter is concerned with sampling the Hermite data of a swept volume over afine uniform grid. Therefore, we present a GPU-based method to detect intersectionsbetween the swept solid and edges of the grid. Furthermore, a criterion is given tofind edges that intersect with boundary primitives of the swept volume. Involvedshader stages and data structures are described in the implementation section of thischapter.

3.1 Definition

Motion

The motion (trajectory) of the generator is defined by rigid body transformationsT (t), sampled over a time interval t ∈ [t0, t1], where t0 and t1 denote the start andend of the motion, respectively. A rigid transformation is a combination of a rotationR ∈ SO(3) and a subsequent translation v ∈ R3. Using homogeneous coordinates,we can describe the trajectory as a series of transformation matrices T (t) ∈ R4×4.

Swept Volume

Let M(t) be the generator M ⊂ R3 transformed by T (t). The swept volume can bedefined by:

SV (M,T ) =⋃

t∈[t0,t1]M(t) (3.1)

Note that the sampling rate of t affects the accuracy of the swept volume. In Section3.2.2 we describe how to handle sparsely sampled motions sufficiently.

Uniform Grid

A 3D uniform grid is defined by a set of lattice points gi,j,k = (l · i, l · j, l · k) ∈ [0, 1]3,where 0 ≤ i, j, k ≤ r, l is the length of a grid edge and r denotes the grid resolution,i.e. the number of grid cells in each direction. Since most modern surface extractionmethods perform on octrees, we limit the resolution to r = 2d, where d is the depthof the octree. In the following we assume that the generator is scaled to stay withinthis uniform grid during its motion.

11

Page 20: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

3.2 Sampling

Sampling the Hermite data of a distance function from a (moving) object effectivelymeans to compute intersections between faces of the mesh and edges of the grid.For each grid edge we consider the Hermite data of at most two intersections, i.e. aminimum front-face and a maximum back-face intersection.

3.2.1 Intersection Criterion

An intersection at p ∈ R3 of a face F ∈ M(t) with a directed edge e = (g0, g1) ofthe grid is said to be relevant, if for any intersection point p′ 6= p of e one of thefollowing is true:

1. nT e < 0 and distance(p, g0) < distance(p′, g0)

2. nT e > 0 and distance(p, g0) > distance(p′, g0)

Here n denotes the face normal of F and g0, g1 are adjacent lattice points. Case 1and 2 are referred to as a front-face and back-face intersection, respectively. Figure3.1 shows the relevant intersections with front-faces (green) and back-faces (red) ofa transformed polygon with a 2D grid. Note that intersections with inner faces donot contribute to the outer boundary of the swept volume. Figure 3.1 contains twosuch intersections at the top left corner of the center cell.

+

+

++

+

+

++

Fig. 3.1: A translated polygon (blue) on a directed uniform grid (black), with sampledfront-face and back-face intersections (green, red) and signs (+ outside, - inside)

12 Chapter 3 GPU-based Swept Volume Sampling

Page 21: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

We use the following rule to discard intersections with inner faces:

A front-face intersection with an edge e = (g0, g1) contributes to the outer boundaryof a swept volume, if g0 is on the outside of SV (M,T ), i.e. has a positive sign.Likewise a back-face intersection contributes to the outer boundary, if the sign of g1

is positive.

3.2.2 Sparsely Sampled Trajectory

As mentioned above, the accuracy of SV (M,T ) depends on the sampling rate ofthe motion. For a sparsely sampled trajectory the pure union of M(t) as definedin equation 3.1 may not approximate the swept volume sufficiently. One solutionis to generate more samples by interpolating the motion between the known key-transformations. A more elegant solution considers the volume of a swept triangle,which is bound by the start and end position of the triangle and the three patchesresulting from the swept edges (cf. Figure 3.2). Those patches are then tessellatedinto two triangles each and additional intersections with edges of the grid arecomputed for these triangles.

Fig. 3.2: The swept volume of a transformed triangle (left) and the tessellated patches(right)

3.3 Implementation

The computation of intersections between grid edges and triangles of the mesh canbe massively parallelized. In fact, the computation can be performed for each edgeseparately. In this section a two-pass graphics accelerated technique is presented,which computes the Hermite data of contributing intersections, using the built-inrasterizer of a GPU. The algorithm involves the following steps:

1. Mark each grid edge, that intersects with a front- or back-face of the meshaccordingly. (pass 1)

2. Determine the sign for each grid point and identify intersections contributingto the outer boundary of the swept volume. (CPU)

3. Sample the Hermite data of these contributing intersections. (pass 2)

3.3 Implementation 13

Page 22: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

The first and last step of this algorithm is implemented on the GPU, using the OpenGLshading language GLSL.

3.3.1 Intersection Detection

For the first pass a ray-casting technique is used to detect intersections between thegenerator and edges of the grid. For each of the three principle axes x, y and z afield of (r+ 1)× (r+ 1) axis-oriented rays are cast through the scene. The left side ofFigure 3.3 visualizes those fields for r = 4. If a ray intersects a triangle of the mesh,the intersected grid edge can be identified using the ray origin and its distance tothe intersection point.

z

y

z

x

y

x

Fig. 3.3: The stanford bunny (left) and its orthogonal projection (right) on three ray-castingfields (x = red, y = green, z = blue), with disabled depth test and a resolution ofr = 4.

Since modern graphic cards are heavily optimized towards triangle rasterization,the ray-casting technique described above, can be implemented efficiently on theGPU. Therefore, we render the scene in positive x, y and z direction, under anorthographic projection, such that each fragment, or rather its center, matches a rayorigin on the projection plane. Note that in OpenGL the early depth test discardsfragments that are not visible, i.e. fragments that are hidden by previously renderedtriangles. In order to consider each intersection, this depth test has to be disabled.Figure 3.3 (right) shows the three orthogonal projections of the stanford bunny withdisabled depth test.

14 Chapter 3 GPU-based Swept Volume Sampling

Page 23: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

For a moving object we render the transformed generator M(t) for all sampledmoments t separately. The transformation matrices T (t) are stored as an array in ashader storage buffer object (SSBO) allocated in graphics memory. This reduces thecommunication cost between CPU and GPU, using instanced rendering. Furthermore,we use the current instance id to construct the prisms of swept triangles, as visualizedin Figure 3.2. In the following, we describe the involved shader stages to identifytriangle-edge intersections.

Vertex Shader Stage

The vertex shader gets the position v of a triangle vertex, the active view-projectionmatrix PV and the index i of the current transformation as input. Then the vertex issimply transformed by PV · T (ti) · v from object- to clip-coordinates. For a sparselysampled trajectory we also pass the vertex position in object and world space, aswell as the triangle normal to the subsequent geometry shader stage.

Geometry Shader Stage

This shader stage is optional. If desired, the geometry shader generates the patchesof a swept triangle as shown in Figure 3.2. In the general case this shader outputs sixadditional triangles (two per edge-patch) for each input triangle. Let F = (v0, v1, v2)be the input triangle with normal n and F ′ = (v′0, v′1, v′2) the triangle transformedby the next time step. For each edge e = (vj , v(j+1) mod 3) of the input trianglea quadrilateral patch is created, connecting e and e′ = (v′j , v′(j+1) mod 3). Thesepatches are then tessellated into two triangles each. In order to guarantee the rightorientation of those triangles, their vertices are specified in a counter-clockwisemanner when viewing from the outside of the resulting prism. Therefore, thefollowing cases are considered:

1. e′ is on the upside of F , i.e. (v′ − v)Tn > 0 for v ∈ e and v′ ∈ e′

2. e′ is on the downside of F , i.e. (v′ − v)Tn < 0 for v ∈ e and v′ ∈ e′

3. e′ intersects the supporting plane of F

The shader only emits triangles for the first two cases:

1. (vj , v(j+1) mod 3, v′j) and (v′j , v(j+1) mod 3, v

′(j+1) mod 3)

2. (v′j , v′(j+1) mod 3, vj) and (vj , v′(j+1) mod 3, v(j+1) mod 3)

Figure 3.4 illustrates both cases for the first edge of a swept triangle.

3.3 Implementation 15

Page 24: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

v0 v1

v0' v1

'

n

v0 v1

v0' v1

'

n

Fig. 3.4: A tessellated patch of a triangle swept in normal direction (left) and against normaldirection (right)

Fragment Shader Stage

With the setting described above, the fragment shader is invoked each time a rayof the grid passes through a triangle of the mesh. The task of this shader is now tomark the exact grid edge that intersects this triangle. Let (x, y) ∈ [0, r − 1]2 be thefragment coordinates, i.e. the ray-origin, and let d ∈ [0, 1] denote the correspondingdepth value. Defining z = bd · rc, the global grid edge e is identified depending onthe view direction by:

• e = (gz,y,x, gz+1,y,x) for x-axis oriented rays

• e = (gx,z,y, gx,z+1,y) for y-axis oriented rays

• e = (gr−x,y,z, gr−x,y,z+1) for z-axis oriented rays

In addition, we use the orientation of the triangle to determine whether it is a front-or back-face intersection. The intersection status of an edge is encoded with 2 bits(one bit per intersection type), which is stored in a 32-bit unsigned integer 3D-image-texture. A single texel (x, y, z) of this texture stores the intersection status of alledges contained in the z-oriented ray r = (gx,y,z, gx,y,z+16). GLSL provides threadsafe methods to modify such texels via atomic image operations. “The contents ofthe texel being updated by the atomic operation are guaranteed not to be modifiedby any other image store or atomic function between the time the original value isread and the time the new value is written” 1.

After rendering the generator for all transformations and from each direction, weeventually copy the texture data back into main memory to be used for the followingsteps.

1John Kessenich et al. [9] "The OpenGL Shading Language", Version: 4.50, Revision 6, p.177,https://www.opengl.org/registry/doc/GLSLangSpec.4.50.pdf (accessed on 1-Nov-2016)

16 Chapter 3 GPU-based Swept Volume Sampling

Page 25: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

3.3.2 Sign Determination

As stated in section 3.2.1, we consider the signs at the lattice points to rule outintersections with inner faces of the swept volume. Furthermore, the signs can beused by several surface extraction methods to determine the local topology within agrid cell.

A positive sign is assigned to any grid point that is reachable from the outside of theswept volume boundary. Therefore, we initialize each grid point with a negativesign and perform a flood fill, starting at lattice points within the six boundary facesenclosing the uniform grid. This initial front F is propagated, using an iterativebreadth-first traversal over the grid edges. For each visited grid point g ∈ F weremove g from F and consider its six direct neighbors, which are connected with gthrough axis-oriented edges. A neighboring grid point g′ is added to the front if theedge connecting g and g′ has not been intersected by the swept mesh. The traversalproceeds until F = ∅. During the traversal each grid point visited by the front ismarked with a positive sign. As a side effect, we detect contributing intersections,each time the traversal stops at an edge intersection.

3.3.3 Sampling Hermite Data

Storing an exact intersection point and triangle normal for each edge of a fineuniform grid (e.g. in a 3D texture) consumes a massive amount of memory. Morethan recent graphics cards can allocate at this moment. Fortunately, most edges donot exhibit an intersection and as a result the texture is usually sparsely populated.Furthermore, it is only necessary to compute the Hermite data for intersections thatcontribute to the outer boundary of a swept volume.

We store this Hermite data in a sufficiently sized SSBO allocated on the GPU, whichis initially filled with an ordered list of coding vectors identifying contributingintersections. Such a coding vector consists of four integers v = (ex, ey, ez, dir),where 0 ≤ ex, ey, ez ≤ r are the grid coordinates of the edge origin and 1 ≤ |dir| ≤ 3the direction of the edge, x = ±1, y = ±2, z = ±3. The sign of dir specifies theintersection type: front-face (+) or back-face (−). These coding vectors form thefirst 16 bytes of an intersection within the Hermite buffer. The next four bytes arereserved for the Hermite data h, which is encoded in a single unsigned integer. Here,the highest byte of h represents the distance of the intersection from the edge originas a value from 0 to 255. The related triangle normal allocates the next three bytes.Again, each vector component is mapped to a range from 0 to 255. The reason forthis compressed storage is not to reduce memory consumption. In fact, there is noadvantage over uncompressed storage due to memory alignment rules of shader

3.3 Implementation 17

Page 26: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

storage buffers1 (cf. Figure 3.5). However, GLSL provides methods to performatomic operations on integers only, similar to those of integer image textures usedin section 3.3.1. So while direct reads and writes to a buffer variable could lead torace conditions between different shader invocations, which can result in incorrectlysampled data, atomic operations are guaranteed to be thread safe.

edge origin

edge direc�on

encoded

Hermite data

padding according to

std140 layout

sort

ed

by

: d

ir, e

z, e

y, e

x

INPUT OUTPUT

Hermite Buffer

e0,x e0,y e0,z dir0 h0

e1,x e1,y e1,z dir1 h1

::

en-1,x en-1,y en-1,z dirn-1 hn-1

Fig. 3.5: The storage layout of the Hermite buffer. Each row represents one intersection,allocating 32 bytes. The first 16 bytes are initially assigned to identify the intersec-tion (input). The output is written to the next 4 bytes. The remaining 12 bytes areonly necessary for memory alignment and do not contain any information.

We use the same ray casting technique described in Section 3.3.1 to sample theHermite data of contributing intersections. Likewise, most of the shader stages aresimilar to those of the first step.

Vertex Shader Stage

In addition to the projection of a vertex, this shader always processes the normal nof the related triangle. Since those normals are required to be in world space, wesimply transform them by T (ti) · n and pass them normalized to the next shaderstage. Note that we do not need to compute a normal matrix, since T (ti) is a rigidbody transformation, thus there is no non-uniform scaling involved.

Geometry Shader Stage

As before, this stage can be used to generate the patches of a swept triangle. Supple-mentary, we need to compute the triangle normals of the tessellated patches. Givena triangle F = (a, b, c) of a patch, where a, b and c are specified in counter-clockwise

1"std140 Uniform Buffer Layout" [14],http://ptgmedia.pearsoncmg.com/images/9780321552624/downloads/0321552628_AppL.pdf

(accessed on 3-Dec-2016)

18 Chapter 3 GPU-based Swept Volume Sampling

Page 27: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

manner (cf. Figure 3.4), we compute its normal by n = (b−a)× (c−a). This normalis then passed in a flat way, i.e. non-interpolated, to the fragment shader.

Fragment Shader Stage

Again, we use the fragment coordinates and fragment depth d, to identify theintersected grid edge e. Together with the orientation of the intersected triangle anddirection of the grid edge, we get a 4 dimensional coding vector v = (ex, ey, ez, dir)which uniquely identifies the intersection. Then, the shader performs a binary searchfor v over the entries of the Hermite buffer. If v is not found then this intersectiondoes not contribute to the outer boundary of the swept volume and is discarded.Otherwise, we compare the Hermite data h present in the buffer, with the currentlysampled data h′. The buffer is updated if one of the following is true:

1. h = 0, i.e. h has not been set yet

2. the intersected triangle is a front-face and h′ < h

3. the intersected triangle is a back-face and h′ > h

Note that the condition stated above tests the intersection criterion, defined insection 3.2.1, since the distance value is stored in the most significant byte. If thistest passes, the Hermite data in the buffer is replaced by h′.

After processing each intersection, we finally read the data back into main memory,where it is stored in a sorted map keeping the intersection order of the Hermitebuffer. Figure 3.6 visualizes this Hermite data, sampled from a static and sweptbunny model, using point-based rendering.

Fig. 3.6: The Hermite data of a stationary and swept Stanford bunny sampled over auniform grid with resolution r = 256. Each contributing intersection is visualizedas a single point, colored with the associated absolute normal.

3.3 Implementation 19

Page 28: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction
Page 29: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

4Surface Extraction

In this chapter we present a variant of the Dual Marching Cubes [19] method toextract the boundary surface from a signed uniform grid, whose edges are taggedwith the Hermite data of at most two intersections.

4.1 Octree

Storing implicit information, such as corner signs or volumetric function values, foreach cell of a fine uniform grid can allocate a lot of system memory. In fact, most ofthese cells do not contain any relevant information, i.e. cells that do not intersectwith the boundary surface. Furthermore, a surface extraction method usually needsto traverse over each grid cell, even if they do not contribute to the final mesh. Thisissue is commonly addressed by merging empty neighboring cells together, resultingin a maximally collapsed octree. Figure 4.2 shows a 2D example of such an adaptivegrid, i.e. a quadtree.

Another advantage over a uniform grid is, that the hierarchical structure of an adap-tive grid enables the extraction of a simplified surface in a natural way. For example,Dual Contouring [20] generates one vertex for each octree leaf cell intersecting withthe boundary surface. As a result the number of vertices placed at a certain surfaceregion corresponds to the number of cells within that area, thus the topology of theoctree determines the local complexity of the extracted surface.

4.1.1 Octree Creation

In this section we describe how to create a maximally collapsed octree, which consistsof the following cell types:

Octree-Leaf Cell

A leaf of the octree stores the signs of its eight cell corners. This information isencoded in an 8-bit integer value, which is referred to as the sign configuration ofthe cell. A positive sign is encoded as 0, a negative sign as 1 (cf. Figure 4.1, left).

21

Page 30: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

Octree-Node Cell

An octree node simply stores the pointers to its eight children cells, which can beeither leaves or nodes themselves.

Homogeneous Cell

In surface extraction methods such as Dual Contouring and Dual Marching Cubes acell is referred to as homogeneous, if its corners exhibit the same signs, i.e. the signconfiguration is either 0 or 255. For methods that are limited to one intersection peredge, this is equivalent to say that the boundary surface does not pass through thiscell. Likewise, we call a cell homogeneous if none of its edges exhibit a contributingintersection.

-

++

+

-

sign con ig = 0000 1111 edge con ig = 1111 0000 0000

Fig. 4.1: The corner (left) and edge numeration (right), including the sign- and edgeconfiguration of a cell intersecting with a surface (orange).

For each cell we also store its depth, i.e. the level of the octree in which the cellis located. The octree construction is performed in a bottom-up traversal, startingat the lowest level d = log2(r). For each cell on the d-th level, that contains acontributing intersection, we create a leaf cell and compute its sign configuration.A node cell is created if at least one of its eight children is present. Finally, we fillmissing children with homogeneous cells.

Fig. 4.2: A polygon (blue) on a maximally collapsed adaptive 2D grid (a quadtree), whereoccupied leaf cells are marked orange.

22 Chapter 4 Surface Extraction

Page 31: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

4.2 Surface Components

Generally, a cell of the grid can be intersected by multiple disconnected surfaces. Forexample a thin-shelled geometry, such as a thin wall, usually produces two separatedintersection groups. These groups are often referred to as surface components of thecell. More formally, let I denote the set of contributing surface-edge intersectionswith a grid cell c. Then a surface component of c is a subset S ⊂ I of theseintersections, which are connected through a contributing boundary surface withinc. For an octree leaf S is restricted to intersections with boundary edges of that cell,whereas a surface component in a node cell may also contain intersections withinner edges. Identifying those components is an important step for many contouringmethods, since handling multiple components within a cell enables to reproduce amesh of a certain complexity on a much coarser grid.

4.2.1 Surface Component Identification

There are several ways to identify surface components. The Dual Contouring methodsimply groups all intersections of a cell into one surface component S = I. In March-ing Cubes and its dual variant Dual Marching Cubes, connected edge intersectionsare specified in a look-up table for each possible sign configuration. Depending onthis configuration a cell may contain up to four surface components.

Varadhan et al. [10] present a novel approach to identify surface components forleaf cells whose edges can be intersected twice. The authors associate each edgeintersection i ∈ I with a unique (positive signed) cell corner, which they call theparent P (i) of i. Then, two intersections i, j are defined as equivalent “[...] if andonly if there is a path between P (i) and P (j) consisting of only non-intersectingedges in the cell”1. The surface components are now the classes of this equivalencerelation. The intuition behind this equivalence relation, is that the traversal overnon-intersected edges of a cell never crosses the surface and thus never leaves theexterior (or interior) of the mesh. Figure 4.3 illustrates the identified componentsfor different types of cell intersections, using this equivalence relation method. Notethat in some of these cases the method identifies incorrect surface components. Onereason for this issue is, that two cells with the same sign configuration may exhibit adifferent connectivity between edge intersections (cf. case 1 and 2). In the followingwe extend this method to handle such cases more sufficiently.

1G. Varadhan et al. [10] "Feature-sensitive subdivision and iso-surface reconstruction", IEEE Visu-alization 2003, p.102, p.4 in paper, http://gamma.cs.unc.edu/RECONS/recons.pdf (accessed on6-Nov-2016)

4.2 Surface Components 23

Page 32: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

+

+ -

-

+

+

++

+ +

+

-

+

+ -

-

1 2

43

Fig. 4.3: Different types of polygons (grey, blue) intersecting a grid cell and the relatedsurface components (red, green, orange) identified with the equivalence relationmethod. For case 1 and 3 the identified components are correct, whereas in case 2and 4 this method groups disconnected intersections together.

4.2.2 New Surface Component Identification

Identifying surface components by traversing over the exterior or (exclusively)interior edges of a cell may result in wrongly partitioned intersections as shownabove. To address this issue, we perform both, an exterior and interior traversal tofind possible surface components. Note that we can not simply adapt the equivalencerelation in this case, since we do not get a disjoint partition of I. In fact mostintersections are part of two surface components. We consider their associatednormals for these cases in order to determine the correct component. This is basedon the assumption that intersections with a minor normal deviation are more likelyto be connected. We propose the following greedy algorithm to identify the surfacecomponents of a cell from its set of edge intersections I:

1. Initialize C = {0, .., 7} and k = 0.

2. Create a new potential surface component Sk = ∅, choose a non-visited cellcorner c ∈ C as starting point and set C = C \ {c}.

24 Chapter 4 Surface Extraction

Page 33: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

3. Traverse from c over non-intersected edges of the cell and remove each passedcorner from C. The traversal stops at the first intersection i ∈ I of an edge. SetSk = Sk ∪ {i} and proceed the traversal until no more edges can be crossed.

4. Compute the maximum deviation mini,j∈Sk

(nTi nj) of the normals associated with

Sk ⊂ I.

5. Increase k and repeat the steps 2-4 until C = ∅.

6. Choose Sk with the minimum normal deviation and remove the surface com-ponent from the cell I = I \ Sk.

7. Repeat the steps 1-6 until I = ∅.

The intersection groups identified in step 6 are the resulting surface components ofthe cell. Note that we get a disjoint partition of I, since a chosen surface componentis removed from the cell immediately. Figure 4.4 illustrates the algorithm for acomplex cell, where each edge is intersected twice.

1 2

43

Fig. 4.4: 2D examples of the surface component identification. Each single image illustratesthe steps 1-6 of the algorithm. The edge traversal is marked by colored arrows foreach possible surface component. The black arrows indicate the normals of theintersections. The surface of the identified component is colored in red.

4.2 Surface Components 25

Page 34: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

Improvements

The algorithm above can be improved, by pre-computing the traversal over non-intersected edges for each possible case of intersections. In analogy to the signconfiguration, we define the edge configuration of a cell as a 12-bit integer, wherecontributing intersected edges are encoded as 1 and non-intersected edges as 0 (cf.Figure 4.1, right).

For each edge configuration we pre-compute the traversal, starting at the corners ofa cell. We detect the indices of the edges, at which the traversal stops, accordingto the current edge configuration. Note that this configuration does not indicatewhether an edge exhibits one or two contributing intersections, thus we also needto consider the travel direction over these edges in order to identify the correctintersection for dual-intersected edges. An edge can be either traversed in positiveor negative direction in relation to the orientation system of the cell shown in Figure4.1.

Traversal Look-up Table

Given an edge configuration e in its binary form, where ei denotes the value of thei-th bit, we compute the traversal information T (e) by the following steps:

1. Initialize C = {0, .., 7}.

2. Create a new index set S = ∅, choose a non-visited cell corner c ∈ C as startingpoint and set C = C \ {c}.

3. Traverse from c over non-intersected edges of the cell and remove each passedcorner from C. The traversal stops at an intersected edge with index i ∈ [0, 11],i.e. ei = 1. Set S = S ∪ {d · (i + 1)}, where d = ±1 depending on the traveldirection. The traversal proceeds until no more edges can be crossed.

4. Set T (e) = T (e) ∪ {S} and repeat the steps 2-3 until C = ∅.

T (e) is stored for each edge configuration e in a look-up table with 212 = 4096entries. Each index set S ∈ T (e) describes a possible surface component, encodingthe involved edges and travel directions over these edges. For involved edgesexhibiting a single contributing intersection, this intersection is simply part of thedescribed surface component. Given an index of a dual-intersected edge and atravel direction, we can easily identify the first visited intersection along this edge

26 Chapter 4 Surface Extraction

Page 35: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

by comparing the corresponding distance values associated with the intersections. A2D example of this look-up table generation is shown Figure 4.5.

1 2

3 4

c3

c0 c1

c2

e0

e3

e2

e1

S = {1, 4}

x

y

S = {-1, -3}

S = {1, 4}

S = {-1, -3}

S = {1, 4}

S = {-4, 3}

Fig. 4.5: A 2D example of the look-up table generation. The first image shows a cell withedge configuration e = 1011, where intersected edges are marked by two dashes.Each of the next images illustrates the steps 2-4 of the algorithm. Visited cellcorners are marked by black dots.

We can now improve the surface component identification by using the look-up tablegenerated above:

1. Initialize k = 0 and compute the edge configuration e from the set of contribut-ing intersections I.

2. Extract the next surface component Sk from T (e).

3. Compute the maximum deviation mini,j∈Sk

(nTi nj) of the normals associated with

Sk ⊂ I.

4. Increase k and repeat the steps 2-4 until |T (e)| = k.

5. Choose Sk with the minimum normal deviation and remove the surface com-ponent from the cell I = I \ Sk.

6. Repeat the steps 1-5 until e = 0.

4.2 Surface Components 27

Page 36: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

4.3 Vertex Placement

Dual methods, like Dual Contouring or Dual Marching Cubes generate one vertexfor each surface component of a cell. In contrast to Marching Cubes, this vertex isnot limited to edges of the grid, but can be placed anywhere within that cell. In thefollowing we describe how these methods determine an optimal position for thisvertex, by examining the Hermite data of the related edge intersections.

4.3.1 Quadratic Error Function

The hermite data of an intersection i ∈ I can be interpreted as a plane equation:

nTi · (x− pi) = 0 (4.1)

where pi is the intersection point and ni the normal associated with this intersection.The vertex v should be placed such that the quadratic distance to each of the planesof a surface component S ⊂ I is minimized, which is equivalent to determining theminimizer of the quadratic error function (QEF):

E(x) =∑i∈S

(nTi · (x− pi))2 (4.2)

This QEF can be rewritten into matrix form. We define di = nTi pi ∈ R:

E(x) =∑i∈S

(nTi x− di)T · (nTi x− di)

=∑i∈S

(xT (ninTi )x− 2di · nTi x+ d2i )

=∑i∈S

(xTAix− 2bTi x+ ci)

= xT (∑i∈S

Ai)x− 2 · (∑i∈S

bi)Tx+

∑i∈S

ci

where Ai = ninTi ∈ R3×3, bi = di · ni ∈ R3, ci = d2

i ∈ R.

We can now find the minimizer v for E(x) by solving the following linear equationsystem:

∇E(v) = ∇(vTAv − 2bT v + c) = 2Av − 2b = 0⇔ Av = b⇔ v = A−1b (4.3)

where A =∑i∈S Ai ∈ R3×3, b =

∑i∈S bi ∈ R3, c =

∑i∈S ci ∈ R.

28 Chapter 4 Surface Extraction

Page 37: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

The Hessian matrix HE(v) =(∂∂vi

∂∂vjE(v)

)= 2A of the QEF is positive semi-

definite, because A is positive semi-definite: vTAv =∑i∈S (nTi v)2 ≥ 0. As a result

the extremum in v is indeed a minimum.

Note that the equation system of 4.3 may be underdetermined, e.g. if the normalsni are sampled from a flat area, thus A might not be invertible. Even worse, thosenormals are usually noisy, such that the planes defined in 4.1 may be nearly parallel,which often results in a minimizer v far outside the actual cell. To solve this problem,Ju et al. [20] suggested to form the pseudo-inverse A+, by computing a singularvalue decomposition (SVD) of A, while truncating its small singular values. The SVDof a matrix M ∈ Rm×n is defined as:

M = UΣV T

where U ∈ Rm×m, V ∈ Rn×n are orthonormal matrices and Σ ∈ Rm×n is a diagonalmatrix with non-negative entries. Those entries, called the singular values of M ,are usually ordered descending on the diagonal of Σ. Furthermore, we can rewriteequation 4.2 to:

(Nx− d)T (Nx− d) = xTNTNx− 2(NTd)Tx+ dTd = xTAx− 2bTx+ c

where s = |S|, N =

nT1...nTs

∈ Rs×3 and d =

nT1 p1

...nTs ps

∈ Rs

Thus, we can compute the SVD of A by:

A = NTN = V ΣTUT · UΣV T = V ΣTΣV T = V Σ′V T

where U ∈ Rs×s, V ∈ R3×3, Σ ∈ Rs×3 and Σ′ ∈ R3×3.

It follows that the eigenvalues of A are equal to its singular values and the columnsof V are the eigenvectors of A. So basically, the problem is reduced to the specialcase of computing an eigenvalue decomposition (EVD) of A. If A is invertible, i.e.Σ′ has only non-zero singular values σi on its diagonal, we can simply computethe inverse A−1 = V Σ′−1V T from this decomposition, by inverting the diagonalentries of Σ′. However, if σi = 0 or close to zero, the diagonal entries 1

σiof Σ′−1

may be large, if not infinite. We follow the approach of Ju et al. [20] and truncatesingular values of A with |σi| < 0.1 to zero. The pseudo-inverse A+ = V Σ′+V T isnow formed by inverting only non-zero entries of Σ′ and keep zero for any otherentry.

4.3 Vertex Placement 29

Page 38: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

This procedure effectively reduces the noise present in the Hermite data. Additionally,it may be used to detect the rank of A+, which is equal to the number of kept singularvalues. Furthermore, the rank of the pseudo-inverse can be used to determine thedimension of the solution space from equation 4.3. If A+ has full rank, i.e. A+ = A−1

the solution space is a single point, i.e. a corner on the boundary surface. Likewise,for rk(A+) = 2, the solution space forms a line (an edge on the surface) and forrk(A+) = 1 it is a plane.

One problem of using the pseudo-inverse is, that if A+ is rank deficient, v = A+ · bfinds the solution with minimal L2-Norm, i.e. the point on the solution space, thatis closest to the origin. This usually produces a point that is located far away fromthe actual cell. Warren et al. [17] addressed this issue by solving for a minimizerx relative to a point m, such that v = x + m. Inserting in equation 4.3 yields asolution for x = A+ · (b − Am) with minimal L2-Norm. As a result, v is the pointon the solution space that is closest to m. In their paper, they suggested to use the

mass-point of the intersections for m =∑

i∈Spi

|S| , since it is a point within the cellthat is close to the solution space. Figure 4.6 illustrates this vertex placement in a2D example. Note that for the lower left (red) surface component, the vertex alignswith the mass-point of the edge intersections, even though any point on the lineminimizes the quadratic error.

We store the QEF of a surface component as the tuple Q = (A, b, c,m), where A is asymmetric 3×3-matrix, b and m are 3-dimensional column vectors and c is a scalarvalue. Considering the symmetry of A, we can represent a QEF with 13 values.

+ -

+ +

Fig. 4.6: The vertex placement (blue dots) for a polygon (blue, grey) intersecting a 2D gridcell. The edge intersections of the related surface components are associated withthe generated vertices (marked as red and green arrows).

30 Chapter 4 Surface Extraction

Page 39: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

4.4 Polygonization

4.4.1 Minimal Edge

In their paper [20], Ju et al. introduced the concept of minimal edges within anadaptive grid to generate the polygons of the resulting boundary surface, whichpasses through minimal edges exhibiting a sign change. An inner edge of an octreenode cell c is called minimal if it contains no smaller edges. Such a minimal inneredge is always shared by either three or four cells contained in c.

We extend this definition to edges contained in the six boundary faces of c. Notethat such a minimal boundary edge is only shared by two cells within c. Furthermore,if c is not the root of the octree, a minimal boundary edge of c is always a minimalinner edge within an ancestor node of c.

4.4.2 Minimal Edge Traversal

Ju et al. [20] presented a recursive octree traversal method to iterate over all minimalinner edges within a grid component, i.e. a cell, face or edge of an adaptive grid.The grid components are uniquely identified by cells sharing the same component.Naturally, a cell is represented by itself, a face is identified by two cells sharing acommon face and an edge can be represented by three or four cells. Note that thesecells may be of different size (cf. Figure 4.7).

(a) Faces (green) shared by two cells (grey).

(b) Edges (blue) shared by three and four cells (grey).

Fig. 4.7: Different examples of face- and edge-sharing by cells.

4.4 Polygonization 31

Page 40: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

The traversal is based on three methods, calling each other recursively: cellProc(c0),faceProc(c0, c1) and edgeProc(c0, c1, c2, c3), where ci are cells. Starting with a callto cellProc(c) this function calls itself for each of its eight children, spawns twelveinvocations of faceProc (one for each inner face) and calls edgeProc for each of thesix axis-oriented edges tiling c. Furthermore, faceProc(c0, c1) calls itself for each ofits four sub-faces and spawns four calls to edgeProc (one for each edge tiling theface). Finally, edgeProc(c0, c1, c2, c3) invokes itself for each of its two sub-edges. Theiteration ends if all cells ci within a call are atomic, i.e. ci is a leaf or a homogeneouscell. Figure 4.8 illustrates this recursive traversal.

cellProc

faceProc

edgeProc

...

...

...

Fig. 4.8: The recursive calls for cellProc(c0), faceProc(c0, c1) and edgeProc(c0, c1, c2, c3).

As mentioned above, an edge may be shared by only three cells, if the size of thetwo neighboring cells containing the edge differ. In our setting we can ignore thiscase, since at least one of the cells is homogeneous, because only homogeneouscells are collapsed, thus such an edge does not exhibit any contributing intersection.However, other surface extraction methods, like Dual Contouring, allow neighboringheterogeneous cells to differ by size, such that one of the ci’s in edgeProc may beundefined.

32 Chapter 4 Surface Extraction

Page 41: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

4.4.3 Polygons

After placing vertices within each intersected leaf cell, we are able to constructpolygons, connecting vertices of neighboring cells together. Therefore, we iterateover minimal inner edges of the adaptive grid using the recursive traversal methoddescribed above. For each intersection of a minimal edge a quad is generated, con-necting the four vertices associated with this intersection. Each vertex is stored in oneof the four cells sharing the minimal edge, i.e. the cells ci in edgeProc(c0, c1, c2, c3).The quadrilateral face is then tessellated into two triangles, such that they form afront-face or back-face according to the intersection type. In addition, we prefer tosplit the quad into two triangles at its shortest diagonal.

4.5 Adaptive Contouring

Performing the vertex placement described in section 4.3 for each leaf cell of theoctree distributes the generated vertices uniformly over the resulting boundarysurface. As a result, the extracted surface is usually over-tessellated in plain orfeatureless regions. Adaptive contouring is concerned with reproducing those regionswith as few vertices as possible to effectively reduce the overall complexity of themesh, while keeping a specified error bound. Therefore, Schaefer et al. [19]presented a subsequent simplification stage, which allows them to efficiently extractmulti-resolution surfaces from the octree by clustering vertices together that aretopologically connected on the boundary surface. In the following section wedescribe a modified version of their clustering method that is able to handle twointersections per edge. Furthermore, we describe how to handle minimal boundaryedges within a cell to improve the simplification.

4.5.1 Vertex Clustering

Given the octree as constructed in section 4.1.1, the vertex clustering algorithmcreates an additional vertex tree, where the leaves are the vertices generated by thefinest level of the grid. The vertex nodes are recursively created during a bottom-uptraversal over the octree. Each vertex in the tree stores its position, a pointer toits parent, the associated QEF and the evaluated error at that vertex. In addition,each leaf of the vertex tree is associated with its surface component, i.e. the edgeintersections from which the QEF was constructed (cf. Figure 4.6).

Starting with a representative vertex for each surface component within an octree-leaf cell, the clustering algorithm produces additional vertices for each surface

4.5 Adaptive Contouring 33

Page 42: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

component in a node cell. A surface component in a node cell is composed ofconnected components present in its eight children, where each of these componentshas already been associated with a representative vertex. The parent of these verticesis the vertex generated for the composed surface component.

Composite Surface Component

In section 4.2.1 we presented several methods to identify surface components withina leaf cell of an adaptive grid. In order to identify the surface component for a nodecell, we consider the surface components of its eight children. Since we processedthose children first, we can assume that we already identified their components andgenerated a vertex sub-tree for each of them. Note that two surface componentsS1, S2 ⊂ I are connected within a cell, if they share an edge intersection, i.e.S1 ∩ S2 6= ∅.

To find these connection edges, we consider the twelve axis-oriented inner faces andsix inner edges, tiling the parent cell. The faceProc and edgeProc functions of theoctree traversal method described in section 4.4.2 are used to iterate over minimaledges within those inner cell parts, as suggested by Shaefer et al. [19]. For eachintersection of a minimal edge we find the four vertices (one for each of the fourleaf cells sharing the common edge) associated with this intersection and followtheir parent pointer up the vertex tree until no further parent is present. The foundvertices are associated with the surface components, which are connected througha minimal edge to a composite component within the node cell. We merge thesecomponents together by assigning the same surface index to their representativevertices.

Note that this traversal may not consider all surface components, e.g. if a surfaceonly intersects with the boundary of the node cell. Even though these stray surfacecomponents may still be composed during the minimal edge iteration initiated in anancestor cell, we found that connecting these components directly yields a bettersimplification. Therefore, we also consider minimal edges contained in the sixboundary faces of the parent cell. Note that such a minimal boundary edge is onlyshared by two cells within the parent node, thus this only merges a maximum of two(instead of four) components together.

Analogously to faceProc(c0, c1) and edgeProc(c0, c1, c2, c3), we introduce additionalfunctions boundaryFaceProc(c0) and boundaryEdgeProc(c0, c1) to iterate over mini-mal boundary edges of the cell. The cellProc(c0) method makes an additional call toboundaryFaceProc for each of its six boundary faces. Furthermore, boundaryFaceProc

34 Chapter 4 Surface Extraction

Page 43: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

invokes itself for each of its four sub-faces and makes four calls to boundaryEdgeProc(one for each edge tiling the boundary face). Finally, boundaryEdgeProc(c0, c1)invokes itself for each of its two sub-edges.

Figure 4.9 shows a comparison of a model simplified with and without clustering atminimal boundary edges. The artifacts in Figure 4.9a are caused by surfaces whichonly intersect with boundary faces of a node cell. As a result, this cell contains manystray surface components which are first connected together within a potentiallymuch larger ancestor cell. Thus a lot more vertices are clustered directly into a singlevertex, leading to a much coarser vertex tree in those regions.

(a) without minimal boundary edges (b) with minimal boundary edges

Fig. 4.9: The extracted fandisk model simplified with and without clustering at minimalboundary edges.

Vertex Node Generation

After identifying the surface components within a node cell, a vertex is generated foreach component. We apply the vertex placement procedure described in section 4.3,whereas the QEF of a composite surface component S =

⋃jSj is the sum of the QEFs

Ej of its sub-components:

E(x) =∑j

Ej(x) = xT (∑j

Aj)x− 2 · (∑j

bj)Tx+

∑j

cj

⇔ A =∑j

Aj , b =∑j

bj , c =∑j

cj

The mass-pointsmj of the sub-components are combined differently. A natural choicewould be to compute the average of the mass-points mj . However, this may producea point that is located far away from the actual solution space. To adress this issuewe follow the approach of Schaefer et al. [17] and combine the mass-points of theQEFs based on feature dimensions, which are determined using the rank detection

4.5 Adaptive Contouring 35

Page 44: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

method of section 4.3.1. We define an index set M = {j | rk(A+j ) ≥ rk(A+

k ) ∀k}containing the surface component indices of highest feature dimension. The resultingmass-point is now constructed by:

m =∑j∈M mj

|M |

As a result m is closer to the features with highest dimension, which is likley to benear the solution space of the combined QEF (cf. Figure 4.10).

After solving for a minimizer v of the composed QEF a new vertex node is created,storing Q = (A, b, c,m), v, E(v) and rk(A+). Finally, the parent pointer of eachvertex generated for a surface sub-component Sj is assigned to the just createdvertex node. Figure 4.10 shows a 2D example of this clustering phase. Note that theclustered vertices in the parent cell align with the features of highest dimension.

(a) Quadtree

1

4

2

3

5

6

7

(b) Vertex Tree

6

1 2 3

7

4 5

Fig. 4.10: The vertex placement (a) before (left) and after vertex clustering (right), in-cluding the mass-points (red) of the associated surface components and theconstructed vertex tree (b)

4.5.2 Polygonization

In the final step of adaptive contouring, we create the polygons connecting thevertices generated by the previous steps. The input of this polygonization methodis an octree with its related vertex tree as constructed in section 4.1.1 and 4.5.1,respectively, as well as a user specified error threshold. In analogy to uniformcontouring, we consider the vertices associated with intersections of minimal edges.

36 Chapter 4 Surface Extraction

Page 45: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

Instead of connecting these vertices directly, suitable ancestors in the vertex tree arechosen, which are then linked together through polygons forming the final surface.

Collapsible Vertex

A vertex of the tree is qualified for the boundary surface, if its local error is lessthan the user specified threshold. As suggested by Schaefer et al. [19] we markthese vertices as collapsible, meaning that a vertex cluster can be safely collapsedinto such a vertex without violating the error bound. If the error threshold changes,we traverse over the vertices in the tree and update this flag accordingly.

Vertex Selection

Again, the octree traversal method from section 4.4.2 is used to iterate over minimalinner edges of the grid. For each edge, we consider the four cells sharing this edge.If the edge exhibits a contributing intersection, we search for the four vertices inthose cells that are associated with this intersection and follow their parent pointersup the vertex tree. The traversal stops at the last vertices marked as collapsible,which are then connected through a quad or triangle, depending on the number ofunique vertices the traversal stopped at. In case the resulting polygon degeneratesinto an edge or single vertex, it is discarded.

Collapsed Cell

To speed up the polygonization, we follow the approach of Schaefer et al. [19] andmark a cell as collapsed, if all clustered vertices generated in this cell are marked ascollapsible and all of its children are either leaf cells or collapsed cells themselves. Acollapsed cell has the property, that any polygon constructed from a minimal edgewithin that cell degenerates to a single vertex. Furthermore, a polygon generatedfrom a minimal edge contained in the common face shared by two collapsed cells, isalways clustered into an edge. As a result, the octree traversal can be truncated atcellProc(c1) and faceProc(c1, c2), if the cells ci are collapsed.

4.5 Adaptive Contouring 37

Page 46: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction
Page 47: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

5Results

Motivated by the vibrating car engine problem, we applied the presented methodto several real world and academic scenarios. The main focus was on generatingswept volumes of moving solids, although we also computed the boundary surfaceof stationary objects to demonstrate the replication of sharp and thin features fromour input meshes (Figure 5.1). Furthermore, the results of different dual surfaceextraction methods are compared by varying the surface component identificationapproaches mentioned in section 4.2.1. Apart from the quality of the extracted mesh,we examine the runtime and memory consumption of our method. The performancemeasurements are done independently for the different stages of the algorithm andthus are separated into GPU- and CPU-parts. We track the memory consumption onthe GPU and system memory separately.

For all benchmarks we used a machine with an Intel Core i7 at 4.0GHZ, 32GB systemRAM and a NVIDIA GTX980 GPU with 4GB video memory, under Microsoft Windows10, using the MSVC2013 compiler with optimizations (-O3). There is currently noparallel implementation on CPU-side, thus the runtime does not benefit from themulticore processor.

5.1 Stationary Models

For immovable objects our method simply creates a replica of the input mesh, orrather its boundary surface. We compare this replication to the original mesh toexamine the preservation of its features. For the bunny and fandisk model the out-puts are sufficient, even for low-resolution grids (cf. Figure 5.2). For performancemeasurement we applied the algorithm to higher resolutions as well, but withoutnoticing any visual improvements. Furthermore, all dual surface extraction methodsgenerate similar results, since these models do not contain any thin shelled geometry.Likewise, all of these contouring methods properly reproduce the smooth boundaryof the Stanford bunny, as well as the sharp edges and corners of the fandisk model.While the output complexity of the bunny model corresponds roughly to the com-plexity of its input, the fandisk model is highly over-tessellated. We have generated asimplified version of the fandisk (cf. Figure 5.8) using the vertex clustering methodfrom section 4.5.1.

39

Page 48: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

(a) bunny (∼70k triangles) (b) fandisk (∼13k triangles) (c) space station (∼10k trian-gles)

(d) gripper (∼194k triangles) (e) engine cover (∼426k triangles)

Fig. 5.1: Some academic and real world input models.

The presented method could not produce a sufficient output for the static spacestation, since it is not entirely closed. We did, however, compute a swept variant ofthis mesh, see Figure 5.5b. For the gripper model and engine cover we compared theresults produced by the different surface extraction methods. A high-resolution gridis necessary for both models to detect and reproduce their fine details. However,even for a fine grid the dual approaches are not able to correctly reproduce all thinfeatures. Figure 5.3 shows a comparison between the reconstruction of the enginecover by Dual Marching Cubes and the thin-shelled method.

In the current implementation the runtime of reconstructing stationary modelsmainly depends on the creation of the octree and vertex tree, while the sampling andpolygonization is relatively fast (cf. Table 5.1). We could not detect any significantruntime differences between the Dual Conturing (DC) and Dual Marching Cubes(DMC) method, whereas the thin-shelled variant takes slightly more time than thedual approaches. The intersection detection and sign determination mainly dependon the grid resolution, while the runtime of the Hermite sampling correspondsto the number of contributing intersections and thus also varies with the inputcomplexity. The polygonization time and the update of the collapsible flag, basicallycorrelates with the number of generated output vertices, which is dependent of thegrid resolution and complexity of the input mesh.

40 Chapter 5 Results

Page 49: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

(a) bunny (∼102k triangles) (b) fandisk (∼303k triangles)

Fig. 5.2: The reproduced boundary of the bunny and fandisk model, with a grid resolutionof r = 128 and r = 256, respectively.

(a) Dual Marching Cubes

(b) Thin-shelled

Fig. 5.3: A comparison of the engine cover (∼12m triangles) reconstructed by Dual MarchingCubes and our thin-shelled variant, with a grid resolution of r = 1024.

5.1 Stationary Models 41

Page 50: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

resolutioncontributinginterections

intersectiondetection

signdeterm

inationsam

plingH

ermite

dataoctree

&vertex

treecreation

polygonizationupdate

collapsibleflag

rD

CD

MC

Thin128

51k0,009

1,10,247

8,48,4

8,70,631

0,036256

207k0,028

7,81,0

45,945,7

47,12,5

0,142512

831k0,176

58,84,1

287287

29510,0

0,569

(a)R

untime

forbunny

model(∼

70ktriangles).

resolutioncontributinginterections

intersectiondetection

signdeterm

inationsam

plingH

ermite

dataoctree

&vertex

treecreation

polygonizationupdate

collapsibleflag

rD

CD

MC

Thin128

38k0,005

1,10,181

6,66,7

6,70,464

0,026256

153k0,028

7,90,529

39,038,8

39,41,9

0,106512

611k0,174

60,61,8

259259

2637,4

0,425

(b)R

untime

forfandisk

model(∼

13ktriangles).

Tab.5.1:R

untime

(inseconds)

ofthedifferent

algorithmstages

forreconstructing

thebunny

andfandisk

model.

42 Chapter 5 Results

Page 51: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

modelruntime

(in seconds)output complexity(triangle count)

d = 7 d = 8 d = 9 d = 10 d = 7 d = 8 d = 9 d = 10bunny 10,3 57 360 2632 102k 410k 1,6m 6,5mfandisk 8,3 49 328 2475 76k 303k 1,2m 4,8mgripper 7,5 48 350 2740 53k 216k 987k 4,4mengine 15,5 82 496 3403 170k 709k 3,0m 12,1m

Tab. 5.2: The overall runtime and output complexity of several mesh reconstructions, whered denotes the depth of the octree.

scenarioruntime

(in seconds)memory(in MB)

CPU GPU total system GPU5.4 a 360 583 943 1213 705.4 b 316 2,8 319 518 465.5 a 325 1,6 327 477 515.5 b 2475 10,2 2485 3088 3945.6 3003 4081 7084 5549 4475.7 2426 11,3 2437 2020 320

Tab. 5.3: The runtime and memory consumption of the swept volume scenarios presentedin this chapter.

5.2 Swept Volumes

In order to demonstrate the computation of swept volumes, our input modelsperform different types of motions. We distinguish between sparse motions, e.g.installation trajectories and densely sampled motions, like vibration measurements.For the latter, the resulting surface simply approximates the outer boundary fromthe union of all transformed generators, as specified in equation 3.1. In case of asparse motion, the union of each prism gained from the swept triangles is considered.Figure 5.4 visualizes the extracted boundary surface of the swept Stanford bunnyfor both cases. The results of a swept fandisk and space station are shown in Figure5.5. The swept volumes of the vibrating engine cover and assembly path scenario arevisualized in Figure 5.6 and 5.7, respectively. The runtime and memory consumptionof these scenarios is depicted in Table 5.3. In contrast to the boundary computationof stationary and sparsely transformed models, the runtime for a dense motion (here∼182k transformations) is dominated by the sampling process on the GPU.

5.2 Swept Volumes 43

Page 52: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

(a) vibrating bunny (∼182k transformations) (b) swept bunny (16 transformations)

Fig. 5.4: The extracted boundary surface of a vibrating and swept bunny, with resolutionr = 512.

(a) swept fandisk (b) swept space station

Fig. 5.5: The extracted boundary surface of the fandisk and space station, swept on a sparsetrajectory (16 transformations), with a gird resolution of r = 512 and r = 1024,respectively.

44 Chapter 5 Results

Page 53: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

Fig. 5.6: The swept volume of the vibrating car engine scenario (∼182k transformations),with a grid resolution of r = 1024.

Fig. 5.7: The swept volume of the assembly path scenario (34 transformations) with grippermodel and a grid resolution of r = 1024.

5.2 Swept Volumes 45

Page 54: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

5.3 Simplification

We use the vertex clustering method described in section 4.5.1 to reduce the overalloutput complexity. Therefore, we constantly increase the error threshold until theresulting surface has reached the desired amount of triangles. Figure 5.8 shows areconstruction of the fandisk model, that was simplified such that its complexityroughly conforms to the input complexity. A simplified boundary of the vibratingcar engine cover is depicted in Figure 5.9. Note that the resulting surfaces have lowcomplexity in plain regions, while feature-full areas are represented in much moredetail.

Fig. 5.8: The fandisk model, extracted from a grid with resolution of r = 512 and simplifiedwith an error threshold t = 10−6 (output complexity: ∼12k triangles).

Fig. 5.9: Simplified boundary surface of the vibrating engine cover (∼707k triangles), witherror threshold t = 5 · 10−6 and a grid resolution of r = 1024.

46 Chapter 5 Results

Page 55: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

scenariosimplification time

(in seconds)output complexity(triangle count)

t = 10−6 t = 10−5 t = 10−4 t = 0 t = 10−6 t = 10−5 t = 10−4

5.4 a 6,26 5,65 5,46 1,8m 370k 151k 61k5.4 b 2,57 2,31 2,23 726k 157k 60k 25k5.5 a 2,01 1,95 1,94 629k 52k 23k 12k5.5 b 14,36 14,16 14,06 4,6m 239k 136k 69k5.6 28,4 26,1 25,5 8,3m 1,3m 502k 205k5.7 10,3 9,3 8,8 2,9m 623k 282k 122k

Tab. 5.4: The simplification time and output complexity of the swept volume scenarios withvarying error thresholds t.

After the octree and vertex tree has been generated, extracting a simplified boundaryis quite fast, since it only needs to update the collapsible flag according to thespecified error threshold and generate the corresponding polygons. Table 5.4 depictsthe simplification time and output complexity for the presented scenarios withdifferent error thresholds.

5.3 Simplification 47

Page 56: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction
Page 57: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

6Conclusion

We have presented a volumetric approach to construct a surface, that approximatesthe outer boundary of a swept volume. The extracted surface reproduces sharpfeatures, as well as thin-shelled parts of the generator, by evaluating the Hermitedata of a two-sided directed distance function.

We described a GPU-accelerated technique to sample the Hermite data of a (swept)solid over a fine uniform grid. In our tests, we successfully computed the intersectionpoints and normals of the gripper model for grid resolutions up to r = 2048. Ruleswere specified, to detect intersections contributing to the outer boundary of a sweptvolume on a grid whose edges can be intersected multiple times by the generator.Furthermore, our method is able to sample the Hermite data of two intersections,i.e. a minimum and maximum, per grid edge.

Two sampling variants were presented, in order to handle different types of motionsand input models. The first variant is efficient for densely sampled motions butrestricted to closed surfaces, while the second approach is applicable to nearlyarbitrary triangle meshes and sparse trajectories. Naturally, both methods alwaysrequire the generator to have correct surface normals.

Finally, we modified the Dual Marching Cubes method to handle dual-intersectededges and presented a novel approach to identify surface components within complexcells. Furthermore, a modified adaptive contouring method was described, that isable to maintain sharp and thin features during simplification.

6.1 Future Work

6.1.1 Sampling

Offsets

To sample the Hermite data, the presented ray casting technique relies on intersec-tions between the triangles of the mesh and the edges of the uniform grid. Thus,

49

Page 58: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

it is possible to miss features, e.g. the sharp end of a cone might intersect with aface of a grid cell but not with its edges. This is mainly caused by the rasterizationprocess. According to the OpenGL specification, a fragment is only produced if itscenter is covered by a projected polygon.1 As a result, the sampling is usually notconservative. Dziegielewski et al. [5] solved this issue by rendering the offset of atriangle, which is formed as the union of three spheres, centered around the cornersof the triangle, three cylinders (one per edge) and a prism. Instead of creatingthis geometry explicitly, their geometry shader only generates two shifted triangles,forming the top and bottom of the prism, as well as a rectangular patch enclosingeach projected triangle edge. Finally, the fragment shader discard any fragmentproduced by these patches, that is outside of the projected offset and computes thecorresponding depth values for kept fragments. In our setting the shader would alsoneed to compute the corresponding normals of these fragments.

Runtime Improvements

For sparsely sampled motions, the geometry shader currently generates a prism foreach swept triangle, even if faces of these prisms do not contribute to the outerboundary. Although in our scenarios this overhead was no issue, because of the fewtransformations of a sparse motion, it might lead to a runtime problem for a moredetailed trajectory. A culling criterion for facets and edge patches of a swept triangle,was described in [3] (p. 56 - 60). The basic idea is to check if two prisms share acommon face. If such a face is enclosed by both sides, it is not reachable from theoutside and thus can safely be culled. Therefore, the location of the prism cornersare compared, with respect to the supporting plane of the considered face.

Currently a naïve flood fill is used to determine the signs of the lattice points. Thereare faster techniques, like the iterative scanline method, which is more efficient,since it does not travel into every direction from a visited grid point. However, asa consequence, we can no longer find all contributing intersections alongside thetraversal, since dual-intersected edges may not be considered. Another commonapproach to speed up the traversal is to replace the uniform grid by an adaptive grid,such that non-intersected cells are maximally collapsed. We can generate this gridas a side effect on the GPU during the intersection detection. In our implementationa 3D texture stores the intersection status of all edges on the finest level of thegrid. Likewise, we can use the mipmaps of this texture to mark intersected cellswithin higher grid levels. Extracting an adaptive grid from these textures is astraight-forward process. Also an edge traversal over such a grid does not miss any

1Mark Segal et al. [12] "The OpenGL Graphics System: A Specification", Version: 4.5, Revision 2.0,p.456, https://www.opengl.org/registry/doc/glspec45.core.pdf (accessed on 14-Dec-2016)

50 Chapter 6 Conclusion

Page 59: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

contributing intersection, since it only skips non-intersected edges. Moreover, we canuse this grid to speed up the octree creation from section 4.1.1, for non-intersectedcells are always homogeneous.

6.1.2 Surface Extraction

Feature Isolation

The presented surface extraction method generates one vertex per surface compo-nent, which is placed at the minimizer of the associated quadratic error function.Optimally, this vertex aligns with the feature of the component. Unfortunately,a surface component may exhibit more than one feature, e.g. the end of a thinwall. Varadhan et al. [10] addressed this issue by performing a feature-sensitivesubdivision scheme, where cells that contain more than one feature are subdividedaccordingly. The number of features within a cell is determined during CSG opera-tions (e.g. a union) between two objects. However, in our setting we have a fixedmaximum resolution for the ray-casting field, which we can not easily adapt to thefeatures of the mesh during rendering.

Another promising approach was described by Schaefer et al. [18]. They suggestedto perform the surface extraction over a grid that is dual to the primal grid, usedto sample the implicit function f(x, y, z). The vertices of this so-called dual grid areplaced at the features of f within the cells of the primal grid. Next, the topology ofthe dual grid is generated, using a variant of the octree traversal method from section4.4.2. Finally, an extended Marching Cubes method is used to extract an isosurfacefrom the dual grid. In their work the authors stated that sharp and thin featuresare reproduced sufficiently even for low resolution grids, since those features areseparated into different grid cells.

Thin Gaps

The presented method is currently not able to reproduce thin gaps of an input modelsufficiently. This issue is caused by the flood fill, which may not reach into suchgaps, since it is limited to edges of the grid (cf. Figure 6.1). Furthermore, we cannot decide whether intersections with grid edges on the inner side of the boundarysurface, i.e. edges with negative signs at both endpoints, contribute to the outerboundary surface. Currently, we do not consider these intersections, in fact weassume that the edge is completely on the inside of the mesh. As a result, we might

6.1 Future Work 51

Page 60: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

collapse thin gaps of the input model or link disconnected regions together as shownin Figure 6.2.

+

+ -

-

-

-

-

---

-

-

Fig. 6.1: The flood fill incorrectly determines the lower right corner of the center cell tobe on the inside of the model (orange, grey). Thus, for the extracted boundarysurface (blue) the gap is collapsed at this corner.

+

- -

---

- -

-

+

++Fig. 6.2: The extracted boundary surface (blue) links disconnected regions of the original

model (orange, grey) together, since the center cell is considered to be completelyon the inside of the mesh.

Ambiguous Surface Components

Similar to the original Marching Cubes method, the surface component identificationfor cells with dual-intersected edges suffers from ambiguous cases. In our method weconsider the normals associated with edge intersections to identify separated surfacecomponents within a leaf cell, based on the assumption, that components with similarnormals are more likely to be connected. However, this assumption does not always

52 Chapter 6 Conclusion

Page 61: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

hold. Figure 6.3 shows an example, where the presented method links disconnectedcomponents together, which may result in cracks on the extracted boundary surface.One solution for this issue might be to consider additional information to identifysurface components, e.g. the maximum quadratic error of the vertices generated forthese components.

+

+

-

-

Fig. 6.3: A 2D example, where our surface component identification method links discon-nected surfaces together. Note that the green component is identified first, sincethe associated normals are aligned, although these intersections are not connectedwithin the cell.

Vertex Placement

A vertex of the boundary surface is placed at the minimizer of the associated QEFQ = (A, b, c,m), with minimal distance to the corresponding mass-point. In ourcurrent implementation we allow this vertex to be placed outside of the cell thatgenerated it, in order to reproduce sharp features correctly. Unfortunately, thismight cause triangles to fold over during polygonization. Nevertheless, a vertexshould always be placed within the cell if the solution space intersects with that cell.Note that this space can be formed explicitly, by computing additional solutions forAv = b, depending on the dimension of the space d = 3− rk(A+). In case there isno solution within the cell, the vertex may either be placed outside or projected intothe cell, e.g. onto a centered sphere enclosed by the cell.

6.1 Future Work 53

Page 62: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction
Page 63: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

Bibliography

[1]K. Abdel-Malek K. Blackmore D. Joy. Swept Volumes: Foundations, Perspectives andApplications. International Journal of Shape Modeling, 2004 (cit. on p. 7).

[2]W. E. Lorensen H. E. Cline. Marching Cubes. Computer Graphics (Proceedings of SIG-GRAPH 87), 1987 (cit. on pp. 4, 8).

[3]Andreas von Dziegielewski. High Precision Swept Volume Approximation with Conserva-tive Error Bounds. 2012 (cit. on p. 50).

[4]Andreas von Dziegielewski Michael Hemmer Elmar Schömer. High Precision ConservativeSurface Mesh Generation for Swept Volumes. IEEE Transactions on Automation Scienceand Engineering, 2013 (cit. on p. 7).

[5]Andreas von Dziegielewski Rainer Erbes Elmar Schömer. Conservative Swept VolumeBoundary Approximation. In SPM ’10: Proceedings of the 14th ACM Symposium onSolid and Physical Modeling, 2010 (cit. on p. 50).

[6]M. Garland P. Heckbert. Surface Simplification Using Quadric Error Metrics. In Proceed-ings of SIGGRAPH 97, 1997 (cit. on p. 10).

[7]H. Hoppe. New quadric metric for simplifying meshes with appearance attributes. Pro-ceedings of the 10th IEEE Visualization 1999 Conference, 1999 (cit. on p. 10).

[8]Ondrej Jamriska. Interactive Ray Tracing of Distance Fields. Proceedings of CESCG 2010,2010 (cit. on p. 8).

[10]G. Varadhan S. Krishnan Y. Kim D. Manocha. Feature-sensitive subdivision and iso-surfacereconstruction. IEEE Visualization 2003, 2003 (cit. on pp. 23, 51).

[11]Young J. Kim Gokul Varadhan Ming C. Lin Dinesh Manocha. Fast Swept Volume Approxi-mation of Complex Polyhedral Models. Computer-Aided Design, 2003 (cit. on p. 7).

[13]Leif P. Kobbelt Mario Botsch Ulrich Schwanecke Hans-Peter Seidel. Feature SensitiveSurface Extraction from Volume Data. SIGGRAPH ’01 Proceedings of the 28th annualconference on Computer graphics and interactive techniques, 2001 (cit. on p. 8).

[16]Rui Wang. Ray Tracing Acceleration Techniques. 2003 (cit. on p. 7).

[17]Scott Schaefer Joe Warren. Dual Conturing: The secret sauce. Rice University TechnicalReport, 2002 (cit. on pp. 30, 35).

[18]Scott Schaefer Joe Warren. Dual Marching Cubes: Primal Contouring of Dual Grids.Proceedings of Pacific graphics, 2004 (cit. on p. 51).

55

Page 64: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

[19]Scott Schaefer Tao Ju Joe Warren. Manifold dual contouring. IEEE Transactions onVisualization and Computer Graphics, 2007 (cit. on pp. 9, 21, 33, 34, 37).

[20]Tao Ju Frank Losasso Scott Schaefer Joe Warren. Dual Contouring of hermite data. ACMTransactions on Graphics, 2002 (cit. on pp. 9, 21, 29, 31).

Websites

[9]Randi Rost John Kessenich Dave Baldwin. The OpenGL Shading Language (Version 4.50).URL: https://www.opengl.org/registry/doc/GLSLangSpec.4.50.pdf (visited onNov. 1, 2016) (cit. on p. 16).

[12]Kurt Akeley Mark Segal. The OpenGL Graphics System: A Specification (Version 4.5). URL:https://www.opengl.org/registry/doc/glspec4d.core.pdf (visited on Dec. 14,2016) (cit. on p. 50).

[14]std140 Uniform Buffer Layout. URL: http://ptgmedia.pearsoncmg.com/images/9780321552624/downloads/0321552628_AppL.pdf (visited on Dec. 3, 2016) (cit. onp. 18).

[15]AICON 3D Systems. Engine Watch. URL: http://aicon3d.de/produkte/moveinspect-technology/enginewatch/auf-einen-blick.html (visited on Dec. 23, 2016) (cit. onp. 2).

56 Bibliography

Page 65: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

List of Figures

1.1 EngineWatch motion tracking setup. Source: AICON 3D Systems [15] . 2

2.1 A signed grid with edges tagged by Hermite data (upper left), itsMarching Cubes contour (upper right), its Extended Marching Cubescontour (lower left), and its dual contour (lower right). Source: Ju etal. [20] (2002) : Dual Contouring of Hermite data, p. 2. . . . . . . . . 9

3.1 A translated polygon (blue) on a directed uniform grid (black), withsampled front-face and back-face intersections (green, red) and signs(+ outside, - inside) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.2 The swept volume of a transformed triangle (left) and the tessellatedpatches (right) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.3 The stanford bunny (left) and its orthogonal projection (right) on threeray-casting fields (x = red, y = green, z = blue), with disabled depthtest and a resolution of r = 4. . . . . . . . . . . . . . . . . . . . . . . . 14

3.4 A tessellated patch of a triangle swept in normal direction (left) andagainst normal direction (right) . . . . . . . . . . . . . . . . . . . . . 16

3.5 The storage layout of the Hermite buffer. Each row represents oneintersection, allocating 32 bytes. The first 16 bytes are initially assignedto identify the intersection (input). The output is written to the next 4bytes. The remaining 12 bytes are only necessary for memory alignmentand do not contain any information. . . . . . . . . . . . . . . . . . . . 18

3.6 The Hermite data of a stationary and swept Stanford bunny sampledover a uniform grid with resolution r = 256. Each contributing intersec-tion is visualized as a single point, colored with the associated absolutenormal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

4.1 The corner (left) and edge numeration (right), including the sign- andedge configuration of a cell intersecting with a surface (orange). . . . . 22

4.2 A polygon (blue) on a maximally collapsed adaptive 2D grid (a quadtree),where occupied leaf cells are marked orange. . . . . . . . . . . . . . . 22

57

Page 66: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

4.3 Different types of polygons (grey, blue) intersecting a grid cell and therelated surface components (red, green, orange) identified with theequivalence relation method. For case 1 and 3 the identified compo-nents are correct, whereas in case 2 and 4 this method groups discon-nected intersections together. . . . . . . . . . . . . . . . . . . . . . . . 24

4.4 2D examples of the surface component identification. Each single imageillustrates the steps 1-6 of the algorithm. The edge traversal is markedby colored arrows for each possible surface component. The blackarrows indicate the normals of the intersections. The surface of theidentified component is colored in red. . . . . . . . . . . . . . . . . . . 25

4.5 A 2D example of the look-up table generation. The first image showsa cell with edge configuration e = 1011, where intersected edges aremarked by two dashes. Each of the next images illustrates the steps 2-4of the algorithm. Visited cell corners are marked by black dots. . . . . 27

4.6 The vertex placement (blue dots) for a polygon (blue, grey) intersectinga 2D grid cell. The edge intersections of the related surface componentsare associated with the generated vertices (marked as red and greenarrows). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

4.7 Different examples of face- and edge-sharing by cells. . . . . . . . . . . 31

4.8 The recursive calls for cellProc(c0), faceProc(c0, c1) and edgeProc(c0, c1, c2, c3). 32

4.9 The extracted fandisk model simplified with and without clustering atminimal boundary edges. . . . . . . . . . . . . . . . . . . . . . . . . . 35

4.10 The vertex placement (a) before (left) and after vertex clustering (right),including the mass-points (red) of the associated surface componentsand the constructed vertex tree (b) . . . . . . . . . . . . . . . . . . . . 36

5.1 Some academic and real world input models. . . . . . . . . . . . . . . 40

5.2 The reproduced boundary of the bunny and fandisk model, with a gridresolution of r = 128 and r = 256, respectively. . . . . . . . . . . . . . 41

5.3 A comparison of the engine cover (∼12m triangles) reconstructed byDual Marching Cubes and our thin-shelled variant, with a grid resolutionof r = 1024. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

5.4 The extracted boundary surface of a vibrating and swept bunny, withresolution r = 512. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

5.5 The extracted boundary surface of the fandisk and space station, swepton a sparse trajectory (16 transformations), with a gird resolution ofr = 512 and r = 1024, respectively. . . . . . . . . . . . . . . . . . . . . 44

5.6 The swept volume of the vibrating car engine scenario (∼182k transfor-mations), with a grid resolution of r = 1024. . . . . . . . . . . . . . . . 45

5.7 The swept volume of the assembly path scenario (34 transformations)with gripper model and a grid resolution of r = 1024. . . . . . . . . . . 45

58 List of Figures

Page 67: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

5.8 The fandisk model, extracted from a grid with resolution of r = 512and simplified with an error threshold t = 10−6 (output complexity:∼12k triangles). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

5.9 Simplified boundary surface of the vibrating engine cover (∼707k tri-angles), with error threshold t = 5 · 10−6 and a grid resolution ofr = 1024. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

6.1 The flood fill incorrectly determines the lower right corner of the centercell to be on the inside of the model (orange, grey). Thus, for theextracted boundary surface (blue) the gap is collapsed at this corner. . 52

6.2 The extracted boundary surface (blue) links disconnected regions ofthe original model (orange, grey) together, since the center cell isconsidered to be completely on the inside of the mesh. . . . . . . . . . 52

6.3 A 2D example, where our surface component identification methodlinks disconnected surfaces together. Note that the green component isidentified first, since the associated normals are aligned, although theseintersections are not connected within the cell. . . . . . . . . . . . . . 53

List of Figures 59

Page 68: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction
Page 69: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

List of Tables

5.1 Runtime (in seconds) of the different algorithm stages for reconstructingthe bunny and fandisk model. . . . . . . . . . . . . . . . . . . . . . . . 42

5.2 The overall runtime and output complexity of several mesh reconstruc-tions, where d denotes the depth of the octree. . . . . . . . . . . . . . . 43

5.3 The runtime and memory consumption of the swept volume scenariospresented in this chapter. . . . . . . . . . . . . . . . . . . . . . . . . . . 43

5.4 The simplification time and output complexity of the swept volumescenarios with varying error thresholds t. . . . . . . . . . . . . . . . . . 47

61

Page 70: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction
Page 71: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

Colophon

This thesis was typeset with LATEX 2ε. It uses the Clean Thesis style developed byRicardo Langner. The design of the Clean Thesis style is inspired by user guidedocuments from Apple Inc.

Download the Clean Thesis style at http://cleanthesis.der-ric.de/.

Page 72: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction
Page 73: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction

Declaration

I hereby declare that I have written the present thesis independently and without useof other than the indicated means. I also declare that to the best of my knowledgeall passages taken from published and unpublished sources have been referenced.The paper has not been submitted for evaluation to any other examining authoritynor has it been published in any form whatsoever.

Mainz, January 2, 2017

Julian Brummer

Page 74: Feature Sensitive GPU-based Computation of Swept Volumes · has been studied extensively since the popular Marching Cubes [2] method. A brief A brief summary over recent surface extraction