Quasi-regular Surface Representation

Permanent Link: http://ufdc.ufl.edu/UFE0006546/00001

Material Information

Title: Quasi-regular Surface Representation
Physical Description: Mixed Material
Copyright Date: 2008

Record Information

Source Institution: University of Florida
Holding Location: University of Florida
Rights Management: All rights reserved by the source institution and holding location.
System ID: UFE0006546:00001

Permanent Link: http://ufdc.ufl.edu/UFE0006546/00001

Material Information

Title: Quasi-regular Surface Representation
Physical Description: Mixed Material
Copyright Date: 2008

Record Information

Source Institution: University of Florida
Holding Location: University of Florida
Rights Management: All rights reserved by the source institution and holding location.
System ID: UFE0006546:00001

This item has the following downloads:

Full Text







Copyright 2004


Le-Jeng Shiue

To my parents and my lovely wife.


I owe my success in the research work and my career in computer science to

my research adviser, Dr. Jorg Peters. I benefited from his vision, his broad and deep

knowledge and his rich experiences in computer graphics. I would also like to express my

sincere gratitude to my supervisory committee Drs. Anand Rangarajan, Paul A. Fishwick,

David X. Gu, Loc Vu-Quoc and Benjamin J. Fregly. They gave me significant help in

different stages of my research career.

I am especially grateful to my parents for their emotional support and

encouragement throughout my academic career. Finally I would like to thank my

wife, Ming-Fang Su, for her support in all aspects in my life.


ACKNOWLEDGMENTS ................................ iv

LIST OF TABLES . . . . . . . . vii

LIST OF FIGU RE S . . . . . . . . viii

ABSTRACT ........ ............................... xi


1 INTRODUCTION AND RELATED WORK ................... 1

1.1 Introduction . . . . . . . . 1
1.2 C contribution . . . . . . . . 3
1.3 Related Work: Geometric Data Structure ................. 4
1.3.1 Edge-Based Data Structure .................... 5
1.3.2 Patch-Based Data Structure .................... 6

2 REGULAR STRUCTURES IN MESHES .................... 8

2.1 R regular M eshes . . . . . . . 8
2.2 Semi-Regular M eshes ........................... 9
2.2.1 Subdivision Surfaces ....................... 9
2.2.2 Combining 4- and 3-Direction Subdivision ........... 11
2.2.3 Mesh Data Structures for Semi-Regular Meshes ........ 13
2.3 Quasi-Regular M eshes ...................... 15


3.1 Quasi-Regular Enumeration Graph .................... 19
3.1.1 Atlas: Unstructured Connectivity . . . . 20
3.1.2 Chart: Spiral Index Mapping . . . . 21
3.1.3 Chart: Neighborhood Stencils . . . . 22
3.1.4 A attributes . . . . . . . 23
3.2 M esh Operations . . . . . . . 23
3.2.1 Separation and Aggregation .... . . . 24
3.2.2 Adaptive Refinement and Multiresolution Modeling . ... 25
3.3 Implementation and Analysis . . . . . 26
3.3.1 Implementation . . . . . . 26
3.3.2 Atlas Patching . . . . . . 29
3.3.3 Resource Analysis . . . . . . 31


4.1 Goals and Properties ...............
4.2 Programmable Graphics Hardware ........
4.3 Mesh Mutation Framework ...........
4.3.1 Mesh Mutation in the Graphics Pipeline .
4.3.2 Connectivity and the Domain Atlas .
4.4 Generic Attributes and Access . . .
4.4.1 M emory Access . . . .
4.4.2 Attributes Compilation and Rendering .

. . . 36
. . . 39
. . . 39
. . . 40
. . . 4 1
. . . 44
. . . 46
. . . 47

5 MESH SHADER . . . . . . . . .

5.1 OpenGL Shading Language . . . . . .
5.2 Mesh Shading Language . . . . . . .
5.3 Examples of Mesh Shader . . . . . . .

6 CON CLU SION . . . . . . . . .


A CGAL POLYHEDRON . . . . . . . .


Primal Quadrilateral Quadralization .
Dual Quadrilateral Quadralization .
Combinatorial Subdivision Library .

. . . . . 6 1
. . . . . 6 8
. . . . . 7 3

REFERENCES ...................

BIOGRAPHICAL SKETCH ..............................

Table page

3-1 Patching configurations of Qreg . . . . . 32

3-2 Statistics of PQQ and PTQ refinements on halfedge data structure . 33

3-3 Experiment results of Qreg in various configurations of atlas patching 34

5-1 User-defined and processor-built-in variables of MiPGH. . . 52


























Meshes of a subdivision algorithm . . . . . .

Simplest mesh mutation . . . . . . ... 2

Winged-edge mesh data structure . . . . ... 7

Halfedge mesh data structure . . . . . ... 7

Quadedge mesh data structure . . . . . .... 7

Subdivision surfaces of a pawn model . . . . ... 9

Primal and dual quadrisections . . . . . 10

Refinement scheme of V/3 subdivision . . . . 10

General subdivision stencils for the primal quadrisection scheme . 11

Stencils for Catmull-Clark subdivision . . . . 12

Stencils for Loop subdivision . . . . . . 12

Surfaces of hybrid primal quadrisection subdivisions .. . . 12

Stencils for 4-3 subdivision . . . . . . 13

Surfaces of 4-3 subdivision . . . . . . 14

Texture-controlled displacement and diagonal ridges .. . .. 14

Refinements represented as locally repeated patterns .. . .. 16

Quasi-regularities in the David's head . . . . . 18

Quasi-regularities in the remeshed hand . . . . 18

L ayers in Q reg . . . . . . . 20

Corner distributor . . . . . . . 21

Corner distributors for non-manifold neighborhoods . . .. 21

Spiral constraint . . . . . . . 22

Facet stencil, node stencil and quadrilateral wedges . ....... . 23

Two stencils for V/3 subdivision . . . . .....

Two alternative spiral enumerations of odd steps of V/3 subdivision .

. 24

. 24

Stencil orientation for complex patterns . . . . .

Local editing on Qreg . . . . . . .

Euler operations supported in Qreg. . . .

Genus changing operations supported in Qreg. . . .

C hart separation . . . . . . . .

Chart aggregation . . . . . . . .....

Spiral constraint on decomposing a cube . . . . .....

Adaptive v/3 subdivision based on Qreg . . . . .....

Traversing a 1-ring neighborhood of Qreg . . . .....

Extended vertex-patch for implementing subdivisions . . .

Euler operations for PQQ and PTQ schemes . . . .....

D uck in Q reg . . . . . . . .

F actoring . . . . . . . . .. .

n-gon splitting . . . . . . . .....

Traditional graphics state machines . . . . .....

Programmable graphics hardware . . . . .....

Mesh mutation and the graphics pipeline with a mesh processor . .

Mesh processor and data access . . . . . .....

Mesh data structure in PGH . . . . . .....

Structure of D-facet . . . . . . .....

Structure of D-edge . . . . . . .....

Structure of D-vertex . . . . . . .

Connectivity and attribute lists in MiPGH . . .

Node-morphic attribute list . . . . . . .

Chart-morphic attribute list . . . . . .....

























Micro-facet-morphic attribute list . . . .

Data access by shader and processor in MiPGH . .

A mesh shader's view of the enumeration of (regular) 1-disks .

The specification of the mesh shader . . . .

Catmull-Clark mesh shader . . . . .

The derivative stencils of Catmull-Clark subdivision surfaces .

Normal displacement mesh shader . . . .

Game of life simulation in MiPGH . . . .

Dynamic control of mesh shaders for surface modeling .

CGAL Polyhedron . . . . . .

. 46

. 47

. .. 50

. . 5 1

. 54

. . 55

. 55

. 56

. 56

. 59

Stencil correspondences in Catmull-Clark and Doo-Sabin subdivisions .

Catmull-Clark surfaces of a box model . . . . ..

Euler operations of the PQQ refinement . . . . .

Euler operations of the PQQ refinement in detail . . . .

Doo-Sabin surfaces of a box model . . . . . ..

Abstract of Dissertation Presented to the Graduate School
of the University of Florida in Partial Fulfillment of the
Requirements for the Degree of Doctor of Philosophy



Le-Jeng Shiue

August 2004

Chair: Jorg Peters
Major Department: Computer and Information Science and Engineering

Automatically generated or laser-scanned surfaces often exhibit large clusters with a

uniform pattern. To take advantage of the regularity within clusters, a two-level mesh data

structure (called Qreg) was proposed and implemented. Extending patch-based structures,

Qreg uses a spiral enumeration scheme and an adjustable connectivity stencil to support

efficient pointer-less access within each cluster as well as easy access across cluster

boundaries. Attributes are generic and user-definable; and are allocated according to the

index order of the spiral enumeration. Qreg also supports novel properties: multi-sided

clusters, T-corners between the clusters, cluster joining and splitting, and adaptive as well

as LOD refinement.

An algorithmic framework was proposed to support surface modeling in

programmable graphics hardware. The framework uses a patch-based mesh data

structure that is similar to Qreg. A future graphics processor unit (GPU), enhanced

with random read and write to video memory, was shown to be able to represent,

refine and adjust complex meshes arising in modeling, simulation and animation. To

leverage SIMD parallelism, a general model based on the mesh atlas is developed

and a particular implementation without adjacency pointers was proposed in which

primal, binary refinement of (possibly mixed) quadrilateral and triangular meshes of

arbitrary topological genus, as well as their traversal is supported by user-transparent

programmable graphics hardware. Adjustment, such as subdivision smoothing rules,

is realized via user-programmable mesh shader routines. Attributes are defined in the

graphics application by binding them to one of several addressing mechanisms.


1.1 Introduction

Subdivision surfaces refine user-created models and skin fairing smooths scanned

datasets to create realistic digital representations of the underlying surfaces. These high-

quality surfaces are usually represented as highly compact meshes with a substantial

number of geometry primitives such as vertices, edges and facets. Traditional mesh

representations are usually based on the primitives of the direct neighborhood. For

example, the winged-edge data structure [1] uses edges to describe the adjacency of

the direct neighborhood (Figure 1-3). The adjacency is usually represented by linking

pointers. With the large amount of primitives in a highly compact mesh, these adjacency-

pointer-based data structures are inefficient for generating, rendering and storing the


By closely looking at the regions of a highly compact mesh, regular patterns can be

discerned. Subdivision surfaces (Figure 1-1) contain a uniform pattern repeated within

each superimposed control facet. The scanned dataset (Figure 2-12) contains dynamic

(A) (B) (C) (D) (E) (F)

Figure 1-1: Meshes of a subdivision algorithm: (A) input mesh, (B-D) subdivided
meshes, (E) smooth meshes with superimposed control mesh and (F) subdivision surfaces
with Goraud shading.

input mesh refi nement adjustment
Figure 1-2: The quadrisection (refinement) and the modification of node position
(attribute adjustment) form a simple example of the mesh mutation

patterns locally repeated within each clustered region. A mesh representation targeting

for highly dense dataset should be able to take advantage of these (regional) repeatable

patterns embedded in the topology. Based on the concept of the embedded patterns, a

mesh data structure, Quasi-regular enumeration graph data structure (Qreg), is proposed

and implemented in this thesis. The goal is a concise, yet easily accessible and editable

data structure for manipulations on meshes with the embedded patterns. The mesh data

structure is also intended to be efficient on performing algorithmic refinements and

storing meshes representing algorithm-generated surfaces.

While space efficiency is desirable, the data structure is not intended to replace

progressive transmission [2] and single-rate topology compression [3, 4] or out-of-core

data structures for gigantic polygon meshes [5]. Instead, we focus on the space and speed

efficiency of manipulations on the meshes, which includes manipulations initiated by user

actions or algorithmic refinements.

Originated from the refinement structures supported by Qreg, a framework of mesh

algorithms for programmable graphics hardware is also proposed in this thesis. Mesh

algorithms like subdivisions and skin fairing mutate the meshes into high-quality surfaces

in a multi-pass paradigm, which we call mesh mutation. Each pass of the mesh mutation

