Vous êtes sur la page 1sur 13

Technical Report TUBS-CG-2004-08

Generative 3D Models: A Key to More Information


within Less Bandwidth at Higher Quality

Rene Berndt, Dieter W. Fellner, and Sven Havemann


{r.berndt, d.fellner, s.havemann, }@tu-bs.de

Institute of Computer Graphics


University of Technology
Mühlenpfordtstr. 23, D-38106 Braunschweig
http://graphics.tu-bs.de


c Computer Graphics, TU Braunschweig, 2004
Generative 3D Models:
A Key to More Information within Less Bandwidth at Higher Quality
Rene Berndt∗ Dieter W. Fellner† Sven Havemann‡
Computer Graphics, TU Braunschweig, Germany

Abstract and (new) application domains (e.g., digital mock-up in engineer-


ing) benefiting from a more powerful DL technology.
This paper proposes a novel, yet extremely compact model repre- Just focusing on the aspect of 3D documents it becomes clear
sentation method. Its main feature is that 3D shapes are represented that a purely triangle/polygon-based representation scheme will
in terms of functions instead of geometric primitives. Given a set of neither be suffiently powerful (in terms of expressiveness and ac-
– typically only a few – specific parameters, the evaluation of such curacy) to support the envisioned development nor will it scale to
a function results in a model that is one instance of a general shape. the demand in model complexity.
Particularly important for the web context with client systems of Just looking at the aspect of 3D documents we believe that one
widely varying rendering performance is the support of a semantic of the main reasons for a limited growth of 3D archives is due to
level-of-detail superior to any low-level polygon reduction scheme. the inadequate representation schemes available today: almost all
The shape description language has the power of a full program- of the more complex 3D information is based on polygon/triangle
ming language, but it has an extremely simple syntax. It can be re- meshes. Of course, triangles do exhibit nice and easy to handle fea-
garded as some form of a ’mesh creation/manipulation language’. tures and they are well supported by graphics hardware. However,
It is designed to facilitate the composition of more complex model- triangle/polygon-based representation schemes are not suffiently
ing operations out of simpler ones. Thus, it allows to create high- powerful in terms of expressiveness and accuracy: a triangle mesh
level operators which evaluate to arbitrarily complex, parameter- is only a discrete approximation of the true surface and, for curved
ized shapes. The underlying shape representation is a boundary surfaces, it needs an infinite amount of infinitely small triangles to
representation mesh in combination with Catmull/Clark subdivi- accurately describe a model. Just assume that the used representa-
sion surfaces. tion scheme does not know about spheres. Storing/transmitting a
sphere from the sender to the receiver will indeed need an infinite
CR Categories: I.3.2 [Computer Graphics]: Graphics Systems— amount of triangles as the desired accuracy at the receiver’s side is
Distributed/network graphics; I.3.5 [Computer Graphics]: Com- generally unknown be the creator of the object. But the problem of
putational Geometry and Object Modeling—Curve, surface, solid, limited expressiveness is not the only one. We have identified the
and object representations; I.3.6 [Computer Graphics]: Methodol- following problem areas that negatively affect the cost-efficiency of
ogy and Techniques—Graphics data structures and data types; Web3D. If these issues are not addressed, Web3D will continue to
Keywords: generative modeling, subdivision surfaces, boundary fight an uphill battle.
representation meshes, interactive modeling
1.1 Model File Sizes
1 Introduction Obviously the size of a model depends on the representation
method, such as pointclouds, triangles, NURBS patches, implicit
According to a study by Lyman et al [Lyman et al. 2000] the world functions, and many more. With triangles as the lowest common
produces between 1 and 2 exabytes (i.e., 1018 bytes or a billion gi- denominator to represent surfaces, mesh compression, model sim-
gabytes) of unique information per year. From that vast amount of plification, and sophisticated multi-resolution shape representations
data printed documents of all kinds only comprise 0.003%. The have become the methods of choice to deal with complexity. Pro-
major share being taken by images, animations, sound, 3D models gressive Meshes (PMs) are a great tool do deliver a continuous level
and other numeric data. Of course, a large and increasing propor- of detail for interactive applications.
tion of the produced material is created, stored and exchanged in The problem remaining is that the complexity of a compressed or
digital form – currently ranging at about 90% of the total. Yet, little progressive mesh, although (sometimes drastically) smaller in ab-
of this information is accessible through internet enabled archives solute size than the original, is still in the order of the input mesh.
or Digital Library collections. The highest possible display resolution on the other hand is limited
Slowly but steadily, information systems do experience change by the input resolution. Secondly, through the post-processing, the
in the interpretation of the term ’document’: Rather than seeing direct relationship between the mesh and the modeling history is
a document in a classical context of being a ’paper’ predominantly no longer available. The third problem is that simplification breaks
compiled of text with a few figures interspersed a more general view symmetry: automatic mesh simplification is based on an error met-
takes place which considers a ’document’ as an entity consisting of ric which is insensitive to the intended structure of a model, so that
any media type appropriate to store or exchange information in a even completely regular shapes become distorted in irregular ways
given context. Only this shift in the document paradigm will open instead of “simply” removing high-frequency detail.
new application fields in areas from simple information archives to While automatic multi-resolution techniques are great for
Digital Libraries (DL) for the mutual benefit of DL’s and applica- scanned datasets, it should be possible to do better with syntheti-
tion domains: DL’s offering an unprecedented level of functionality cally created objects. Instead of removing the nice rounding of an
object’s edge by mesh simplification to decrease the LOD to main-
∗ e-mail:r.berndt@tu-bs.de tain interactivity, the runtime engine could simply undo the round-
† e-mail:d.fellner@tu-bs.de ing operation, or even better, only perform it on demand (i.e., only
‡ e-mail:s.havemann@tu-bs.de when detail is important).
1.2 Digital Libraries of 3D Objects GML adds, and actually encourages, the possibility to create para-
meterized objects. It can represent advanced concepts like a mod-
The aforementioned problems become even more drastic if a great eling history, separation of data and operations, a semantic level-
number of objects needs to be maintained and updated in a con- of-detail, event-driven animations, or data-flow networks. It is an
sistent way, e.g., with model repositories or component databases. interpreted language, and is, with its runtime engine, also genuinely
With complex industrial assemblies and cooperative design, geo- targeted at interactive applications. The software is implemented as
metric verification and version management become indispensable. a C++ library, with a runtime engine based on OpenGL. As it is
Ideally, a model repository is amenable to typical database oper- supposed to be used for instance as a 3D plugin to third-party soft-
ations, such as indexing, searching and markup, i.e., attachment ware, the API is designed to be easily usable and extensible. We
of meta-data. In this case, the term digital library is appropriate, have created an internet browser plugin, which we call ActiveGML,
where a 3D object is understood as a generalized document. to demonstrate the advantages of this technology.
For obvious reasons, the efficiency of such a digital library de- We are aware of the fact that language-based modeling is not
pends heavily on the model representation format. When nothing a new subject. Especially in the parametric modeling community
is known about the object structure, eg. with raw triangle meshes, there’s a diversity of approaches, as, e.g., nicely summarized by
searching leads directly to the shape matching problem, which is [Hoffmann and Arinyo 2002]. Our approach differs from these in
notoriously hard to solve. Collections of many slightly different that we, to a large extent, target at the interactive aspect of 3D mod-
objects are a nightmare for large-scale databases (large car manu- eling. Other approaches include HyperFun, a language to describe
facturers, for example, have to deal with approx. 5000 variations implicit objects, which was used, e.g., for cultural reconstruction
of windshield wipers), especially when objects are created in a [Vilbrandt et al. 2004], and PLaSM, which is a language for gener-
forward-modeling way: Structural similarities of just slight vari- ating parameterized VRML models [Paoluzzi et al. 1995]. Our ap-
ations cannot be exploited to facilitate database management. proach slightly differs from these in terms of the model representa-
tion (meshes+subdivision surfaces), the language paradigm (stack-
1.3 Interactivity based), and the web integration.
The original motivation for our work, the creation of shapes
The distinction between sophisticated modeling software on one through generating functions, goes back to the book on Generative
hand and the viewer, or runtime engine, on the other hand has the Modeling from Snyder (thus the title of the article). The difference
consequence that in most virtual worlds and 3D applications the here is that Snyder originally considered no meshes, but continuous
environment is mostly static. Things that move or deform have to functions. The central role of sweeping in his approach is paral-
be explicitly designed to do so, which considerably diminishes the lelized by the various forms of extrude operations used with the
perceived level of interactivity. This limitation is of course also GML.
caused by the different passes of post-processing, just to mention From a technical point of view, our approach is basically a com-
global illumination, that are necessary to create a convincing, high bination of several well-established techniques:
fidelity virtual environment.
On the other hand, it should be possible to go beyond an under- • Catmull/Clark subdivision surfaces,
standing of virtual reality as being able to change transformation • BRep meshes,
matrices in a hierarchical scene graph, or to switch between differ- • Euler operations, and
ent snapshots of a model for animating 3D objects. To do so again • a stack-based programming language.
requires modeling capabilities in the runtime engine, i.e., the possi-
bility to modify a mesh both geometrically and topologically. Ar-
They are arranged in an architecture made of three software lay-
bitrary modifications are not even possible with high-end computer
ers (see below) that are presented in a bottom-up fashion in the
games, which are today probably the leading technology for deliv-
following three sections.
ering online ’content’ over the internet. In most shooting games,
not even with the biggest guns is it possible to shoot a hole into a
wall, or to disassemble and re-assemble objects. But true modeling Application
capabilities are available only to the game designers. Generative Modeling Language GML
Euler Operators + Euler Macros
Combined BRep Meshes
2 Overview Subdivision Surfaces
Graphics Hardware
In summary, we have identified the following problem areas:
• limited changeability and re-usability of 3D objects,
• heavily increasing model complexity and file sizes, 3 Combined BRep Meshes
• the maintenance and usability of potentially huge libraries of
The backbone of the proposed architecture, and the actual shape
3D objects, and
representation, is the Combined BRep mesh, short CBRep. The
• to provide truly interactive 3D environments with an interface
Combined BRep is a multiresolution data structure. It operates on
to third-party software.
any given input mesh by recursively subdividing its faces using the
We think that one way to cope with some of these problems is Catmull/Clark scheme, thereby generating new vertices, edges and
to emphasize the importance of structual information of 3D objects faces. The subdivision process quickly converges to a smooth limit
over low-level primitives. This follows the information reduction surface which is C2 continuous almost everywhere.
paradigm: Our aim is to store only the essential information that is While BReps usually represent polygonal objects, Combined
needed to represent a shape, and from which the full model can be BReps can represent both polygonal and curved shapes: Any part
generated on demand, eg. in the runtime engine. of the mesh can be used as the control mesh of a Catmull/Clark
We introduce the Generative Modeling Language (GML) and subdivision surface [Catmull and Clark 1978]. Thus a CBRep pro-
propose it as a smallest common denominator for procedural shape vides a uniform representation for a surface with both polygonal
descriptions. While in principle still being able to represent raw and free-form parts. The overhead in the mesh is only small: One
triangle meshes, i.e., only the result of the modeling process, the sharpness bit per (half-)edge. Any edge can be toggled between
sharp and smooth – with the exception of faces with rings, which single quadrangle face of the CBRep may unfold to 16x16 = 256
may only have sharp edges. OpenGL quads, a reduction by more than two orders of magnitude.
For interactive display, each curved face is adaptively tes- This makes the control mesh much more manageable than the tes-
selated, and OpenGL display primitives are generated on de- selation, or an equivalent triangle mesh.
mand. In contrast to the technique proposed by Boltz and
Schroeder [Bolz and Schröder 2002], CBReps realize a caching
strategy where, once computed, the face resolution can be adap- 3.1 Data Structures
tively adjusted on a per-frame basis without any further compu-
Combined BReps are based on a conventional half-edge data struc-
tations. But on-line modifications to the control mesh are still
ture, with the following topological incidences:
possible, as CBReps provide a method for selective (local) up-
A half-edge holds pointers to its face, to the vertex it emanates
dates of the tesselation. For full details the reader is referred to
from, and to the counterclockwise next half-edge in its face. There
[Havemann and Fellner 2003].
is one array containing all the half-edges and they are allocated in
pairs, so that a half-edge with an even array index finds its other
half, its mate, at the next array position, and vice versa. The size
of a half-edge is therefore three pointers. A pair of half-edges is
referred to as one edge of the mesh. A vertex contains one pointer
to an outgoing half-edge. A face also contains a pointer to one in-
cident half-edge, and two additional face pointers, namely nextring
and baseface. A face is either a baseface (counterclockwise order)
or a ring (clockwise order). For a face with no rings, nextring is
NULL and baseface points to the face itself. Faces can have any
number of vertices and rings. A mesh consists of three dynamic ar-
rays for vertices, edges, and faces. For topological consistency, we
demand that the mesh must be a valid manifold mesh, i.e. a closed,
orientable surface. This guarantees that all pointers of the incidence
relation are valid. The limitation to manifold meshes considerably
simplifies some consistency issues mentioned below in Section 4.
Besides the connectivity of a particular mesh, the vertex posi-
Figure 1: Street lamp model rendered as polygonal model (left) and tions and the sharpness flags of the edges are input data for the sub-
as (Catmul-Clark) subdivision surface (right) (courtesy Viewpoint sequent tesselation. All the other data members of vertices, edges
Data Labs) and faces are thus computed by the tesselation pass.
This pass proceeds by first classifying vertices, then faces, and
For modeling, BReps have advantages over using just triangles. then computes the tesselation for each face that needs an update,
BRep faces provide a higher degree of abstraction as they can have according to its type.
any number of vertices, and they do not have to be convex. More- Vertices are classified by the number of incident sharp edges. A
over, while the border of a face, the baseface, is a simple CCW vertex with less than two incident sharp edges is a smooth vertex,
polygon, Combined BRep faces can also have any number of rings, with exactly two sharp edges it becomes a crease vertex, and with
which are simple CW polygons contained within the border poly- more than two it becomes a corner vertex. The face classification
gon. Consequently, a face can be a complex-shaped object. is based on both, vertex types and sharpnes of edges. We have ba-
Figure 1 shows a street lamp rendered as a subdivision surface sically adopted these classification rules from [Hoppe et al. 1994].
and for comparison as a polygonal model. It can be seen how faith- He did not treat the special case of sharp faces as we do.
ful the freeform representation captures the intended shape, actually
synthesizing model detail beyond the resolution of the polygonal
model. 3.2 Polygonal Faces
If a mesh has only sharp edges, it is processed as a regular polygo-
nal mesh: In order to display it, a standard triangulation algorithm
which can process simple polygons with holes is used to compute a
triangulation of each baseface. Triangulation algorithms are typ-
ically very fast, and they are O(n log n), so that it is possible to
compute triangulations on the fly. The index arrays are held in a
memory pool (dynamic array with fast allocation/deallocation), so
that triangulations can be updated easily if the mesh is changed.
Figure 2: Compbined usage of polygonal and of freeform geome- A polygonal face is a face which contains only sharp edges and
try. Profiles are swept along a complicated curve, not just along a all vertices are corner vertices. It may have holes.
straight line. Furthermore, mirror symmetry is involved.
3.3 Smooth Faces
The combination of polygonal and freeform geometry within the
same mesh representation is illustrated with the model of an orna- If edges are not sharp, they are called smooth. A mesh with only
ment in Figure 2. There, profiles are swept along a smooth curve, smooth edges is regarded as the control mesh of a Catmull/Clark
not just along a straight line. Despite its consistent framework, the subdivision surface. In this case, it is processed differently:
mesh structure makes a clear distinction between ’normal’ edges For every half-edge, a CCPatch structure is allocated, that con-
resulting from tesselation steps (e.g., on free-form surfaces) and tains basically a grid of 9 × 9 vertices together with normals. For
’feature’ edges which essentially control the object’s shape. each vertex and each face, a CCRing data structure is allocated,
By generating the tesselation of the subdivision surface on de- which contains the position of a Catmull/Clark vertex point for all
mand at runtime, we follow the information reduction paradigm: A four levels of subdivision, and the limit position, by applying the
appropriate vertex stencils. For faces, it also contains the face mid- The original paper used only edge collapses for coarsening,
point, which becomes a vertex point in the Catmull/Clark scheme which cannot change the genus of an object or glue objects together,
after the first subdivision. and more general operator sets have been proposed since by differ-
Every face with at least one smooth edge is treated as a smooth ent authors [Garland and Heckbert 1997; Borodin et al. 2002].
face, i.e., subdivided. The Catmull/Clark scheme has no rules for For manifold meshes, all such operators can be expressed also
rings, so if a face with rings contains smooth edges, these edges are in terms of Euler operators: An edge collapse for instance is basi-
forced to be sharp. cally a killEV and two killEF, as it removes three edges, two vertices
and a face. Consequently, a split sequence could equivalently be
expressed as a sequence of Euler operators, exploiting their invert-
3.3.1 Creases
ibility for coarsening and refinement.
According to this definition, a smooth face can also have sharp
edges. Now suppose there is a path of sharp edges in an otherwise
4.2 Euler Macros
smooth mesh. Such a path is called a crease in the surface, and all
vertices along the path are crease vertices. For Catmull/Clark sub- In database terms, each Euler operation is an atomic operation, and
division, the canonical way to deal with a crease is to regard it as an arbitrary sequence of them can be grouped together to form a
a uniform cubic B-Spline curve. The subdivision stencils on both transaction, which we call Euler Macro. The granularity of the
sides of the crease are decoupled: For computing the tesselation of macros with respect to the length of the operator sequence is not
a patch next to a crease, the vertices on the other side of the crease prescribed: It is up to the user – where the word user is used syn-
do not matter. An example of a sharp face is shown in Fig. 3. onymously for any kind of external application, and simply means:
not determined by the calculus.
3.3.2 Tesselation on the fly The rationale for introducing Euler Macros is the Semantic
Level-of-Detail (LOD). This was based on the observation that ex-
In order to display the object interactively, the first subdivision level perienced modelers often work in a coarse-to-fine fashion: They
is computed: The face, edge, and vertex points are stored in the start with some basic shapes or primitives and successively add de-
CCRing and CCPatch structures of the appropriate entities. With tail, a modeling style that nicely lines up with the macro concept.
the Catmull/Clark scheme, the mesh consists merely of quadran- The drawback when a new macro is started every now and then
gles after the first subdivision, regardless of the original topology. in the modeling process, i.e., with a low macro granularity, is that
At this point in the tesselation process, the CCPatch data structure undo/redo gives popping artifacts. But the great advantage on the
takes over, where each patch corresponds to one quadrangle of the pro side is that the user can steer the refinement process, and actu-
first subdivision. Each patch can be subdivided a maximum of 3 ally author a multi-resolution mesh. It is possible to group model-
times, which makes for a maximum of 4 subdivision steps of the ing operations together which belong to the same level of structural
original control mesh (including the first subdivision). This means refinement. Thus, user-defined macros can be based on the model
that in order to interactively display a smooth quadrangle of the semantics instead of on the output of a simplification cost measure
control mesh, it is represented by up to 16 × 16 = 256 quads at controling the coarsening of the model.
highest resolution.
View-dependent on-line tesselation and interactive display is
then performed using a scheme that is very similar to the one de- 4.3 The Macro Graph
scribed in [Havemann 2002]. There is a canonical dependency relation between macros: The
For patches along a crease edge the neighbour resolution, the Euler operations are formulated in terms of halfedges, and opera-
ccSteps, is increased by one. This improves the visual quality of tions later in the sequence have input values produced by operations
creases, as can be clearly seen in Figure 14. earlier in the sequence: A macro mA is a parent of mB iff an opera-
tor from mB has an input value that is produced by mA . In this case
mB is called a child of mA .
4 On-line Mesh Modeling The parent-child relationship in the macro graph can be regarded
– and used – as the continuation of a scene graph below object level:
The purpose of Euler operators is to give a well-defined access the object graph or model graph. Macros also keep track of their
to the mesh, to modify both its connectivity and geometry. With location in space: At present, we maintain a simple axis-aligned
our implementation, which basically follows the proposal from box (AABox)for each macro. It contains the 3D points occurring
[Mäntylä 1988], there are five Euler operators which affect the con- in the operator sequence and the union of the parent boxes. The
nectivity of the mesh, together with their five inverse operators. purpose of the AABox hierarchy is to use them for culling and for
Each operator basically creates (or deletes) an edge together with spatial queries (see Fig. 3).
a vertex, face, or ring.
Although well-established, the Euler operations are informally
introduced in the appendix for reasons of self-containedness. 5 The Generative Modeling Language