combines mesh refinement (insertion of nodes) and mesh attribute adjustment. A simple

example is the quadrisection (refinement) and modification of node position (attribute

adjustment) shown in Figure 1-2.

Mesh mutation is not user-interactive, as opposed to mesh manipulation in
content-creation or Computer Aided Design packages. Transforming user intent into
a high-quality graphical representation can therefore be viewed as a 3-step process:

user-interaction, mesh mutation and mesh rendering. At present, mesh operations are

associated as follows:

Mesh OP User-interaction Mesh Mutation Mesh Rendering

Layer (to date) CPU CPU GPU

The main reason for this distribution of work, despite the availability of vertex shaders

and ample video memory in the latest hardware generation, is the need to access a

mesh with irregular connectivity. Current hardware does not support such access. This

is unfortunate since, real time mutation on graphics hardware is easily within reach.

Refining and adjusting a 1000-node input mesh with four attributes per node four times

costs about 5 million ALU instructions. In the near future, SIMD hardware will be able to

serve several thousand times that many vector operations per second.

We call the proposed framework is MiPGH as it supports Meshes in Programmable

Graphics Hardware. This framework moves mesh mutation into the GPU layer:

Mesh OP User-interaction Mesh Mutation Mesh Rendering

Layer (future) CPU GPU GPU

1.2 Contribution

The research focus of this thesis is a simple and concise, yet easily and efficiently

accessible, editable and algorithmic refinable mesh data structure for high-quality surface

representation. The proposed data structure is called quasi-regular enumeration graph,

short Qreg. Qreg takes advantage of the regionally repeated patterns by providing two

levels of access and manipulation. One general structure accesses and connects clusters,

and a second enumerates cluster elements in an implicit order and, on the fly, computes

access to elements within a cluster. Comparing to traditional mesh data structures, Qreg

has many attractive properties:

* Flexible representation of general meshes with n-gons (i.e. general 2-manifolds).

* Compact storage of large meshes without losing topological details.

* Efficient algorithmic refinement of meshes.

* Support of various subdivision schemes including primal, dual and /3_ subdivisions.

* Flexible atlas configurations to meet application considerations.

* Memory locality and access independence within each cluster.

* Suitable for parallel and distributed computations.

* It has an intrinsic implementation on the SIMD architecture of current graphics


With all these properties, Qreg is the mesh data structure of choice for a framework

of mesh algorithms in the programmable graphics hardware (MiPGH). MiPGH is

designed to enhance the programmability of the graphics hardware and the performance

of the mesh mutations. MiPGH improves the efficiency, flexibility and display quality

resulting from these mesh operations by moving work to the GPU level. The main

advantage of redistributing mesh manipulations to the GPU layer is decreasing the system

bus traffic and increasing the speed through SIMD architecture. A side effect is the user-

transparent implementation of complex but basic graph access and refinement structures.

This is convenient and also raises the level of abstraction and allows the application

program to concentrate on the crucial geometric adjustment operations.

1.3 Related Work: Geometric Data Structure

A mesh is a special graph whose primitives (i.e. vertices, edges and facets) carry

attribute information such as vertex positions or facet colors. The connectivity of a

mesh is described by the incidence of the primitives. For example, an edge connects

its two incident vertices or facets. Meshes are classified according to their embedded

incidence property. In surface representation and graphics modeling, the most used

meshes are orientable 2-manifolds. A well-designed mesh data structure for orientable

2-manifold need to be able to represent every 2-manifolds and implicitly encode the

global orientation. A 2-manifold is a mesh where every interior point has a neighborhood

homeomorphic to a 2D disk (and to a half-disk on the mesh boundary). The 2D disk

homeomorphism guarantees a circulation of the neighbors of every point in a 2-manifold

mesh structure. An orientable 2-manifold is a 2-manifold that can be assigned a global

orientation of every facet. The orientability guarantees a unique next or previous neighbor

in the global orientation when visit a facet across the incident edge.

The naivest way to implement a orientable 2-manifold is the facet-vertex index list.

This facet-based structure indexes the vertices and enumerates each facet as an index

sequence. The edge is searched by pairing the indices of the facets, which makes the

topology traversal a polynomial time operation. Facet-based structures are most efficient

[6] when the represented mesh has constant degree of the facets, for example triangle

meshes. This type of structures is mostly used as the file format in VRML97[7]) or for

the rendering interface in OpenGL[8].

1.3.1 Edge-Based Data Structure

Prominent among the data structures for mesh manipulation are edge-based data

structures that can represent general polyhedrons. Edge-based data structures use the

adjacency pointers to represent the incidences of the direct neighbors. Most popular are

variants of the winged-edge data structure [1] (Figure 1-3), the half-edge data structure

[9] (Figure 1-4) and the quad-edge data structure [10] (Figure 1-5). In practice, two

variants of the half-edge data structure, dual to one another, are used: the facet-edge

pair (Figure 1-4 A) and vertex-edge pair (Figure 1-4 B). Computational Geometry

Algorithms Library (CGAL) [11, 12] uses a facet-edge pair half-edge data structure as

the base for mesh structures such as polyhedron, planar map, etc. The quad-edge data

structure fuses the two variants of half-edge data structure, and provides a symmetric

dual/primal view of the mesh. These edge-based data structures can represent every