4.1 Euler Operators and Progressive Meshes The Generative Modeling Language (GML) is based on the core of
Adobe’s Postscript language. It does not have Postscript’s extensive
There is an interesting relation between Euler operators and pro- set of operations for typesetting, though. The GML is targeted in-
gressive triangle meshes. The split sequence of a progressive mesh stead at 3D modeling, and exposes the functionality from Section 3
can be regarded as a procedural description for building up a shape: and Section 4 to a stack-based interpreter. It has many operations
The original, highly refined mesh can be reconstructed from the ex- from vector algebra and to handle polygons, and others that convert
tremely simplified base mesh by issuing vertex split operations, i.e., back and forth between polygons and meshes.
by undoing the edge collapses from the simplification. This marks While it is standard that 3D modeling packages have a built-in
in fact a paradigm shift: From a static shape representation, such scripting engine, the Postscript language has a number of unique
as an indexed face set, to understanding a shape as the result of an features. It seems that many operations that are frequently used
sequence of (invertible) operations. with 3D modeling can be conveniently described with a stack-based
5.2 Postscript
The core of Postscript is concisely specified in the Postscript Lan-
guage Reference [Adobe Systems Inc. 1990]. We informally de-
scribe how Postscript works and, for a more concrete understand-
ing, also some implementation details.
Postscript is a stack-based language without the need for a syn-
tax parser. The runtime system consists of only a lexical scanner
and an interpreter. The job of the scanner is to convert a character
string into an array of tokens. An executable array is then processed
by the interpreter, which simply executes it token by token. A Post-
script interpreter that contains only the language core (without op-
erations for typesetting) can be implemented with a few dozens of
lines of C++ code.
The basic data structure is the token. Tokens are atomic values
such as integers, floats, 2D and 3D points, and markers: [, ], {, and
}. Only two compound data structures are availabe, arrays and dic-
tionaries. A token can also be an operator, and refer to a global
array where the available operations are stored. Operators are im-
plemented as classes derived from an abstract class Operator, and
Figure 3: The front face is a sharp face. All Euler Boxes active so must overload a virtual function
(left); Active boxes as a result of a spatial query (right). The spatial bool Operator::execute(Interpreter& interpreter);
query is the small blue point; all other macros are deactivated. A token can be either literal or executable, which is important for
the interpreter to process an array and a name. Executing a GML
program from C++ is as simple as
interpreter.execute(token);
language, and a number of concepts from modeling nicely map to When the interpreter encounters an executable array, it is exe-
GML constructs. cuted by stepping through it and executing each token. Executing
a literal token simply means to push it on the stack, which is what
happens with numbers, vectors etc, and also with literal tokens that
5.1 Just yet another 3D model format? refer to an array or dictionary, and with literal names. But when
an executable name is encountered, it is looked up in a dictionary,
The outstanding feature of the GML approach is the simplicty of and the value, a literal or executable token, is executed: If an ex-
code generation. This is supported by the great number of, e.g., ecutable array is found, it is pushed on the execution stack and is
Postscript printer drivers available. We are typically not aware that executed. When this is finished, it is popped and the execution con-
printing a document on a Postscript printer makes the printer in fact tinues with the array from before. If an operator is encountered
to execute a program that, as a side effect, creates the bitmap that or found through name lookup, its execute method is called. The
eventually appears on a sheet of paper. In terms of quantity of au- current dictionary is the topmost element of the dictionary stack.
tomatically generated code, Postscript as a programming language Name lookup is done by going through this stack top to bottom,
is probably unparalleled. and the first dictionary where the key is defined delivers the value.
The dictionary stack is independent from the execution stack and
And just like PostScript, the GML is designed as an ’invisible
can be changed at any time, a very flexible method for scoping as
language’: The code can be generated in background, and GML
well as for function overloading.
programs may be interpreted even during user interaction to create
If the interpreter encounters an opening marker, it is put on the
complex three-dimensional shapes. But looking behind the curtain,
stack. When it finds a closing marker, it searches the matching
how concisely can a complex shape be described with it?
opening marker on the stack, creates an array from the tokens in
The key to the generality of the approach is the operator con- between, and puts the array on the stack (i.e., a token referring to
cept. A vast but extensible set of built-in operators for vector al- it). A curved bracket puts the interpreter in deferred mode: Now
gebra, polygons, conversion to meshes, and mesh modelling op- all tokens being executed are considered literal and are put on the
erations exists. But no finite set of modeling operations will ever stack, until the matching closed curved bracket is found. This is
satisfy all modeling requirements. With the GML, new operations how an executable array is created. It is possible to convert between
can be formed by combining the elementary operators – possibly literal arrays and executable functions by just changing the array’s
directly from the operations interactively applied to a 3D model by ’executable’ flag.
the designer. This reflects a paradigm shift from objects to opera-
tions: Instead of designing only one instance of a particular shape,
a whole object class is identified with a set of parameterized con- 5.3 Operator Libraries
struction steps. And due to the functional language, anything can
All functionality of the GML comes from the operators. The oper-
be a parameter. A construction can even be parameterized in terms
ators are organized in several libraries, implemented as a thin layer
of the sub-constructions (or combined operations) to be used. The
on top of underlying C++ libraries. The library methods are ac-
net gain for the user are two key advantages:
cessed from each operator’s execute method.
An operator is characterized by its signature, i.e., by its name, the
• Changeability – by isolating the key parameters of a complex input parameters it takes from the stack, and the output parameters
construction, design variants can easily be tested it pushes on the stack after processing. Abbreviations such as E
for edge, P3 for 3D point, {f} for functions etc. are used. The add
operator for instance can equally add ints, floats, and 2D and 3D
• Re-Usability – once a modeling problem is solved, the solu- vectors, and is an example for function overloading. An operator
tion can be re-used can equally check types and values of stack items to decide whether
an operation is legal or not. The following operator libraries are This example demonstrates the technique of operator chaining.
currently available: Chaining means that in a sequence of operators the result of one
The Core library contains the basic Postscript operators: stack operation serves as input to the next operation. It is quite efficient
manipulation, dictionaries and arrays, and flow control, i.e., if, for, when functions have compatible signatures, so that more specific
repeat etc. The forall operator, for instance, iterates through an ar- combined operations can be created by concatenating generic op-
ray, puts each element on the stack, and executes a given function. erations with specific parameters. A slight variation of the above
In a similar way the map operator iterates through the array but ap- example shows the power of the generative approach:
plies a function which leaves a value on the stack, from which the
operator assembles a new array at the end of the iteration. (10,7,0) 0 quad
The Geometry library contains the usual operations from vec- 5 poly2doubleface
tor algebra as well as for computing distances and projections, for 4 { (0,4,3) extrude } repeat
points, lines, segments, and planes. The operator project_ptplane:
p:P3 nrml:P3 dist:F → q:P3, for instance, projects point p onto The extrusion is repeated four times, to create a crude approxima-
plane (nrml,dist). tion of a four-story building: The code size is decoupled from the
The CBRep library provides Euler operators and functionality size of the mesh it creates. The next step is to provide the building
for handling macros, as well as for navigating in the mesh and in with a simple roof. This is done using a function collapse-mid that
the macro graph. It also adds a new literal token, the edge type expects a halfedge on the stack:
representing a halfedge, whose string representation is “Er,m,k” ,
where r,m,k are integers (see Sec. 4.3). { usereg !e
The Modeling library contains higher-level modeling operatios, :e vertexpos
most notably several forms of extrude, polygon/face conversions, :e mate vertexpos
and for gluing faces together in various ways. Additionally, opera- midpoint_2pt !p
tors for ray/mesh, ray/face, face/plane intersections and for follow- :e edgeflip :p moveV
ing a ray over the mesh are available. :e killEV
The Interaction library contains operators for handling input } /collapse-mid exch def
events and for displaying other data types, such as 3D text and pro-
gressive triangle meshes.
Postscript offers basically two alternatives to store a value for later
use: on the stack, which can be tedious, or in a dictionary, which
5.4 Simple GML Example can be slow. We have introduced named registers as a third alter-
native. The usereg operator opens a register frame where !myvari-
able pops and stores, and :myvariable retrieves and pushes a register
value. The register frame is automatically closed at the end of the
function, so that a register is only valid within a function.
The mesh can be accessed exclusively by using halfedges. A
halfedge uniquely defines a position in a mesh, i.e., one (ver-
tex,edge,face) combination. With mesh navigation functions it is
possible to move a halfedge over a mesh: The mate function re-
places a halfedge on the stack with its corresponding other halfedge
(in reversed direction). Similarly, faceCW, faceCCW, vertexCW,
vertexCCW operators exist to navigate in clockwise and counter-
Figure 5: Variations of the Simple house model, each created with clockwise directions over faces and vertices.
a single line of GML code. The parameters are varied from (10,7,0) Lines 1 and 2 of collapse-mid push the positions of both end
3 12.0 simple-house to (2,2,0) 1 2.0 simple-house . vertices of edge e on the stack. Line 3 computes p as their mid-
point. The moveV operator in line 4 then moves the vertex of e’s
We will shortly develop a GML example that shows the cre- mate to the new position. This changes the mesh, creating a non-
ation of a very simple, parameterized house model, shown in Fig.5. planar face, which is shown as subdivision surface. The last line of
The result of the following three lines of GML code are an axis- collapse-mid finally uses the killEV euler operator, which is essen-
aligned box with minimum and maximum corners (−10,−7,0) and tially an edge collapse, to remove e and its vertex from the mesh.
(10,7,4): This finally creates two non-planar faces (see Fig. 4).
The planarity can be restored when collapse-mid is applied also
(10,7,0) 0 quad to the opposite edge of the original quad. Yet this kills only two of
5 poly2doubleface the four edges from the original quad, which turns it into a 2-gon.
(0,4,3) extrude One of these edges is redundant and can be killed using killEF,
which is the Euler operator for joining two faces. So provided
The quad operator in the first line yields an array with four 3D collapse-mid exists, the complete GML code to create the house
points [ (-10,-7,0) (10,-7,0) (10,7,0) (-10,7,0) ], which is put on the model in Fig. comprises only the six lines of code to the left:
stack. Line 2 converts it to a mesh face, as poly2doubleface pops the
array and pushes one mesh halfedge. This halfedge is consumed by { usereg !roofheight !floors !quadpoly
the extrude operator, which after an extrusion by 4 units pushes the (10,7,0) 0 quad :quadpoly 5 poly2doubleface
halfedge of the extruded face. 5 poly2doubleface :floors { (0,4,3) extrude } repeat
Operators can work in different modes, as specified by supple- 4 { (0,4,3) extrude } repeat 0 :roofheight 3 vector3 extrude
mental parameters. With (10,7,0) 1 quad for instance the quad op- dup faceCCW collapse-mid dup faceCCW collapse-mid
erator creates a different polygon, namely with minimum and max- dup faceCW collapse-mid dup faceCW collapse-mid
imum corners (0,0,0) and (10,7,4). Similarly, the 5 and (0,4,3) dup faceCCW killEF dup faceCCW killEF
parameters specify how the poly2doubleface and extrude operators } /simple-house exch def
are to process the data on the stack.
Figure 4: Creation of the simple house model. The extrude operator is repeatedly applied to the ground polygon. To create the roof, the
combined operator collapse-mid is applied to the faceCW and faceCCW edges of the edge returned by the extrude operation.

It is immediately obvious that the code to the left can be used to [ p0 m p1 ] norml resolution circleseg-poly
create more than just one single house. A whole variety of different The poly2doubleface operator of the Geometry library produces
houses can be created with essentially the same operator sequence, smooth vertices by default, and creates corner vertices only where
but using slightly different parameters. The GML encourages the the polygon contains the same point twice (in analogy to BSpline
conversion of specific shapes to general functions because replac- control polygons), i.e., segments of zero length. This is useful for
ing concrete values by parameters is so simple. The simple-house the pointed arch example, as the different parts of the polygon’s
function to the right is one possible parametrization of the house outline can be combined simply by concatenating arrays.
construction sequence. A few variations of the simple house are
shown in Fig. 5.
Note that the simple-house function expects the ground quad-
rangle on the stack. This demonstrates an important concept: The
separation of data and operations. A very lean city database might
represent each building by only a 4-tuple: (position,size,floors,roof
height). A sample city generated this way is shown in Fig. 6.

Figure 7: Gothic Window: basic ’style’ in left image is augmented


with a rosette and then applied recursively once and twice to the
window geometry in the center image and right image, respectively.

The Geometry library’s extrude operator can also shrink or ex-


Figure 6: Sample city generated by the GML house model in Fig. 5 pand, and it can do multiple extrusions on several faces, so it ex-
from the footprints of the buildings augmented with the parameters pects an array of edges and an array of (dx,dy) extrusion values
number-of-floors and roof height. (actually 3D points), which is essentially a profile.
The creation of Gothic style windows or ornaments is then a
Even more important: Functions can be parameters – just like matter of creating the right circle segments. An analysis of some
anything else, because they are just arrays. So the example could examples reveals that the most important operations are offsetting,
also be parameterized in terms of the extrudepoly function or the scaling and rotation, and, curiously, to compute the intersection of
transformation to create the second polygon (the body of the map an ellipse and a circle (to determine the radius of the top window).
operator). Some results are shown in Figures 7 and 14. Note the variety
of different styles that can be obtained by changing the profile, or
some parameters. This effectively shows the separation of structure
5.5 The Gothic Window
from data. Another point is the effect obtained from coarsening
The basic stylistic pattern in Gothic architecture is the circular arc, the resolution of the circular segments, a simple way to obtain a
or circle segment. A pointed arch, for example, is constructed with semantic LOD (see Fig. 8).
two vertical line segments continued by circle segments to the point
where the circles intersect. A circle segment can be represented by 5.6 The Arcade
three points, the start and end points and the center of the circle,
and a normal. The normal is important if angle(p0 − m, p1 − m) The Arcade example demonstrates the versatility of our approach
is supposed to be greater than 180 degrees. Just as a circle corre- which is capable of supporting the separation between basic ’shape’
sponds to an n-gon, the function converting circle segment expects and the ’presentation’ aspect – similar to the separation of ’markup’
a resolution. In GML notation it is created simply by: and ’presentation’ in the text domain. The example also documents
formats, namely .OBJ (Fig. 11) and VRML (Fig. 10), into the GML
framwork.