2-manifolds and the global orientation is implicit encoded (except the winged-edge data


Edge-based data structures are particularly efficient for local reconfiguration of the

mesh since operations like adding or deleting edges amount to changing adjacency

pointers. For regular refinement, however, this indirect, pointer-based access is

unnecessarily general. Moreover, information about the initial control mesh is lost

after refinements. Extra data associated with the (half-/quad-) edges are required to

reconstruct the control mesh. And since attributes of the primitives are attached to

(half-/quad-) edges, the attributes are usually dispersed in memory. Hence, no storage

locality of attributes can be assured. Joy et al. [13] gave an excellent illustration of the

standard edge-based and the complementary corner-based data structure. For triangle

meshes, Rossignac et al. [14] leveraged the advantages of corner-based access specialized

to triangulations. The basic trade-off between access speed and the complexity of the

connectivity structures was highlighted in the scalable mesh structure [15].

1.3.2 Patch-Based Data Structure

By contrast, patch-based structures [16, 17, 18] are particularly efficient for iterative

refinement of the mesh. They contain a static domain topology (usually considered

irregular) and use regular 2D arrays, akin to polynomial patches. The static domain

topology is usually explicitly structured as an edge-based structure connecting the

patches. The 2D arrays (i.e. the patches) implicitly represent the uniform, regular

connectivity of the primal quadrisection subdivisions. These patch-based data structure

can only represent quadrilateral or triangle 2-manifolds due to the limitation of the

row- or column-major array enumeration. A global orientation is not encoded and extra

information is required to trace the proper orientations of the array when accessing the

patch across the atlas edge.

The refinement connectivity is predefined in order to fit in the 2D memory

arrangement, e.g. the tensor-product arrangement of Catmull-Clark subdivision.

Attributes are stored compactly in the same order as the index enumeration of nodes

or facets. On patch boundaries, node attributes are duplicated to simplify refinement and

speed up rendering. While the implicit connectivity is time and space efficient, it can

be overly restrictive in a user-interactive environment. It can be also restrictive in the

Figure 1-3: Winged-edge mesh data structure: four adjacency pointers for each edge to
the four incident edges.

(A) (B)

Figure 1-4: Halfedge mesh data structure: each halfedge points to a previous, a next
and an opposite halfedge. (A) The facet-edge pair halfedge and (B) the vertex-edge pair
halfedge are the two variants dual to one another.

Figure 1-5: Quadedge mesh data structure: each edge corresponds to four quadedges,
two facet-edge pairs and two vertex-edge pairs.

refinement schemes. For example, dual schemes, such as dual quadrilateral quadrisection

(Figure 2-2) do not fit this schema well. For meshes with n-gons (n > 4), a preprocessing

of quadrisection or triangulation is needed to fit in the tensor-product arrangement of the

2D array. Hierarchical modeling, hardware-specific implementations and rendering of

subdivision schemes are usually based on the patch-based data structure [19, 20, 21, 16].


Algorithm-generated meshes and human-created models typically have regions

where connectivity has a repeated pattern. We call such regions with patterns regular. For

example, geometry images [22, 23] have a grid-pattern, and triangle-based subdivision

schemes [24] generate nodes with 6 neighbors. Even a 3D-scanned dataset [25] and the

remeshed mesh [26, 27] had repeated patterns. Note that regularity has many different

definitions in other application domains that involve meshes. For example, in finite

element analysis, regularity is based on the numerical differentiability of elements

associated with a mesh.

2.1 Regular Meshes

A mesh with only regular connectivity is attractive in applications such as hardware

rendering [28] and mesh compression [29]. It also simplified many mesh algorithms. For

example, 3D modeling algorithms may be transformed into 2D drawing algorithms, and

shading techniques such as texture mapping is supported as a rectangle image pasting.

Many image processing techniques can also be easily extended to work on such regular

meshes. Yet meshes with only regular connectivity do not naturally exist for scanned

dataset, human-created models or even algorithm-generated surfaces. To create such plain

regularity, the geometry resampling and topology remeshing of the original dataset are

absolutely essential. The resampling introduces distortions which prohibits applications

such as CAD where high precision is required. The remeshing results in undesired

surface features which are amplified in subdivision surfaces. And in a user-interaction

environment, it is not possible to maintain the global regularity. Therefore, the regional

regularity becomes the key to efficiently supporting the surface modeling, rendering, and

storage for a general algorithm-generated mesh or a human-built model.


Doo-Sabin Loop /3
Figure 2-1: Subdivision surfaces of a pawn model. Control meshes are shown in two
configurations: mixed quad-triangle and uniform triangle.

2.2 Semi-Regular Meshes

Subdivision algorithms [30] generate high-quality surfaces by refining the

connectivity and smoothing the geometry. The refined mesh (or subdivision connectivity)

has regular regions divided by the initial control net (usually considered irregular).

Subdivision connectivity is also called semi-regularity, which is layered as an irregular

skeleton mesh on several regular submeshes.

2.2.1 Subdivision Surfaces

Subdivision algorithms can be formulated as a series of mesh mutation steps with

each step consisting of connectivity refinement followed by geometry smoothing.

Examples of the subdivision surfaces are shown in Figure 2-1.

Connectivity refinement. If the refinement associates a new node with every old

node (and inserts nodes along edges and in the facets), the scheme is called primal. If the


Initial mesh

Refined mesh

Figure 2-2: Three quadrisection refinements are used in subdivision surfaces: primal
quadrilateral quadrisection (PQQ), primal triangle quadrisection (PTQ) and dual quadri-
lateral quadrisection (DQQ).

Initial mesh Facet trisection Edge flipping
Figure 2-3: v/3 refinement contains two substeps: facet trisection by inserting facet
centroids and edge flipping of the old edges.

refinement creates a dual mesh to a primal scheme, the scheme is called dual. Figure 2-2

shows three popular refinements in state-of-the-art subdivision algorithms. The primal

quadrilateral quadrisection (PQQ) is used by Catmull-Clark subdivision [31] and the dual

quadrilateral quadrisection (DQQ) is used by Doo-Sabin subdivision [32]. The primal

triangle quadrisection (PTQ) is used by Loop subdivision [24].

A special refinement is the v/3 refinement (Figure 2-3) used by v/3 subdivision [33].

This refinement is considered a primal scheme since it associates a new node with every

old node and inserts nodes in the facets. Two steps of the v3 refinement are equivalent

to one step of the primal ternary refinement. It results in a slower converging speed

compared to binary refinements such as PQQ and PTQ.

U2 i4 2 U2c5
I |4
P2 --3- P3 P2--U3 3-- 4
1 --a1-- 4 1 --a1 ,1

P2 _Q2 P3 P2 2 2

P2 P3

Figure 2-4: The general subdivision stencils of the generic 1-disk, binary, primal quadri-
section scheme. Only the regular stencils (including stencils of the quadrilateral-triangle
transition) are shown. The red dots and red circles indicate the new nodes of the subdi-
vided mesh.

Instead of using a uniform refinement, some subdivisions, for examples 4-3

subdivision [34] and Quad/Triangle subdivision [35], use hybrid primal quadrisection

(Figure 2-7). Details of 4-3 subdivision, a hybrid scheme, are given in Section 2.2.2.

Geometry smoothing. If every new node is defined as a weighted combination of old

nodes that lie on (old) facets with a common (old) node, the subdivision acts on a 1-disk.

The combination of old nodes is often succinctly and graphically expressed as a stencil

that displays a portion of the old graph with the weights (that must sum up to 1) in place

of the nodes. Figure 2-4 shows a general stencil configuration of primal quadrisection

subdivisions. The resulting new node is indicated either as a circle, if it corresponds

to an old node, or as a *, if it lies on an edge or in a facet. Stencils of Catmull-Clark

subdivision and Loop subdivision are shown in Figure 2-5 and Figure 2-6, respectively.

If the stencil does not change with the refinement level, the subdivision is stationary.

2.2.2 Combining 4- and 3-Direction Subdivision

The 4-3 subdivision is a combination of simple, fixed subdivision rules. It applies to

a quadrilateral triangle mesh, avoids the diagonal artifacts of tensor-product subdivision

and provides equi-contraction and bounded curvature everywhere, including 4-3

1- 6- 1 1- 1

1 6 1 1- 1

1 4n2 7n
-6 6* 16
6 6

I' ** ,

Figure 2-5: Unnormalized stencils for Catmull-Clark subdivision; n is the valence.

1-- 1




Figure 2-6: Unnormalized stencils for Loop subdivision; n is the valence, and
- (8 + cos())2.

transitions from a quadrilateral to a triangle net and at extraordinary nodes. Stencils of

the 4-3 subdivision are defined in Figure 2-8. Note that new nodes on edges attached to

an extraordinary node can be defined in two ways; by one of the regular rules (lb), (2b)

or (3b), or, alternatively, by rule (4b). In the first subdivision steps Ca < c0, say c0 = 3,

we average '- times (4b) with times the regular stencil. Recall that the stencils are

first normalized to sum to 1, e.g. the weights of (4b) need to be scaled by 1/4 before

averaging. After subdivision cG, new nodes on edges attached to an extraordinary node

only use (4b).

(A) (B)

Figure 2-7: Hybrid primal quadrisection subdivisions refine a mixed mesh of quadrilat-
eral and triangle facets. (A) Input control net and limit surface. (B) Limit surface scaled 3
times with and without the refined control net.

0-- 1--0 0- 3 2 l P
(A) 1
(A) 4 18 ( 3
0 1 0 2 1 1
1 6 1 0
1 6 1 162 1 1 /
(B) 1 1 6 222 2- -3 1
1- 1 f3

(1) (2) (3) (4)
Figure 2-8: Stencils for 4-3 subdivision: row (A) gives rules for new nodes replacing
old nodes, row (B) show new nodes associated with edges and faces. The columns corre-
spond to: (1) PQQ subdivision, (2) Quadrilateral-Triangle transition, (3) PTQ subdivision,
(4) extraordinary node subdivision (vertex with n neighbors). Here !3i : (1 + 2cos ),
n3 : 1 and ax is free to choose in the interval [1/4..3/4]. The recommended values are
=(n, =3) 1/4, J(n=4) =1/2 and ot(n>4) = 3/5. Near extraordinary nodes, rule (4B) slowly
takes over from rules (1B,2B,3B) as the subdivision level increases.

Figure 2-9 demonstrates the 4-3 subdivision on a quad-triangle control net. Figure

2-10 shows the comparison between Catmull-Clark and 4-3 subdivisions on a model

containing ridges by texture displacement. Catmull-Clark subdivision has the ripples on

the ridge along the diagonal parametric axis and the unique 4-direction box spline of 4-3

subdivision linearly interpolate the diagonal ridge. The proof of the linear interpolation

can be found at [34].

2.2.3 Mesh Data Structures for Semi-Regular Meshes

Several mesh data structures can support subdivisions on (orientable) polyhedral

meshes. Edge-based data structures [36] are commonly used and allow for maximal

flexibility. Though given our primary interest in structured connectivity configuration,

namely subdivision connectivity, they are unnecessarily complex. Appendix B gives the

details of the design and implementation of a subdivision library based on the halfedge

data structure. A representation as a forest of quad-trees (with one tree per mesh facet)

[37] is useful for a structured, adaptive refinement but the neighbor access patterns

Figure 2-9: 4-3 subdivision: simple shape with extra-ordinary nodes of low valence and
quadrilateral to triangle transitions.


Figure 2-10: Texture-controlled displacement after three steps of subdivision. (A)
Catmull-Clark subdivision, displacement, plus two additional Catmull-Clark subdivision
steps. (B) 4-3 subdivision using a = 0.6, displacement, smoothed by two additional 4-3
subdivision steps.

appear to be too complex for efficient parallel realization. Quad-trees is also restrictive

on the dual or J/3 schemes. All of the above structures require extensive manipulation

of the adjacency pointers throughout the refinement, increasing the complexity of the


Semi-regular meshes generated by subdivisions can be segmented into two layers:

the input control net and the structured regular regions. Borrowing the terms from

topology, the input control net is the atlas and the regular regions are the charts. Each

chart has the same size of the submesh with one uniform regularity. With adaptive

subdivisions, the charts have a dynamic submesh size, still with the same uniform

regularity. Patch-based data structures [16, 17, 18] take advantages of the 2-layer

structure: each chart is represented as a patch and the atlas is represented as a general

adjacency-based mesh structure. Patch-based data structures nullify the manipulations of

the adjacency pointers throughout the refinement as the atlas stays static all the time. The

atlas is usually an edge-based mesh data structure. The refinement is performed as the

regular refinements within the patches. The refined meshes maintain the memory locality

in each patch that much improves the rendering performance. Though efficient on both

speed and space aspects for subdivisions, patch-based data structures in [16, 17, 18] are

restricted on the supported subdivisions. Dual and v/3 schemes do not generate patched

array in each facet of the input control mesh and non-quadrilateral or non-triangle input

mesh need to be preprocessed to fit into the patched configuration. The refined meshes

in the patch structure are also not friendly to user-modifications or to incorporation in

a graphics modeling pipeline. Hardware designs and hierarchical mesh modeling are

usually based on the concept of the semi-regular meshes.

2.3 Quasi-Regular Meshes

Semi-regular meshes is the direct result of many algorithmic refinements (such as

subdivisions), though neither can it represent meshes of user-created models (e.g. CAD

models) nor of the scanned 3D dataset. By closely looking at these meshes, they contains

Initial Mesh PTQ P Q DQQ

Figure 2-11: Refinement schemes applied to a triangle fan: primal triangle quadrisection
(PTQ), primal quadrilateral quadrisection (PQQ), dual quadrilateral quadrisection (DQQ)
and V/3 refinement. The second row shows the locally repeated pattern (stencils) for the
refined mesh.

dynamic patterns locally repeated within each clustered area. The dynamic regional

patterns (i.e. connectivity) are called quasi-regularity, and meshes with such regularity

are called quasi-regular meshes. Quasi-regular meshes is a superset of the subdivision

generated semi-regular meshes. Similar to a semi-regular mesh, a quasi-regular mesh can

be segmented into atlas and charts. The atlas is defined by the regularity partitions of the

mesh and, in general, is considered irregular. The charts are represented as clusters of

elements (nodes or facets) so that within each cluster, every element has a neighborhood

graph enumerating the connectivity of the cluster. The neighborhood graph (i.e. the

pattern within a cluster) is called a stencil.

Subdivision connectivity, in particular, has subdivision regularity within each cluster,

which is enumerable by a pattern of vertices or facets. The PQQ and PTQ schemes have

the facets refined by replicating uniform quadrilaterals and triangles, while DQQ and

v/3 schemes have the vertices refined by repeating valence-4 vertices (Figure 2-11). The

subdivision stencils are also required to be orientation symmetric and uniform throughout

the whole mesh.

Meshes where such clusters are of substantial size arise also as user-created models

(Figure 3-19), scanned datasets (Figure 2-12), and remeshed meshes (Figure 2-13).

Unlike subdivision connectivity, the clustering can be adjusted and the patterns are local


and changeable. Clusters are chosen so their elements can be enumerated on an inward

spiraling path. This spiraling enumeration lifts off the restriction of the quadrilateral or

triangle clustering and makes it possible to have clusters like n-gons and circular bands.

In general, stencils are represented as regional patterns that describe the neighborhood of

a vertex or facet. For stencils without orientation symmetry, stencil rotations at the corner

of a cluster can represent more complex regularity (Figure 3-8).



Figure 2-12: Quasi-regular meshes include scanned and remeshed data such as David's
head. The detail shows the quasi-regularity near the eye and patterns generated by spiral
enumeration of simple stencils. The David model is courtesy of David X. Gu.

(A) (B) (C)
Figure 2-13: Hand model remeshed by anisotropic polygonal remeshing. Clustering can
be adjusted based on usage: (A) clustering for subdivision (B), (C) an alternative larger
fan cluster. The remeshed hand model is courtesy of Pierre Alliez.


Quasi-regular enumerated graph, also called Qreg, is a mesh data structure based on

the quasi-regularity. Qreg is a hybrid, adopting a corner-based mesh data structure and

a patch-based mesh data structure. Qreg segments the mesh into a two layer structure

to provide connectivity operations such as the general mesh access, manipulation, and

refinement. Qreg has three key components:

* Corner distributors to access clusters.

* Spiral-enumerated index maps to instantiate each cluster.

* Modifiable stencils to delimit the cluster elements.

The corner distributors implement a corner-based data structure using a fixed number

of adjacency links regardless of the vertex valence or the facet degree. They support

T-corners, Euler as well as genus-changing operations, and some nonmanifold structures.

The spiral enumeration encodes the orientation and simplifies access across cluster

boundaries, including composite clusters and n-gon clusters that are prohibited as units

in patch-based data structures. Together with corner distributors and cluster stencils, the

spiral enumeration defines the regional connectivity within each cluster and facilitates

the joining or splitting of clusters for a kd-tree-like adaptive refinement. Uniform

multiresolution is supported by an LOD hierarchy per cluster. Various refinement

structures, including primal, dual, and V/3 subdivisions, are efficiently supported for

performing refinements and storing the refined mesh.

3.1 Quasi-Regular Enumeration Graph

Qreg is a three layers mesh data structure (Figure 3-1): two layers to structure

topology and one layer to access and store attributes. The topological layers provide

two levels of access and manipulation on the connectivity: one general structure to

access and connect clusters (i.e. submeshes), and a second that implicitly enumerates

and manipulates the elements within a cluster. In analogy to topological concepts, we

refer to the two levels as atlas (the general structure) and charts (the clusters). Each

cluster corresponds to one chart. The atlas, based on the corner adjacency, provides

access to clusters and is equivalent to edge-based mesh data structure. The mesh elements

inside a chart are accessed via an implicit index map, which delimits the storage layout

of elements and serves as the access table of neighbors. Geometry attributes, such as

position and normal, and algorithmic attributes such as crease values, are stored in the

order of the index map for memory access locality. Qreg is devised to represent every

2-manifolds with the encoded orientation.

0 I 0 0 C 0 0 0

Mesh Atlas Charts Attributes

Figure 3-1: Qreg represents a mesh via layers of the atlas, charts and attributes.

3.1.1 Atlas: Unstructured Connectivity

The atlas represents the planar graph of clusters with the help of corner distributors.

Corner distributor is a succinct variant based on the concept of the quad-edge. Each

corner distributor corresponds to a vertex-cluster pair. The corner distributor is an

oriented 4-tuple (Too,TO 1,rlO,,rll) where (Figure 3-2, (A))

* Tox are the links along the incident edges.

* Tlx are the links across the incident edges.

To circulate within a cluster, one follows the inner links rox; whereas to circulate around

a vertex, one follows the outer links Tlx. A shortest loop of inner links circulates a facet,

a shortest loop of outer links circulates a vertex and a shortest loop of alternating links

circulates an edge. Global boundaries are represented with boundary corner distributors

whose inner links are self loops (Figure 3-2, (B)). Boundary vertices are circulated by the

-0-10 1 "

(A) (B)

Figure 3-2: (A) A comer distributor has two inner links (dashed) and two outer (solid)
links. (B) Global boundaries have comer distributors (gray) whose inner links are self

shortest loop of outer links involving a boundary corner distributor. Comer distributors

also supports modeling certain vertex- and edge-wise nonmanifolds (Figure 3-3).

3.1.2 Chart: Spiral Index Mapping

Each chart represents a cluster. The challenge is to efficiently visit the elements of

the cluster without introducing additional structures and to efficiently collect the local

neighborhood of an element. Both issues are addressed by requiring that any cluster

satisfy the spiral constraint.

spiral constraint: All elements in a chart lie on a (Hamiltonian) path that starts at a

comer and spirals inward in counterclockwise order.

Elements can be mesh nodes or facets. Figure 3-4 gives examples satisfying and failing

the spiral constraint. Note that the chart is not required to be a regular n-gon to satisfy the


Besides regular n-gons, composite rectangles or fans, and certain annuli meet the

constraint. Spiral indexing has two advantages over row-major or column-major indexing:

Figure 3-3: Non-manifold access via boundary comer distributors.

0 0 1j 14 13 (j 1 0 1 1F4 1 13 12
1 2 12 10 1 6 1 ? 11
13 1
2 12 10 2 17 24 21 10 3 18 9 2 3 9 10

13 14 59 3 18 179 20 6 7
(A) (B) (C) (D)

Figure 3-4: (A-C) Regular n-gons satisfying the spiral constraint. The T cluster in (D)
fails the constraint. The indices represent the layout of the index map in different types of

it can enumerate n-sided structures and it encodes orientation so that it is easy to collect

neighborhoods straddling the boundary between two charts. Spiral indexing in Qreg

fulfills the goal of representing every 2-manifolds with encoded global orientation.

3.1.3 Chart: Neighborhood Stencils

To locate the local neighborhood of an element of the cluster, we apply a stencil.

A stencil is a subgraph with encoded connectivity representing a small neighborhood of

a facet or of a node (Figure 3-5). Enumeration of the stencil on an index map delimits

the connectivity of the chart. The stencil is easily specified and visualized if we locally

superimpose a quad grid (i.e. the index map) on the cluster. This is trivial for quadrilateral

and triangular clusters. It is also trivial for an n-gon cluster if we superimpose the

stencil on any two consecutive triangular or quadrilateral wedges of the n-gon(Figure

3-5). Figure 3-6 shows how 3 refinement can be mapped to a quadrilateral grid. 3

refinement alternates between a node stencil for the odd steps and a facet stencil for the

even steps. The odd pattern is called porous since it only covers a subset of the elements.

Some porous patterns can be compressed to a compact pattern (Figure 3-7). More

complex regional regularity can be generated by rotating a stencil at comers of the chart

(Figure 3-8). To enumerate the center of a n-gon chart, a degree n facet or a valence n

vertex overrides the stencil.

2 12 10
13 17
3 18 9
14 16
4 15 8
/75 7

Facet Stencil Node Stencil Quadrilateral Wedges

Figure 3-5: Two types of stencil (facet stencil and node stencil) are used to enumerate
the connectivity within charts. To map stencils on an n-gon, continuous quadrilateral
wedges of index grids are used.

3.1.4 Attributes

Geometric and algorithmic attributes in Qreg are allocated independently from the

topology (i.e. the atlas and charts). The storage of attributes is in the index order of the

spiral index map. Attributes on the chart boundaries and corners are duplicated. To avoid

numerical inconsistencies, duplicates refer to the value of the attribute with least index.

The memory locality and access independence is assured within each chart, which allows

fast rendering, parallel computing, distributed processing, and out-of-core manipulations.

3.2 Mesh Operations

The atlas supports Euler operations1 and genus changing operations by

reconfiguring the corner distributors as illustrated in Figures 3-10 and 3-11. Connectivity

can also be changed within charts. Replacing the stencil yields a uniform edit on the

entire chart. In particular, we can apply different stencils at different levels of refinement

and/or in different clusters. For a localized edit, the submesh becomes a separate chart

with the new stencil as shown in Figure 3-9.

1 Euler operations preserve the Euler-Poincare equation: V E + F = 2 2G where
VIE/F is the number of the vertices/edges/facets and G is the genus of the underlying

Figure 3-6: V3 subdivision alternates between two stencils, one node stencil and one
facet stencil.

0 0

9 27
1 8 3 24

10 14 30 42 ,
2 18 7 6 54 21
16 1 48 51 1 1
11 12 13 33 36 39
3 4 5 6 9 12 15 18

(A) (B)

Figure 3-7: Two alternative spiral enumerations of odd steps of the v3 refinement.
While even steps have a unique stencil, the odd steps can be (A) compact or (B) porous,
with idle elements preallocated for the following even step.

3.2.1 Separation and Aggregation

Chart separation splits a parent chart into several subcharts which maintains spiral

indexing constraint (Figure 3-12). Charts are allowed to join nonconformally and form

T-corners: the corresponding corner distributor is simply skipped when traversing the

unseparated chart (Figure 3-13). By definition, separation breaks the memory locality of

stored attributes of the parent chart. The attributes are rearranged to localize the memory

of each new chart. Although such memory shuffling is, in principle, costly, its effect is

negligible during user-interactive connectivity editing and preferable to an indirection

during rendering. To avoid the excessive memory shuffling, the attributes can be allocated

in a level-of-detail structure.

Chart I'tit'i'n/ reverses separation by reconfiguring the atlas and rearranging

attribute memory. Aggregation can also generate T-corners and must enforce the spiral

Figure 3-8: Different patterns are obtained with and without re-orientation of the stencil
at comers.

constraint for the composite chart. Figure 3-14 shows three alternative representations of

a cube as composite charts. In addition to the composite triangle, quadrangle and n-gon,

the composite can be an annulus with equal length along both edges (equivalent to a

circular composite quadrangle as in Figure 3-14 B) or have one side shorter (equivalent to

a composite n-gon with a hole in the center).

3.2.2 Adaptive Refinement and Multiresolution Modeling

A simple adaptive refinement of Qreg is supported by each chart keeping count

of the current level and the maximal of refinement. Each chart stores a pyramid of

the attributes. Level-of-detail rendering is achieved by tracking the active level of the

attribute pyramid in each chart. The separation of the chart yields fine-grain adaptive

refinement as illustrated in Figures 3-12 and 3-15. Repeated separation (i.e. the adaptive

hierarchy) is registered in a kd-tree-like structure. The rendering routine is responsible

for stitching different levels of the charts without cracks. Some tessellation schemes (e.g.

v/3 refinement) implicitly transit the connectivity between charts without cracks (Figure


user manipulation chart separation
Figure 3-9: Separating the chart and replacing the stencil to support local changes.

split facet

join facet

Figure 3-10: Euler operations supported in Qreg.

make hole

fill hole

/ : split loop

join loop

Figure 3-11: Genus changing operations supported in Qreg.

Multiresolution modeling is supported similar to the fine-grain adaptive refinement.

Only this time user-interaction triggers the separation. The separation is invoked to isolate

the affected submesh of a user manipulation. A new stencil is assigned to the separated

chart if the connectivity pattern is changed. The hierarchy of the edited mesh is registered

in a kd-tree-like structure. The adaptive update in multiresolution modeling is wildly used

in surface modeling [38, 19] and grid-based numerical computing [39].

3.3 Implementation and Analysis

3.3.1 Implementation

The atlas is structured as an array of corner distributors. The corner distributors

of each chart are stored consecutively in counter-clockwise order and clusters of the

(A) (B)
Figure 3-12: Chart separation. (A) A split into three enforces the spiral constraint when
separating the upper left chart. Green circles indicate element duplication. (B) Adaptive
PQQ refinement initialized on an n-gon.

a b c d a l d

Figure 3-13: Chart aggregation (removal of the separating edge) creates a T-corner.
When traversing the vertical edge a -+ d, the aggregated side skips bc. Red edge indicates
the removed edge.

same cardinality n are grouped together. Since inner links can be replaced by modulo n

computation, unidirectional traversal requires only one outer link to be stored per corner


The index map allows traversing a cluster. It is computed on the fly from three

numbers stored with the chart, and one with each corner distributor. The chart records

(1) an index base, (2) the last element of the outermost spiral ring (boxes in Figure 3-4)

and (3) the change 8 in the number of elements when switching to the next, more inward

(A) (B) (C)
Figure 3-14: Decompositions of a cube that meet the spiral constraint. The red Ts indi-
cate T-corners between the charts. (B) has an annulus chart after the decomposition.

Figure 3-15: Adaptive v3 refinement uses chart separation. The adaptive cluster is blue.

orbit. For clusters in Figure 3-4, 8(triangle)= -3, 8(quadrangle)= -2, 8(hexagon)= -1.

Each corner distributor (circle in Figure 3-4) stores the index offset from the start element

so that a consecutive pair defines a range for stepping linearly from element to element.

The equal-length annulus (Figure 3-14 A, B) is enumerated like a quadrilateral strip and

the nonequal-length annulus is an n-gon with a hole, where the inner corner distributors

act as the stop condition of the enumeration.

Each chart has a stencil compatible with the index map enumerated by the chart.

The regularity with a chart is delimited by superimposing the stencils on the index map.

Stenciling quadrilateral or triangle charts is as simple as superimposing the stencils on a

grid-like index map. Stenciling a n-gon chart is done by superimposing the stencils on a

sequence of the consecutive quadrilateral wedges of the n-gon (Figure 3-5). There are

several ways to implement a stencil, depending on how much variation is expected. In

a static setting, say the implementation of a specific subdivision algorithm, the stencil

would typically be implemented as a procedure. To support a large variety of user-defined

patterns, we developed an encoding based on locally placing the stencil on a regular

quadrilateral grid as illustrated in Figure 3-7, Figure 3-6, and Figure 3-5.

To illustrate the interplay between the index map and the stencil during traversal,

we consider the simplest case, the quadrilateral mesh and a 1-ring neighborhood as in

Catmull-Clark subdivision. The elements of a chart and their neighbors are accessed

by maintaining indices from three orbits. In the generic case (Figure 3-16 B) the 1-ring

neighborhood is easily constructed by index increment or decrement from the three

indices. On the chart boundary (Figure 3-16 A), the corner distributor locates the orbit

in the opposite chart and the lookup by increment and decrement is equally efficient and

local in storage access. At a corner, the indices are adjusted using 8 and the index offset

stored in the corner distributor. The center of an n-gon cluster has special connectivity

since it is a degree n facet or a valence n node. Access is fast for the main case of

structured traversal and still fast enough when a user picks a random node interactively.

S0 00 000

(A) (B) (C)
Figure 3-16: Traversing a 1-ring neighborhood (A) across a cluster boundary, (B) inside
the chart, and (C) at the center. The touching circles indicate duplication of boundary

3.3.2 Atlas Patching

Qreg supports three atlas patching configurations: facet-patch, vertex-patch and

cluster-patch (Table 3-1). Facet-patch patches the spirally enumerated elements within

each facet of the input mesh. Facet-patched Qreg puts the extraordinary elements into

the facet corners. Hence an atlas structure is required to access the neighbors around

the extraordinary elements. Dual to facet-patched Qreg, vertex-patched Qreg clusters

the elements circulating around a vertex. Vertex-patched Qreg requires a quadrisection

before clustering the elements around the original vertices. The quadrisection creates a

regular transition between two vertex-patched charts that separates the irregular elements.

Each vertex-patch centers at an irregular element and is bounded by regular corners

and boundaries. An extra 1-ring can be spirallyy enumerated) attached surrounding

the outmost ring of the chart. This 1-ring extension makes the chart self-contained

for algorithmic refinements or numerical computations (Figure 3-17). The extended

vertex-patched Qreg is intrinsic for the parallel computing and distributed processing.

It is especially attractive in hardware implementation since the irregular structure is

Figure 3-17: Qreg with the extended vertex-patches has an extra 1-ring (orange) over-
lapping the neighbor charts. Each extended vertex-patch is self-contained for subdivision

completely avoided. Each extended vertex-patch can be processed like a geometry image

but without geometric resampling and topological remeshing. This image-like structure

is natural for subdivision implementations in the pixel shader of current programmable

graphics hardware.

The mesh decomposition is the third configuration of patching Qreg. Qreg can

be decomposed by grouping the spiral enumerable neighbors of the mesh. Several

decomposition schemes have devised for different application purposes in recent years.

Shape approximation [40], mesh simplification [41, 42], surface interference detection

[43], piecewise texture mapping [44], and feature capturing [45] are all based on the

concept of the mesh decomposition. Most decomposition schemes either remesh the

connectivity (to regularize the mesh) or partition off the irregular submeshes. Resampling

of the geometry data is also a key component for some schemes.

An optimally decomposed Qreg minimizes the number of charts. This reduces

unwanted overhead due to duplications on chart boundaries of representing a mesh. The

optimization involves two goals:

Cl: Choosing stencils that maximize the area reachable by spiral enumeration.

C2: Minimizing the number of charts.

Cl is a local optimization problem that is easy to solve if the stencils are limited and

the charts can only be regular n-gons. Without these preconditions, solving Cl requires

finding a Hamiltonian path that enumerates the stencil and delimits the submesh. C2

is a global optimization problem that can be simplified to Clique Cover (i.e. partition

into cliques [46]). For a fixed stencil enumerating a clique (i.e. the complete submesh),

C2 requires partitioning the mesh into a minimal number of cliques. The clique cover

problem is NP-complete. Since Cl only guarantees local optimization, optimized

clustering of Qreg is not assured even if C2 is optimized for a fixed stencil in Cl.

Instead of looking for the optimized clustering, our clustering algorithm is designed

for simple implementation and a reasonable result since mesh compression is not the

focus of this thesis. Our algorithm recursively groups the elements around a user-picked

element or the highest-valence element of unclustered elements. For the clustering of

small objects, the user specifies a stencil and a start element among the unclustered

elements. Then a flooding heuristic expands the cluster as far as possible without

violating the spiral constraint and interfering with the existing clusters. For large meshes,

the optimal placement of the start element is not as crucial. Our algorithm locates a

start element, searches its neighborhood for a prescribed stencil, and grows a region

enumerated by the pattern. The start element is chosen as the highest-valence element of

the unclustered elements and as the central element of the new cluster. The spiral flooding

heuristic is then called to grow a region that is enumerable by the prescribed stencil. Once

the large regular areas are exhausted, the remaining facets are grouped as pairs where

possible. The clustering can be multipass by clustering the clustered mesh. The multipass

clustering groups large area filled by grid-like connectivity.

Our heuristic clustering algorithm on the Gripper model has a lossless connectivity

compression by 70%, 45%, 20% of facets, edges and vertices (Table 3-1 second row).

The number of edges and vertices can be further reduced by removing the valence 2

vertices from the clustered mesh. A mesh, after removing valence 2 vertices, is still

topologically equivalent to the original mesh.

3.3.3 Resource Analysis

We compare Qreg to half-edge and patched-based structures. We consider an input

mesh with ne edges, nf quadrilateral facets and ny vertices. Assuming that facets are at

Table 3-1: Patching configurations of Qreg. The number indicates the size of the facets,
edges and vertices of the atlas of the patched Qreg. The atlas of a facet-patched Qreg is
equivalent to the input mesh.

Gripper 726, 1452, 716 716, 2904, 2178 216, 794, 568

least paired or connected into a fan, at least edges are eliminated. The number of half-

edges equals the number of corner distributors in a mesh and each halfedge (or corner

distributor) contains 2 adjacency pointers for the incident facet/vertex and 3 adjacency

pointers for adjacent halfedges If we now perform k steps of a PQQ-type subdivision,

then the patch-based structure and Qreg retain their fixed number of lOne and lOne 5nf

adjacency pointers respectively, and a general half-edge data structure needs to allocate

~ 4k5ne adjacency pointers. Since some elements are duplicated, patch-based structures

allocate (2k + 1)2ni space for node attributes, Qreg (2k 1 + 1)(2k + 1) and the half-

edge structure allocates ~ 4kn,. The attributes space of Qreg can be further reduced if

Qreg is clustered (Table 3-1).

To quantify the savings for PQQ and PTQ refinement, Figure 3-18 illustrates the

Euler operations, insert-vertex-on-edge (IVE) and insert-edge-between-vertices (IEV)

used by a halfedge structure. Each IVE changes 8 adjacency pointers and each IEV 10.

For the sake of simplicity, the changes of the incident facet and vertex are not counted.

Facet-patch Vertex-patch Cluster-patch

6, 12,8

8,24, 18


Table 3-2: Statistics of PQQ and PTQ refinements on a halfedge data structure. Numbers
of Euler operations and adjacency-pointer operations (APO) are counted for each edge
and facet in a refinement. d is the degree of the facet.

IVE per edge APO per edge IVE : IEV per facet APO per facet
PQQ 1 8 1 :d-1 10d-2
PTQ 1 8 0:3 30

Both IVE and IEV allocate memory for two halfedges. There is 1 IVE per edge for

both PQQ and PTQ refinement. PQQ uses 1 IVE and (d 1) IEVs per facet, where d

is the degree of the facet, and PTQ uses 3 IEV per facet. The IVE and IEV for PQQ

and PTQ refinement are summarized in Table 3-2 with the pointer manipulation count

in parentheses. These topology operations imply the extra space (storage of adjacency

points) and extra time (changes of adjacency pointers) of the subdivisions on an edge-

based mesh data structure. None of these operations are necessary for patch-based

structures and Qreg. For the Duck model (Figure 3-19) the number of IVEs, IEVs and

pointer manipulations for refining from level 3 to level 4 are 40544, 59328, and 917632


Pointer-based access in adjacency-based mesh data structure results in one

indirection to access the attribute. By contrast, in the patch-based structures and

Qreg, data access is local and can be cached because of the memory locality within

each charts. The experiment result of the performance of Catmull-Clark subdivision on

models of Table 3-1 is shown in Table 3-3. In all patching configurations, Catmull-Clark



PTQ 0 0

Figure 3-18: PQQ and PTQ refinements can be decomposed into sequences of Euler


Table 3-3: Experiment results of Qreg in various configurations of atlas patching. Time
is measured in second per Catmull-Clark subdivision. The halfedge data structure used is
the CGAL Polyhedron.

Depth Halfedge DS Facet-patch Vertex-patch Cluster-patch Time Reduced
1 0.0002 0.0002 n/a 0.0002 0%
2 0.0005 0.0004 0.0005 0.0004 20%
3 0.0021 0.0014 0.0016 0.0014 33%
4 0.0091 0.0051 0.0053 0.0051 44%
5 0.0435 0.0200 0.0205 0.0199 54%
1 0.0193 0.0168 n/a 0.0143 26%
2 0.0855 0.0565 0.0600 0.0477 44%
3 0.3573 0.1748 0.1905 0.1625 55%
4 1.4107 0.6380 0.6500 0.6181 56%
5 5.6965 2.4766 2.4692 2.4292 57%

subdivision based on Qreg easily outperforms the halfedge data structure counterpart.

CGAL Polyhedron, based on the concept of the facet-pair halfedges, is the choice of our

halfedge implementation for its flexible design and the efficient implementation. Details

of subdivision implementation of CGAL Polyhedron can be found in Appendix B. The

Qreg implementation reduces more than 50% of the execution time after three times

Catmull-Clark subdivision. The experiment is performed on an Intel Pentium4 2.4GHz

machine with 1GB RAM.

Figure 3-19: (A) Clustered user-created polyhedron. (B) 4-3 subdivision using the Qreg
representation. (C) Different stencils are applied to represent PQQ and PTQ refinement
structures. (D) Note that the bottom of each foot (shown as a red pentagon) forms one
cluster and need not be split into four to support patch-based subdivision.


The mesh mutation of polyhedral meshes is a core operation of graphics modeling

and of simulation for animation. Mesh mutations are defined as mesh transformations

combining algorithmic refinement and local adjustment. Prime examples are the

skin fairing of animation characters using generalized subdivision surfaces, feature

enhancement using displacement mapping, or computing functions on meshes (e.g. the

game of life). A framework Mesh in Programmable Hardware, short MiPGH, is proposed

in this chapter based on the concept of the quasi-regularity embedded in mutated meshes.

MiPGH is designed to improve efficiency, flexibility and display quality resulting from

these mesh operations by moving work to the GPU level.

An important consideration when designing MiPGH is that future GPUs will

continue to differ from general purpose CPUs by their specialized SIMD architecture.

So, even if arbitrary node insertion into a mesh and pointer-based graph traversal can be

implemented in future GPUs, such structures and operations do not naturally map to a

SIMD architecture where load balancing is paramount.

4.1 Goals and Properties

MiPGH is conceived to work for a general mesh model. To leverage the SIMD

architecture to the full extend and cover the mesh mutations of practical interest

i1 ithiuit adjacency pointer support, the structures proposed in this chapter restrict

mesh refinement and node visit to

RI: input meshes consisting of only quadrilaterals (quads) and triangles;

R2: primal refinement that splits every facet into four, i.e. PQQ and PTQ;

R3: mesh access for attribute adjustments only cover the direct neighborhood, i.e. the

1-ring neighbors, of the node (Figure 2-4).

Figure 4-1: A complex operation can be broken into a sequence of simpler operations
(here averaging).

Figure 4-2: Two ways to split an n-gon into quads or triangles.

The last restriction, R3, is less severe than it appears at first sight: many complex

adjustments, subdivision operations in particular, factor into a sequence of simpler

operations (Figure 4-1); and multipass adjustment without refinement is covered by

the MiPGH framework. Also, the first restriction, RI, is a common in mesh design: a

single refinement step can break n-gons into triangles or quads (Figure 4-2). As better

constructs become available at the GPU-level, one or more of these restrictions can

be dropped while retaining the MiPGH framework. For example, by replacing the

underlying mesh structure with the Qreg, restrictions RI and R2 can be easily lifted.

Though retaining the restrictions simplifies the design and implementation of MiPGH at

current stage.

Under these conditions, MiPGH has the following properties.

* Multi-parallel computation: by minimizing dependencies, parallelism for node

operations is fully exploited.

* Generic attribute definition allows for user-customizable attributes.

* User-programmable adjustment rules for mesh attributes.

* User-transparent node visit: the mesh processor, not the user, visits all nodes of the


Figure 4-3: Traditional graphics state machines.

Figure 4-4: The graphics pipeline with programmable stages: vertex shader/processor
and fragment shader/processor (shaded round blocks).

* Light-weight attribute indexing: the mesh shader has a simplified view of the local

submesh supported by simple attribute addressing in the mesh processor.

* Support for Level-of-detail.

* Unique attribute storage: attribute addressing via indices (plus a base) avoids

inconsistent floating point representations that could cause cracks in the tessellation.

By providing a framework for all primary, binary, non-stationary (and therefore

also for stationary), anisotropic (and therefore also isotropic) ht ]ed. 1-disk subdivision

schemes on quad and triangle meshes, MiPGH covers only a subset of all theoretically

possible refinement and smoothing strategies; but, arguably, it covers all subdivision

schemes one encounters in current modeling practice: Catmull-Clark and Loop

subdivision, (bi)linear subdivision, 4-8 subdivision [47], 'butterfly' interpolatory

subdivision [48] and even subdivision schemes that mix quads and triangles [35, 34].

Variants of the above, i.e. alternative stencils are easily realized as user-programmable

mesh shader code.

4.2 Programmable Graphics Hardware

Programmable graphics hardware (PGH) is a way of exposing the SIMD processing

capabilities of GPUs to an application program[49]. The programmable units of PGH

are structured as shaderr, processor] pairs. A shader is piece of the graphics function

working on per-vertex or per-pixel basis and the corresponding processor is the hardware

interface of the programmable stages in the state machine. The processors are usually

implemented as SIMD architectures. and the shaders are concurrently executed on the

corresponding processors. Traditional graphics state machines is diagrammed in Figure

4-3 and programmable graphics hardware is in the Figure 4-4 where the programmable

units are indicated as shaded round blocks.

These programmable units (i.e. shaderr, processor] pairs) are connected by the data