v -1.0 -1.0 -1.0 (-1.0-1.0 -1.0) v { beginreg !faces !points


v -1.0 1.0 -1.0 (-1.0 1.0 -1.0) v :points { addVertex } forall
v 1.0 -1.0 -1.0 ( 1.0-1.0 -1.0) v :faces { addFace } forall
v 1.0 1.0 -1.0 ( 1.0 1.0 -1.0) v endreg
v 0.0 0.0 1.0 ( 0.0 0.0 1.0) v } /create-IFS exch def

f 1 2 4 3 [1 2 4 3] f [ (-1,-1,-1) (-1,1,-1)
f 1 3 5 [1 3 5] f (1,-1,-1) (1,1,-1) (0,0,1) ]
f 3 4 5 [3 4 5] f [ [1243][135]
f 4 2 5 [4 2 5] f [345][425][215]]
f 2 1 5 [2 1 5] f create-IFS

Figure 10: Versatility of the Postscript syntax: a cube as indexed


face set in .OBJ file format syntax, and how it translates to GML
when v and f are functions. The similarity is obvious, but note the
reversal of the order of keywords and arguments.
Figure 8: Illustration of semantic LOD. This is the gothic window
in the left part of Fig. 7 in an extremely coarsified version. As
we have the knowledge about the construction history, we can still The .OBJ file format is conceptually quite simple, as the example
distribute edge sharpnesses correctly to obtain an appealing shape. in the left column of Fig. 10 indicates. In GML, a function to create
an indexed face set would expect on the stack an array of 3D points
and an array of index arrays for faces, and simply loop over them,
vertices first, as shown in the right box. A solution with a more
the usefulness of a data flow concept for 3D modeling, and it un-
obvious correspondence is shown to its left, where addVertex and
derpins our claim that 3D modeling has to be supported with as
addFace are redefined as v, f.
powerful tools as used in programming.
Primary input parameters are a ground polygon and an arcade
style. It uses the offset-polygon operator to generate a new polygon Transform { Transform
in a specified distance. translation 0 8 0 (0,8,0) translation
children [ [ Shape
Shape { Appearance
6 Web Applications: The ActiveGML Plugin appearance Appearance { Material
material Material { (0,0.5,1) diffuseColor
The GML calculus as presented in this paper provides the necessary diffuseColor 0 0.5 1 endnode
infrastructure for an extremely compact yet very powerful genera- } material
tive representation of 3D objects, based on operations instead of } endnode
(low-level) geometric primitives. geometry Cylinder { appearance
The ActiveGML web browser plugin is realized as an ActiveX height 18.0 Cylinder
control widget that can be embedded in any standard HTML page. radius 0.5 18.0 height 0.5 radius
Currently, the plugin will only work with the Internet Explorer. } endnode
But next steps include implementations for Netscape, Mozilla and } geometry
Opera browsers, which use the old Netscape client plug-in API. ] endnode
Scripting support for these browsers will be added by XPConnect1 } ] children
which uses XPCom2 (Cross Platform Component Object Model). endnode
Since GML is also running (and being developed) under Linux, a
corresponding browser plugin will be released in the near future. Figure 11: Versatility of the Postscript syntax: the left column
The ActiveGML plugin provides only three methods that can be shows a portion of a hierarchical scene graph in VRML syntax. It
accessed from JavaScript. With these functions, a GML model can could be translated to GML by using functions for nodes and fields.
be loaded, messages can be sent to the plugin, and a textual repre-
sentation of the token on top of the stack can be retrieved. Typically, VRML in turn is based on the concept of a Directed Acyclic
these functions are used in the following way: Graph (DAG) of nodes with fields containing values. It naturally
ActiveGML.call(document.GMLCommand.value); corresponds to a hierarchy of dictionaries, so that the definition of a
ActiveGML.loadModel(document.GMLFilename.value); cylinder would read: dict begin /nodetype /Cylinder def /height 18.0
var stacktop = ActiveGML.getStackTopAsString(); def /radius 0.5 def currentdict end. This leaves the dictionary on the
stack to be used by its parent node. A more sophisticated way to
represent a VRML scene is to realize node types as functions. A
6.1 Integration of Non-Generative 3D Data Cylinder operator would put a dictionary containing the field defin-
The concept of a stack-based language is quite general and as well ing functions (like height and radius) on the dictionary stack.
adaptable to concepts other than BRep modeling. This can be illus- Of course, we do not advocate to use GML just to intrepret .OBJ
trated by the following two examples which map existing 3D web or VRML data sets. Instead, we suggest to increase the seman-
tic level in which the 3D model is being represented to the highest
1 http://www.mozilla.org/projects/plugins/ possible in order to exploit all described features from compact rep-
scripting-plugins.html resentation, resulting in negligible downloading times, to seman-
2 http://www.mozilla.org/projects/xpcom/ tic LOD, catering for varying rendering performance at the client’s
Figure 9: Separating basic geometry from ’presentation’: the styles ’building’ and ’arcade’ are applied to a basic u-shape (left and middle)
and then the basic shape is changed independently from the applied style (right).