flows in the pipeline. Vertex shaders receive the vertex stream and output the processed

vertex stream. Vertex shaders are responsible to the vertex mathematics of the T&L

unit (transformation & lighting unit) in the graphics state machines. The programmable

functionality of the vertex shader include vertex transformation and lighting, and special

effects such as morphing and volumetric lighting. No topological information (i.e. the

connectivity access) is provided in a vertex shader. Fragment shaders, also known as pixel

shaders, receive the pixel stream and output the processed pixel stream. Fragment shaders

are responsible to covert the texture data, combining the color and lighting information,

into a color of the pixel. Special effects such as bump mapping and environment mapping

can be implemented as the fragment shaders. A lot of emerging applications on the

programmable shaders are proposed recently. For example, ray tracing [50], collision

detection [51] and even the numeric computations [52, 53].

4.3 Mesh Mutation Framework

In this section, an extension of the current PGH architecture is proposed. This

extended PGH includes a programmable framework for mesh mutations which is

designed for primal, binary-refined quadrilateral/triangle meshes. The framework is made

Vertex Primitive
tlp A

Figure 4-5: Proposed: Mesh mutation and the graphics pipeline with a mesh processor
(see Figure 4-6). Note that the notion of processor is conceptual, indicating a user-
transparent unit. It can be realized in microcode rather than dedicated hardware.