side. Acknowledgement
Figure 12 and Figure 13 show the GML ActiveX-plugin in ac- The support from the German Research Foundation (DFG) under
tion with a chess game and the Cologne Cathedral, both at fully the Strategic Research Initiative Distributed Processing and Deliv-
interactive rendering speed (displayed at a standard notebook). The ery of Generalized Digital Documents (V 3D 2) [Fellner 1998-2003]
chess game takes 13.113 bytes of XML code (2.922 bytes with to address basic research challenges in the field of Digital Libraries
gzip compression) and the Cologne Cathedral, which has all in- and from the European Commission under the EPOCH Network of
terior structures fully modelled, takes 132.716 bytes (19.507 bytes Excellence is greatly appreciated.
with gzip compression). LOD (i.e. Euler Macro) evaluation and
tesselation-on-the-fly of curved surfaces are controlled by an ap-
pliaction through the parameters rendering speed, projected patch References
size, curvature, and contribution to a silhouette.
Finally, it is worth mentioning that the extensibility of the GML A DOBE S YSTEMS I NC . 1990. PostScript Language Reference
is also key in protecting intellectual property rights: The whole Manual, 2 ed. Addison-Wesley.
current runtime system has a size of about 2.5 MB, so it is feasi-
ble to create a custom viewer that will only display models carry- B OLZ , J., AND S CHRÖDER , P. 2002. Rapid evaluation of catmull-
ing a particular security code issued by a Digital Rights Manage- clark subdivision surfaces. In Proc. Web3D 2002 Symposium.
ment (DRM) system – in contrast to sending a fine tesselation from
which reverse engineering is easy. Of course, the DRM key can also B ORODIN , P., N OVOTNI , M., AND K LEIN , R. 2002. Progressive
control various levels of detail the client/plugin will render thereby gap closing for mesh repairing. Advances in Modelling, Anima-
serving different user groups with just one (and consistent) model. tion and Rendering (July), 201–21.

C ATMULL , E., AND C LARK , J. 1978. Recursively generated b-


spline surfaces on arbitrary topological meshes. Computer-Aided
Design 10 (September), 350—355.
7 Conclusions F ELLNER , D. W., 1998-2003. Strategic Initiative V 3 D2 – Dis-
tributed Processing and Delivery of Digital Documents. Ger-
We have presented a novel technique for representing geometric man Research Foundation (DFG), http://graphics.tu-bs.
objects more accurately and in an extremely compact way based de/dfgspp/V3D2.
on high-level shape descriptors (in contrast to lowest-level polygon
meshes). In addition to introducing a new level semantic compact- G ARLAND , M., AND H ECKBERT, P. S. 1997. Surface simplifica-
ness and quality of shape preservance the new represenation has the tion using quadric error metrics. In Proceedings of SIGGRAPH
potential of clearly separating basic geometric features from orna- 97, ACM SIGGRAPH / Addison Wesley, Los Angeles, Califor-
mental aspects in a similar way modern publishing systems clearly nia, Computer Graphics Proceedings, Annual Conference Series,
separate content from presentation. As illustrated in Figures 7 and 209–216. ISBN 0-89791-896-7.
14 the content would deliver the fact that we are dealing with a win-
dow of a certain extent and at a certain position but the ornamental H AVEMANN , S., AND F ELLNER , D. W. 2003. Progressive com-
detail is a matter of presentation, something we must be able to bined breps – multi-resolution meshes for incremental real-time
change from ’gothic’ to ’baroque’ as easily as switching the LATEX- shape manipulation. Tech. rep., Institute of ComputerGraphics,
style from ’article’ to ’report’. TU Braunschweig. submitted for publication.