ement Node Visit Adjustment D-facet Visit Primitive Compiler
Refinement Nd V ] J
Mesh Shader
--------- ------------------ __
Attribute Addressing Attribute Parser

Mesh Rendering Attrs Algorithmic Attrs
Initialization D-facet D-edge D-vertex Point Normal
Connectivitity Attributes

Figure 4-6: Mesh processor and data access. Data arrive from the system bus and depart
to the rendering pipeline.

concrete by the concept of the quasi-regularity and visitation patterns that fit the SIMD

paradigm of GPUs.

4.3.1 Mesh Mutation in the Graphics Pipeline

Figures 4-5 and 4-6 summarize the architecture of the proposed framework -

MiPGH. The mesh processor initializes the connectivity (see Initialization below) and

the attributes from the geometry and topology stream. A single step of mesh mutation

includes three stages: refinement, node visit and adjustment. The refinement can be

bypassed; in that case, the mesh processor only allocates attribute memory and swaps

(A) (B)
Figure 4-7: (A) The D-atlas represents the connectivity of the input mesh. Arrows indi-
cate access directions. For example, a D-vertex can access the corners of the surrounding
charts. After initialization, the D-atlas of MiPGH does not change. (B) The nodes of a
D-LoD after two refinement steps. Replicated boundary nodes point to the same attribute
container for unique storage of attributes (including position).