Also, the presented approach suggests a new measure for geo- H AVEMANN , S. 2002. Interactive rendering of catmull/clark sur-
metric complexity by replacing the (in many cases meaningless) faces with crease edges. The Visual Computer 18, 286–298.
polygon count by the constructive model complexity. It is also
worth noting that the model file sizes for Figures 7 and 14 are only H OFFMANN , C. M., AND A RINYO , J. 2002. Parametric modeling.
in the order of a few kilobytes. In Handbook of CAGD. Elsevier.
Figure 12: GML-plugin in action: the chess game takes 13.113 bytes of XML code (2.922 bytes with gzip compression). left: full model,
right: zoomed subsection (LOD evaluation and tesselation on the fly done by the receiving client).

H OPPE , H., D E ROSE , T., D UCHAMP, T., H ALSTEAD , M., J IN , Appendix


H., M C D ONALD , J., S CHWEITZER , J., AND S TUETZLE , W.
1994. Piecewise smooth surface reconstruction. Proceedings of Euler Operators
SIGGRAPH 94 (July), 295–302. ISBN 0-89791-667-0. Held in
Orlando, Florida. We informally describe the working of the five Euler operators for
mesh manipulation. We use a C++ syntax, where e0, e1, eNew
LYMAN , P., VARIAN , H. R., D UNN , J. D., S TRYGIN , denote halfedges, p, p0, p1 are points of type Vec3f, and s is a
A., AND S WEARINGEN , K., 2000. How much infor- boolean value, the sharpness of a new edge. On the C++ level, the
mation? http://www.sims.berkeley.edu/research/ Euler operators are the basis of the implementation of higher level
projects/how-much-info/index.html. modeling tools (extrude etc.), but they are also available as GML
operators.
M ÄNTYLÄ , M. 1988. An Introduction to Solid Modeling. Com- The first operator reads makeVertexEdgeFaceShell and creates a
puter Science Press, Rockville. new connected component consisting of two vertices connected via
PAOLUZZI , A., PASCUCCI , V., AND V ICENTINO , M. 1995. a pair of half-edges: eNew = makeVEFS(p0,p1,s) with halfedge
eNew directed from point p0 to p1. Its inverse would be kil-
Geometric programming: A programming approach to geomet-
lVEFS(eNew). Note that both half-edges are incident to the same
ric design. ACM Transactions on Graphics 14, 3, 266–306.
www.plasm.net. face. At this point, this face is not what is usually understood as
a face (i.e., there is no face normal). It can be expanded using the
V ILBRANDT, C., PASKO , G., PASKO , A., FAYOLLE , P.-A., V IL - following two operators.
BRANDT, T., G OODWIN , J. R., G OODWIN , J. M., AND K U - The second operator creates an edge and a vertex at p: eNew =
NII , T. L. 2004. Cultural heritage preservation using construc- makeEV(e0,e1,s,p). Edges e0 and e1 must emanate from the same
tive shape modeling. Computer Graphics Forum 23, 1, 25–41. vertex, and they denote the two faces between which the new edge
www.hyperfun.org. is created. If e0 equals e1, a dangling edge is created. Its inverse is
killEV(eNew).
The next operator splits an existing face by making an edge be-
tween two of its vertices, thereby creating a new face: eNew = ma-
keEF(e0,e1,s). Consequently, e0 and e1 must belong to the same
face, or to the same ring. Its inverse is killEF(eNew).
Figure 13: GML-plugin in action: the Cologne Cathedral with fully modeled interior structures takes 132.716 bytes of XML code (19.507
bytes with gzip compression). left: full model, right: zoomed detail, also opening the view into the interior of the cathedral.

These three operators (plus their inverse) are sufficient to build component.
up any mesh of genus 0, i.e., a single connected component that is Any orientable manifold mesh can be created by these five pairs
topologically equivalent to the sphere. The remaining two operators of operations.
are related to rings and the modification of genus.
To understand how a ring is created, note that nothing prevents
both halfedges (e0,e1) of a pair from being incident to the same
face. By issuing killEmakeR(e0) in the situation shown in the fol-
lowing figure, the inner quadrangle is decoupled from the border
and is turned into a ring while the border becomes its base face.
Note that the ring is clockwise
oriented, which is consistent with
the rule that the face interior is to
the left of a halfedge. The inverse
makeEkillR(e0,e1) is used to con-
nect the ring containing e0 with
the other ring or base face con-
taining e1. The genus modifica-
tion also uses rings, which makes
it extremely simple.
Suppose two connected components are given, for example two
axis-aligned cubes, one of them bigger than the other. They can
be placed next to each other so that geometrically, one face of the
smaller cube lies in the interior of a face of the bigger cube. If e0
and e1 are edges which belong to the smaller and the bigger face,
killFmakeRH(e0,e1) will simply turn the smaller face into a ring of
the bigger face. Thereby the two connected components are glued
together into one. In the same fashion, a torus, thus a topological
hole, is created when the two faces belong to the same connected
Figure 14: One of the many gothic windows from Figure 13: detailed view on resulting shape and tesselation.