the attribute handles) after target adjustment. The mesh processor visits each node

of the mesh and collects the corresponding 1-disk submesh data. We say visit rather

than traversal since this operation may be executed in parallel. Adjustment is a user-

programmable unit. The user program has access to exactly a 1-disk (Figure 5-1) through

the local indices which enumerate the submesh. The 1-disk view hides the complexity of

the traversal and access of the global mesh. After several iterations of the mesh mutation,

the mesh processor compiles connectivity and attributes of the mesh to form primitives

for the lower pipeline. We use compile rather than assemble, since the mesh processor has

to interpret the attribute type and the rendering type.

4.3.2 Connectivity and the Domain Atlas

The polyhedral input mesh is a discrete analogue of an oriented 2-manifold, possibly

with global boundary. In this analogy, the charts that define the manifold consist of one

(or more, see Initialization below) quad or triangle. Only edges of adjacent charts overlap,

i.e. the integer indices pointing to their attributes are replicated in both charts that share

the edge. Corner indices are replicated in n charts (Figure 4-7 A). All charts together

form the domain atlas, short D-atlas.

At each level of refinement, the chart is made concrete as a D-facet. A D-facet is

an array of integer indices that allow lookup of the attributes associated with the node

(Figure 4-8). At refinement level a( (ay = 0 for a single facet of the input mesh), a D-

facet consists of 2 x 2' micro-facets, i.e. small quad or triangle facets. Each D-facet

shares its boundary indices with an adjacent D-facet. The D-facet has no connectivity

information to access other D-facets, D-edges or D-vertices(see Figure 4-15). The

collection of D-facets of a given chart for all refinement levels, form the D-LoD of the

chart. The D-LoD supports level-of-detail (at a cost of just 4/3 times the storage of the

largest D-facet.) Chart edges are represented in the D-atlas as D-edges. A D-edge consists

of two halfedges. Each halfedge can access the adjacent D-facet or is null at a global

boundary (Figure 4-9). Nodes along a D-edge are visited via the D-facet index plus the

corner index and then stepping to the next node by equal increment. A (boundary or

shared) chart corner is represented as a D-vertex. A D-vertex of valence n can access

the corners of the n abutting D-facets (Figure 4-10). The D-atlas remains fixed during

mesh mutation. Only the D-LoD grows with each refinement and the attribute lists grow


Initialization, localized update and adaptive refinement. The D-atlas is initialized by

the geometry and connectivity information of a vertex array describing the polyhedron.

Analogous to an evaluator, the mesh is mutated according to a user-defined sequence of

adjustments and refinements. Parts or all of intermediate meshes can be returned to the

CPU level with a system call. Such a refined mesh and refined mesh pieces in general can

be (re)initialized by packing 2' x 2' facets into a single D-facet at subdivision level aC.

This initialization is correctly treated as part of the adaptive refinement implementation

described below and can support numerous applications, like cut-and-paste [54, 55].

One strategy for generating adaptive meshes is to subsample a uniformly refined

mesh. However, in large models unnecessary refinement causes substantial computation

and storage overhead. In MiPGH, D-LoDs are labeled with the number of refinements

D-Facet (1 0 (1,0) (1)


(A) (B) (C)

Figure 4-8: A D-facet. Each D-facet is a row major quadrilateral or triangular array
containing, for each node, the integer index of the attribute storage location. (A) With
N := 2' + 1, L := Sq = N x N for a quad and L := = (1) for a triangle (as an op-
timization, we can pack two adjacent triangles into a quad); (B,C) Black circles depict
nodes that correspond to D-vertices, gray circles correspond to nodes on D-edges; co... c3
are the corner indices arranged i n counterclockwise (CCW) order.

D-Edge ...
facetl dx facet2 ldx
corner idx comer idx hel hel
hel he2 --
Facetl Facetl

(A) (B) (C)

Figure 4-9: A D-edge. (A) Each D-edge consists of a pair of halfedges. A halfedge is
defined by the index of the incident D-facet and the index of the pointing corner. (B) The
first halfedge is designated as the major halfedge and defines the orientation of the edge.
(circle shading as in Figure 4-8) (C) On a global boundary, the second halfedge is null.

Facetl "
D-vertex Facet n F ce1 acetl

facet 1

n 1 Facet2 Facetl
Facetn- 1
(A) (B) (C) (D)

Figure 4-10: A D-vertex. (A) A D-vertex of valence n is stored as the integer n followed
by n index pairs each representing, in CW order, the index and the corner index of D-
facets. (B-D) A D-vertex in the interior, on the global boundary and at a global corner of
the input mesh.


Connectivity Attributes
D-LoD D-edges D-vertices Positions Normals TexCoords
Sxy x 0y
0 0 0 00 *

1 1 1 2 1
2 2 2 2

nf nle n lf

Figure 4-11: MiPGH has three connectivity lists (D-facet, D-edge and D-vertex) and
several attribute lists. Here three possible (rendering) attributes are shown more or
fewer can be defined in the graphics routine and bound to the shader. The input mesh has
ny vertices, ne edges and nf facets.

, either explicitly at the outset by an application program or algorithm evaluated inside

the user-programmable mesh shader. The mesh processor will not visit the nodes or

allocate memory for the attributes of a D-facet whose D-LoD-label is less than the current

refinement counter. Edges separating D-LoDs that have different labels are correctly

updated by maintaining a single auxiliary layer of nodes beyond the boundary. Interactive

deformation or animation of mesh D-vertices is supported by resetting the tags of the

affected D-LoDs. Correct rendering without cracks of the adaptively refined D-LoDs is

guaranteed by a primitive compilation that has full knowledge of the relative refinement

and the rendering state.

4.4 Generic Attributes and Access

MiPGH consists of three connectivity lists, the D-LoD list, the D-edge list and the

D-vertex list and several attribute lists (Figure B-5). Since we assume read and write

capability to random memory locations, the attributes need not be fixed a priori but can

be generic. That is, the graphics program can define any attribute that uses one of the

addressing modes described below, by binding it to an attribute type and an addressing

mode. The addressing mode determines the memory allocation for the attribute list. We

distinguish two attribute addressing modes: indexed and hashed. Indexed means that

the attribute addresses are computed from a base address plus an offset index listed in

the D-facet. Hashed means, it is computed based on the regular correspondence of the

attributes to those indices. Hashed addressing comes in many flavors.

For example, all attributes associated one-to-one with nodes (node-morphic) are

indexed (Figure 4-12). Along D-facet edges, the unique index guarantees unique storage

of attributes. Since node-morphic data is stored in the order: corners, edges, interior

nodes, we can compute the parent D-facet, D-edge and D-vertex from any point index of

the refined mesh.

By contrast, there may be two different texture coordinates associated with a single

node on an D-edge, one for each D-facet. Since a D-facet has as many nodes as texture

coordinates and they are arranged in the same order (Figure 4-13), the hashing function

for such chart-morphic data is simply the texture coordinate base plus the node offset

within the D-facet.

Some mesh algorithms need to tag the n edges emanating from a node. Rather than

storing such data with the node, and provision for an arbitrary number n of neighbors,

we associate the attributes with the micro-facet, since a micro-facet always has either

3 or 4 corners (Figure 4-14). By associating each micro-facet corner with two values,

one for the arriving halfedge and one for the departing halfedge (in CCW order), each

micro-facet has either eight or six values associated and each edge has four associated

values. Implementing Pixar's semi-smooth crease rules [56] then corresponds to the

special case where two pairs of the four edge values are equal. Figure 4-15 summarizes

the attributes addressing and the adjacency access patterns.

nt xt

Figure 4-12: A node-morphic attribute list. Here N
=e N 2, the number of nodes on a D-edge, s'q
eral D-facet and t = ( e) inside a triangle D-facet.

- flq X Sq

= 2 + 1 for y7 refinements,
(e)2 the nodes inside a quadrilat-

|nt st

Figure 4-13: A chart-morphic attribute list. Here Sq
quadrilateral D-facet and st = (N2 ) of a triangle D-facet.

N2, the number of nodes of a

nq Sqf sI nt x stf

Sqf Stf

Figure 4-14: A micro-facet-morphic attribute list. Here Sqf = Stf = (N 1)2 is the num-
ber of the micro-facets of the D-facet.

4.4.1 Memory Access

Each type of attribute data is allocated sequentially in a contiguous array by giving

the base address and the size. Threading eliminates the latency caused by the indirect

(base+offset) memory access. Also, the attributes of each D-facet are clustered as

illustrated in Figures 4-12, 4-13 and 4-14. From the users point of view, the attributes

are accessed randomly via a local index into the 1-disk. This transparency can be

achieved since, in a mesh shader, the base address is available as an attribute handle and

the offset is an index maintained by the mesh processor.

"v "e Ls "q X,q

D-vertex D-edge


Indexed Hashed
Attributes Attributes

Figure 4-15: Data access by shader and processor in MiPGH. Dashed arrows (from
D-vertex and D-edge to D-facet) represent access encoded in the D-atlas, the solid black
arrow represents index-based addressing of attributes and empty arrows indicate hash-
based addressing.

4.4.2 Attributes Compilation and Rendering

Attributes are either algorithmic or bound to a rendering type such as position,

normal or node color. Algorithmic attributes support computations in the mesh shader

or can be channeled to the vertex shader for computations. For rendering attributes,

based on the type, the attribute parser and primitive compiler (Figure 4-6) encodes the

rendering state for the stream of the primitives, for example the color of each facet.

Vertex shaders or pixel shaders can also serve as rendering types. Partial meshes can

thereby be associated with different shaders, say to apply a different shader to the N

region in Figure 5-7 than to other regions.


State-of-the-art programmable graphics hardware (PGH) have two programmable

units: the vertex processor for the geometry transformation and projection; and the

fragment processor for pixel shading and graphics effects. To fully use the power of PGH,

graphics programmers specialize the graphics hardware by loading the shader objects

into the programmable processors. The shader object, a compiled program for a specific

graphics purpose, replaces the fixed functionalities of the graphics hardware. In the early

generation, shaders are written in the highly hardware-dependent assembly language.

Recently, graphics hardware companies are striding for shading language which is more

human friendly, less hardware dependent, yet still efficient on maximizing the power

of the graphics hardware. Prominent examples are the Cg [57] from nVidia, the HLSL

[58] of DirectX from Microsoft and the gislang [59, 60] for OpenGL. C language [61] is

chosen to be the backbone of these high level shading languages because of following


* Source code is hardware independent.

* Compiler-generated shaders are faster.

* Coding, debugging and maintaining the shader become easier.

* Backward compatibility of legacy graphics programs.

A shading language Mesh 1 h ing Language (mslang) based on OpenGL shading

language is proposed in this chapter.

5.1 OpenGL Shading Language

The OpenGL Shading Language[59, 60], or gislang, is based on ANSI C language

[61]. Many features of C language are retained unless conflict with performance and

ease of hardware implementation. Some C++ features are also included to meet the

requirements of modern programming styles, such as functional overloading and nearest

variables declaration. Built-in types of vector and matrix and related operations of

linear algebra are added into the language for the typical computations in 3D graphics.

The OpenGL Shading Language is designed specifically for use within the OpenGL

environment. It is intended to provide programmable alternatives to certain stages of the

fixed rendering pipeline of OpenGL. Two major programmable units are introduced to

support the alternatives: vertex processor and fragment processor. The programs written

in the shading language are called shaders and are executed within the respective shader


The vertex shader, cooperating with vertex processor, processes incoming vertex

values and their associated data. It is intended to perform traditional graphics operations

such as vertex transformation, normal transformation and normalization, texture

coordinate generation, and texture coordinate transformation. The vertex processor

processes one vertex at a time. Its design is focused on the functionality needed to

transform and light a single vertex. In other word, neither is connectivity information

provided nor is topology functionality supported.

The fragment shader, cooperating with fragment processor, processes pixel fragment

and their associated data. It is intended to perform traditional graphics operations such as

texture application, fog and color processing. Fragment shaders can be used to specify a

completely general sequence of operations to be applied to each pixel fragment.

The OpenGL Shading Language is actually the combination of two closely related

languages for vertex shader and fragment shader. The precise definition of these

programmable units is left to separate specifications. The communication among the

shaders and the OpenGL state machine is performed via the read/write of the language

predefined registers and the OpenGL state functions. The predefined registers are

represented as built-in variables of the language. [62] gives the details of the grammar

[5] 0- [1] <- [8] [6] -- [1] [1]

[5] [1] [8] <4> [5] [2] [6]

[2] -[2]- [0] -[4]- [4] [2] [0] <3 1 [0] 4>

[6] [3] [7] 1> <2> [4]
<1> I <2 1 [3] 2 3 [5]
[6] [3]- [7] [7] [3]
[4] [1] -<- [5] [4] ---- [1]
0 1 0 1 [3] [2] <0> <1> [3]

[2] [0] -- [3] [2] -- [0]

[2] [3]

[0] -- [1]

Figure 5-1: A mesh shader's view of the enumeration of (regular) 1-disks: [ ]s indicate
the the nodes and <>s the facets. Black indicates the input 1-disk and red the output. If
the refinement step is bypassed, only the vertex-vertex 1-disk is passed to the shader.

format and the language specification of the OpenGL Shading Language. The diagram of

the programmable units and the OpenGL state machine is described in Section 4.2.

5.2 Mesh Shading Language

While a vertex shader operates on an isolated vertex, a mesh shader operates a

1-disk submesh via built-in variables and built-in functions. Some particular built-in

variables describe the connectivity of the 1-disk submesh in a predefined arrangement.

The mesh shader receives two groups of attribute handles and mesh variables from the

mesh processor: a 1-disk source submesh and a 1-disk target submesh. The submesh

nodes are explicitly indexed as shown in Figure 5-1. The submesh of a node with n

neighbors has the same index pattern, listing, in CCW order, first the direct neighbors and

then the diagonal neighbors. The rendering attributes are bound to rendering states during

initialization of the shader object. Table 5-1 shows the built-in variables of the states and

Standard User-defined Provided directly by application
OpenGL attributes Provided indirectly by application
Produced by the mesh processor

Special uniforms
IVertexIndices, IFacetIndicators, ILevel,
OVertexIndices, OFacetIndicators, OLevel,
MeshType, Valence
Texture Memory
Mesh Processo User-defined uniforms
Attribute Memory
-- Built-in uniforms
gl ModelViewMatrix, gl FrontMaterial,
gl LightSource[0 n], etc

Standard Special User-defined
OpenGL Variables varying
varying Position
gl FrontColor
gl BackColor

Figure 5-2: The mesh shader as an extension of the vertex shader in the OpenGL shader

transmitted data for the mesh processor. Possible user-defined variables are also shown in

the table.

The mesh shader addresses the generic attributes with a set of built-in functions.

These functions are classified by their addressing mode, indexed or hashed as explained

in Section 4.4. For indexed attributes, the prototype addressing functions are

vec readAttribute (attrlD attr-handle int idx);
vec writeAttribute (attrlD attr-handle int idx vec attr);

The full function names are to indicate the output size. For example, the function

for reading position=(x,y,z,w) is vec4 readAttribute4 (). For hashed attributes, the

hashing parameters and the hash mode, for example chart-morphic, is passed to the mesh

processor. The prototype hash functions are as follows.

vec readAttribute (attr D attr-handle int idx ivec4 indicator int mode);
vec writeAttribute (attr D attr-handle int idx ivec4 indicator int mode, vec attr);

Table 5-1: User-defined and processor-built-in variables of MiPGH.

Variable Comment
Attributes Handles (user-defined)
uniform attrlD [I/O]RTypeHandle [I/O]: source or target mesh
RType can be Position, Normal ..etc
uniform attrlD [I/O]AttributeHandle[0/1/2/..] algorithmic attributes [0/1/2/..]
Mesh Variables (built-in)
uniform int [I/O]VertexIndices[]
uniform ivec4 [I/O]Facetlndicators[] [idx,corner idx,4/3,D-facet idx]
uniform int [I/O]Level refinement level
uniform int MeshType of the source mesh
uniform int Valence of the target mesh
Output Vertex (built-in)
varying vec4 Position of the target center vertex
varying vec4 Normal of the target center vertex

To speed up access, array access functions are also provided. For example, the following

functions apply to indexed attributes.

void readAttribute (attrlD attr.handle, int [] indices, vec [] attrs, int size);
void writeAttribute (attrlD attr-handle, int [] indices, vec [] attrs, int size);

5.3 Examples of Mesh Shader

This section presents two examples of user-programmable mesh shaders using

MiPGH. The pseudo-code bases on the mechanism of the OpenGL shader language [59]

and the extensions of mslang. For the sake of simplicity, code about the creating and

linking of the shader object is not shown in the examples. Details about the programming

mechanism of the shader can be found at [62].

The first example illustrates Catmull-Clark subdivision with MiPGH (Figure 5-3).

The code is in its simplest form since the refinement is hard-coded in the mesh processor.

Only the geometry smoothing is performed in the mesh shader. The connectivity

operation is simplified into a 1-disk attributes collection and/or distribution. Figure 2-5

has the stencils of Catmull-Clark subdivision. The result surfaces is demonstrated in

Figure 5-7.


The second example computes the normal of Catmull-Clark limit surface, for regular

nodes, as the cross product of the tangents generated by applying the stencils of Figure

5-4 (see [63] for the general case). Then the shader displaces the mesh node in the

normal direction by an amount specified by a texture. The refinement step is bypassed

in this example. The shader of the normal displacement is shown in Figure 5-5 and

the result is shown in Figure 5-7. Note that users are given the dynamic control of the

mutated meshes on the combination of the mesh shaders in Figure 5-7.

void main(void) {

Position is the predefined variable of the position

of the central point in the 1 -disk.

if (MeshType !- MTAEOV) {

const float fvmask[4] {1/4.0, 1/4.0, 1/4.0, 1/4.0};

const float evmask[6] {6/16.0, 6/16.0, 1/16.0, 1/16.0, 1

const float vvmask[9] {36/64.0,

6/64.0, 6/64.0, 6/64.0, 6/64.0,

1/64.0, 1/64.0, 1/64.0, 1/64.0 };

16.0, 1/16.0};

vec4 mesh [9];

if (MeshType MT_FV) {// Facet-vertex

readAttribute4(IPositionHandle IVertexlndices mesh, 4);

Position = inner-product (mesh, fvmask, 4);

} else if (MeshType -- MT_EV) {// Edge-vertex

readAttribute4(IPositionHandle IVertexlndices mesh, 6);

Position = innerproduct (mesh, evmask, 6);

} else if (MeshType == MT_W) {// Vertex-vertex

readAttribute4(IPositionHandle IVertexlndices mesh, 9);

Position = inner-product (mesh, mask, 9);

} else {// extraordinary vertex-vertex

const int mash_size 1+2* MaxValence;

vec4 mesh [ mesh_size];

readAttribute4 (IPositionHandle IVertexlndices mesh, mesh-size);

float cw 4* Valence* Valence 7 Valence;

float w cw + 6* Valence + Valence;;

float mask[ mesh-size ];

mask[0] cw/w;

for (int i = 1; i <= max.valence ; ++i) {

mask[i] 6 /w;

mask[ i+max-valence ] 1/w;

Position = inner-product (mesh, mask, mesh_size);

Figure 5-3: Catmull-Clark subdivision. Only geometry adjustments is encoded in the
mesh shader. Refinement and nodes/stencils visiting is performed by the mesh processor.

1---- 0 -- 1 -1--4--

14-+ 4 0 +0

1- 0-- 1 1- 4- 1

Figure 5-4: The derivative stencils of Catmull-Clark subdivision surfaces give the tan-
gent vectors of the surface. The normals are then calculated as the cross-product of the
tangent vectors.

void main(void) {
// Normal is the predefined variable of the normal
/ of the central point in the 1 -disk.
vec4 mesh[9];
readAttribute4(IPositionHandle IVertexlndices mesh, 9);

// The derivative stencils of Catmull-Clark subdivision surfaces
const float tl.mask[9] { 0, 0, -4, 0, 4, -1, -1, 1, 1};
const float t2_mask[9] { 0, -4, 0, 4, 0, -1, 1, 1, -1};

// Calculate the tangent vectors of the node
vec3 tl = inner-product (mesh, tlmask, 9);
vec3 t2 = inner.product (mesh, t2_mask 9);
Normal = normalize (cross (tl t2));

vec2 coord = readAttribute2 (ITexCoordHandle IVertexIndicex [0],
IFacetIndicators [0] ILevel,
vec4 color = texture2D(tex-sampler coord);

/ Displace the node along the normal direction
/ according to the red intensity of the texture color.
Position = mesh[0] + color.r Normal;

Figure 5-5: Normal displacement. Normals are calculated by the cross-product of the two
tangent vectors of the Catmull-Clark surfaces. The displacements are scaled according to
the sampled values of the mapped texture.

First 3 stens

Period-3 Dulsar after n stens

Figure 5-6: Snapshots from a game of life simulation on a subdivided mesh of Catmull-
Clark subdivision. The orange nodes indicate the live cell. The game of life is an example
of a cellular automaton, which is a system where rules are applied to cells and their
neighbors in a regular mesh. The cellular automation corresponds to repeated adjustment
without refinement.

Catmull-Clark Subdivision Q Subdivision

CC subdivision with creases
Displacement Map
Q Subdivision

Displacement Map
CC Subdiviion

Displacement Map Displacement Map
Q Subdivison Q Subdivision

Figure 5-7: Different shaders (CC-subdivision, Q-subdivision, CC-subdivision with
creases, normaldisplacement) applied at different levels.


The Qreg data structure is tailor-made for manipulating (large) meshes with regular

regions. We are testing it as the backbone of a hierarchical modeling environment.

Several subdivisions are implemented showing the efficiency and the versatility.

Qreg also has an affinity to compressed storage and transmission structures and the

corner distributors support modeling certain (vertex and edge) non-manifolds. An

component that needs improvement for large input meshes is the semi-automatic

clustering algorithm. The literature offers a number of automatic heuristics but, to our

knowledge, no optimal match.

The programmable mesh framework proposed in this thesis strikes a balance

between the SIMD characteristics of the GPU and fully general mesh access and

refinement. Although our prime example is subdivision, the mesh processor is more

general than just an implementation of subdivision surfaces (see Figures 5-7 and 5-6).

The framework is anchored in the well-understood and accepted theory of manifolds and

the concepts of atlas and chart. In particular, the notion of edge and facet complement

the primary graphics programming concept of vertex. Ultimately, we envision that these

notions will be mapped onto abstract, but SIMD-aware interface definitions accepted by

the community so that refinement and node visit, too, become user-programmable.


CGAL, the Computational Geometry Algot ithi, Library, is a joint effort between

nine European institutes. The goal of CGAL is to make available to users in industry and

academia some efficient solutions to basic geometric problems developed in the area

of computational geometry. CGAL is a C++ library based on the generic programming

paradigm and is available from www. cgal. org [11].

CGAL Polyhedron data structure is based on the concept of the facet-edge pair

halfedge (Figure 1-4) [12]. It supports 2-manifolds with possible boundaries and holes.

CGAL Polyhedron provides three mechanisms of connectivity traversal: iterators,

circulators and halfedge adjacency pointers. Iterators visit the geometry or topology

items in the storage order. Circulators visit the direct neighbors in a consistent order

circulating around the central primitive. Halfedge adjacency pointers traverse the

connectivity in a programming control manner. CGAL Polyhedron provides a set of

Euler operations (including genus changing operations) to support the connectivity

manipulation. CGAL Polyhedron also provides modifier callback mechanism to support

the user-programmable manipulation. The geometry is generic in CGAL Polyhedron, and

the geometric computation is user-defined in compiler time.

The declaration of CGAL Polyhedron is shown in Figure A-1. The full template

declaration of CGAL: : Polyhedron_3 consists four template parameters. The first

two template parameters require a model of the PolyhedronTraits-3 and the

PolyhedronItems_3 as the arguments. These two parameters specify the numerical kernel

and the geometry primitives such as vertices, halfedges and facets. The third parameter is

a class template. A model of the HalfedgeDS concept, which structures the combinatorial

relations between the geometry primitives, is expected. The fourth parameter Alloc


template class Polyhedronltems3 = CGAL:: Polyhedron_items_3 ,
template class HalfedgeDS CGAL:: HalfedgeDS.default,
class Alloc CGALALLOCATOR(int)>
class Polyhedron_3;

Figure A-l1: The C++ declaration of CGAL: :Polyhedron_3

requires a standard allocator for STL container classes. Th Details of the specifications of

the CGAL Polyhedron is available at www.cgal .org/Manual/doc_html/index. html


Built on the concept of CGAL Polyhedron, Combinatorial Subdivision Library (also

called CSL) is designed and implemented to provide the programmability of subdivision

algorithms. CSL is composed of two sets: refinement functions and geometry rules. A

subdivision in CSL is instantiated by a proper combination of a refinement function and a

set of geometry rules. Geometry rules are user-programmable.

CSL is based on the ideas of the policy-based design [64]. The policy-based design

assembles a class (called host) with complex behavior out of many small and generic

behaviors (called policies). Each policy defines an interface for a specific behavior and

is customizable by the user. Policies are usually implemented as functions or functors.

One gentle example is the for_each 1 algorithm in the Standard Template Library (STL)

[65, 66].

UnaryFunction for_each(Inputlterator first Inputlterator last UnaryFunction f);

The for_each is the algorithm host and the UnaryFunction f is the generic behavior

customizable by the user. To use it, one has to provide a policy function that meets the

interface requirement of an unary function.

A subdivision algorithm has three key behaviors: refinement, smoothing, and stencil

correspondence. The refinement is acted as a for_each algorithm on the source and

the refined polyhedron while applying the smoothing behaviors. CSL implements the

refinements as the host functions with the smoothing rules as the policies. Some major

1 http://www.sgi.com/tech/stl/for_each.html

refinements are shown in Figure 2-2. The refinement configurations also define the

stencil correspondences; stencils of PQQ and DQQ schemes are shown in Figure B-1.

These stencil correspondences specified the functional interface between the refinement

hosts and the geometry smoothing policies.

(A) (B) (C) (D)
Figure B-l1: The stencil (top blue) and its vertex (bottom red) in Catmull-Clark subdi-
vision (A)(B)(C) and Doo-Sabin subdivision (D). Catmull-Clark subdivision has three
stencils: facet-stencil (A), edge-stencil (B) and vertex-stencil (C). Doo-Sabin subdivision
has only corner-stencil (D). The stencil weights are not shown.

CSL is designed to support both the generic types (i.e. the polyhedron) and the

generic behaviors (i.e. the subdivisions). The generic type is required to be a model of

the CGAL: : Polyhedron_3 concept. The CGAL: : Polyhedron_3 concept specifies interface

such as circulators over primitives, adjacency pointers of halfedges, and the Point type of

vertices. The Point type and its computation can be the CGAL: :Point3 or a user-defined

point. For a user-defined Point type, user-programmed policies are expected to perform

the geometry rules.

B.1 Primal Quadrilateral Quadralization

Every subdivision algorithm in CSL is constructed as a refinement function

parameterized with a set of the geometry smoothing rules. The geometry rules are

represented as the class functions of the policy class template. For example, Catmull-

Clark subdivision in CSL is instantiated as the PQQ refinement parameterized with the

geometry policy class of Catmull-Clark subdivision.

Figure B-2: Catmull-Clark surfaces of a box model.

void CatmullClark-subdivision (Polyhedron& p, int step = 1) {
quad_quadralize_polyhedron(p, CatmullClark_rule(), step);
The quad_quadralize_polyhedron is the refinement host that refines the control
polyhedron using PQQ scheme and the CatmullClark_rule is the policy class of
geometry rules.
Geometry policies are represented as the class functions of a policy class. Each
policy function receives a primitive handle of a 1-ring submesh and a reference of the
smoothing point. A policy class for the PQQ scheme is shown below.
class quadralize-rule {
public :
void face-point-rule (Facet-handle Point&) {};
void edge-pointrule (Halfedge.handle Point&) {};
void vertex.pointrule (Vertex-handle, Point&) {};
A PQQ scheme contains three stencils (Figure B-1 A-C) and each defines a policy
function. Every policy class are required to support complete policy functions of its
targeting refinement. To assure the interface consistence, CSL provides a policy class



for each refinement scheme. Every user-programmed policy class should be built by


// Specialized a Catmull-Clark rule by inheriting the quadralize-rule.
class CatmullClark-rule : public quadralize rule <_Poly > {...}

The points of the refined polyhedron is generated by calling the corresponding

geometry policy. Inside each policy, applying the stencil is simplified to the traversal

and access of a 1-ring. A circulator and/or halfedge pointers are used in CSL. The

face-pointrule for Catmull-Clark subdivision demonstrates the stenciling by the facet


void face point-rule (Facet-handle facet Point& pt) {
// Facet circulator is used to traverse the 1 -ring of a facet.
Halfedge around facet-circulator heir = facet->facet_begin();
int n 0;
Kernel ::FT p[] {0,0,0};
// Apply the stencil while circulating around the facet.
do {
Point t = hcir->vertex()->point();
p[0] +- t[0], p[1] +- t[1], p[2] +- t[2];
} while (++hcir facet->facet-begin ());
Assign the smoothing point.
pt Point(p[0]/n, p[l]/n, p[2]/n);

The facet circulator provides a convenient way to traverse and collect the points. The

geometry computation use the conventional interface [i] of Point. For Point not

equipped with the index access [i], a user-implemented policy class need to be provided.

The CGAL Point_3/Vector_3 computation, which is shown below, can be used if the

Point is the equivalent type of Point-3.

void face_point_rule ( Facet_handle facet, Point& pt) {
Halfedge_around_facet.circulator heir = facet->facet_begin();
// Use CGAL::ORIGIN to transform Point into Vector.
Vector vec hcir->vertex()->point() -CGAL::ORIGIN;
do {

// Vector is a computational class
vec = vec + hcir->vertex()->point();
} while (++hcir !- facet->facet_begin ());
SUse CGAL::ORIGIN to transform Vector back to Point.
pt CGAL::ORIGIN + vec /circulatorsize(hcir);

The edge_point_rule () of Catmull-Clark subdivision uses the halfedge pointers

(i.e. next (), prey (), and opposite ()) to traverse and access the 1-ring.

void edge_point_rule (Halfedge.handle edge, Point& pt) {
Point pl = edge->vertex()->point();
Point p2 = edge->opposite()->vertex()->point();
Point fl f2;
face_point_rule (edge->facet () fl);
face_point_rule (edge->opposite()->facet (), f2);
pt Point((pl [0]+p2[0]+fl [0]+f2 [0])/4,
(pl [l]+p2[1]+fl [1]+f2 [1])/4,
(pl[2]+p2[2]+fl[2]+f2[2])/4 );

The edge->opposite () is used to locate the opposite point and the opposite facet. Instead

of using the facet circulator for each facet, the face_point_rule is called to calculate the

facet centroids. The smoothing point is then assigned as the centroid of the two opposite

points and the two facet centroids.

The vertex_point_rule for Catmull-Clark subdivision is more complicated than the

other two policy functions. Unlike the facet and edge rules, vertex rule is dynamic with

different vertex valence. Nonetheless, the vertex stenciling is still a 1-ring computation.

void vertex_point_rule (Vertex.handle vertex Point& pt) {
// Only a vertex circulator is needed to collect the submesh.
Halfedge around.vertex.circulator vcir = vertex->vertex-begin ();
// The vertex valence is used to calculate the stencil weights.
int n = circulator.size (vcir);

float Q[] {0.0, 0.0, 0.0} R[] {0.0, 0.0, 0.0};
Point& S vertex->point (); The center vertex

Point q;
for (int i -0; i < n; i++, ++vcir) {
Point& p2 = vcir->opposite()->vertex()->point();

R[0] +- (S[0]+p2[0])/2; R[1] +- (S[1]+p2[l])/2; R[2]
face_point_rule (vcir->facet(), q);
Q[0] +- q[0]; Q[1] +- q[1]; Q[2] +- q[2];
R[0] / n; R[1] / n; R[2] / n;
Q[0] / n; Q[1] / n; Q[2] / n;

// Assign the smoothing point.
pt Point((Q[0] + 2*R[0] + S[0]*(n-3))/n,
(Q[1] + 2*R[1] + S[1]*(n-3))/n,
(Q[21 + 2*R[21 + S[21*(n-3))/n );


Connectivity refinement in CSL is design as a host function. A refinement host

refines the input control polyhedron, maintains the stencil correspondence and assign

the smoothed points. The quad_quadralize_polyhedron is the refinement host for a PQQ

scheme. It redirects the refinement by repeating the quad_quadralize_lstep () .

// RULE is a template parameter specifying the geometry stencils.