Generative Modeling using the GML

Download Report

Transcript Generative Modeling using the GML

Generative Mesh Modeling
Sven Havemann Dieter W. Fellner
Institut für ComputerGraphik
TU Braunschweig, Germany
Computer Graphics,
TU Braunschweig
S. Havemann, GML
1
The “State of the Art”
Computer Graphics,
TU Braunschweig
S. Havemann, GML
2
A Provocative Statement

Great achievements in Computer Graphics…






Appearance: From Solid Textures to Pixel Shaders
Shape Processing: Simplification to Wavelets
Global Illumination
… but now let’s turn our attention
to the people at the end of the food chain:
Those who are doing the actual 3D modeling
Without models, there’s nothing to display!
Hypothesis:
Lack of easily available 3D model creation facilities
greatest obstacle to spread of 3D technology today
Computer Graphics,
TU Braunschweig
S. Havemann, GML
3
Modeling Problem: “Learn Maya”





People (in industry) want to sell goods and services –
not have their own modeling department
Roof tiles: ~75 kEuro modeling costs (personal communication)
… and what do you do with those models?
Creation of 3D models should require the same level
of expertise as creation of spreadsheets!
Integration into 3rd party applications

Modeling engine as plugin or dll
Computer Graphics,
TU Braunschweig
S. Havemann, GML
5
Issues with Simplification


Increasing need for LOD: More triangles than pixels
But



Simplification breaks the modeling history (preprocessing)
Simplification breaks symmetry
Highest resolution is limited by input resolution
Computer Graphics,
TU Braunschweig
S. Havemann, GML
6
Problems with Current Technology
A. The Modeling Bottleneck
•
•
limited changeability and re-usability of objects
3D modeling is to large extent a manual task
B. Model File Sizes
•
•
Simplification breaks modeling history
Highest resolution limited by input resolution
C. Digital Libraries of 3D Objects
•
•
Design variations
Problems: Consistency, versioning, shape matching
D. Virtual Worlds are too static
•
•
Basically change only transformation matrices (…)
Careful look at state of the art in computer games!
Computer Graphics,
TU Braunschweig
S. Havemann, GML
7
3D Modeling – An Abstract View

3D modeling is an incremental process



Interactive application of functions/tools
on a shape in order to obtain another
All 3D modeling is procedural modeling!
Selection of the next operation is not arbitrary,
but based on a plan in the artist’s mind

Often next step depends on outcome of previous step
 3D modeling is what other people call programming!


Striking similarity: Conditional decisions, loops, etc.
Today's artists are in fact programming a shape,
probably without noticing that,
and with not much support for it from their system
Computer Graphics,
TU Braunschweig
S. Havemann, GML
8
3D Modeling – Abstract Solution
A. Computers are fast (500M mul/s) – and they get faster
B. 3D Modelers already provide interactive tools
C. Description of modeling process more compact than
description of modeling result

Consequence:
Generate geometric primitives only on demand

Look for a different shape representation



“smallest common denominator” for the
description of procedural shapes
It must be a full programming language!
Problem: Artists shall not do literal programming
Computer Graphics,
TU Braunschweig
S. Havemann, GML
9
Generative Mesh Modeling
Our proposal for a solution that might
alleviate some of these problems
Computer Graphics,
TU Braunschweig
S. Havemann, GML
10
The shape description problem

Shape acquisition vs. interactive modeling




Highly regular shapes with slight variations
Shapes with self-occlusion
Fundamental question:
“What is the right way to describe the construction
of a shape or a shape class?”
Different aspects:




What are the “essential” degrees of freedom
of a given shape construction?
What low-level shape representation?
What operations on this representation?
How can shape construction be formalized?
Computer Graphics,
TU Braunschweig
S. Havemann, GML
11
Our Approach: Modeling Engine
Low-level shape representation:
Polygonal solids + freeform surfaces
 Hybrid hierarchical architecture

GML
Euler operators
BRep meshes
Catmull/Clark surfaces
Computer Graphics,
TU Braunschweig
S. Havemann, GML
12
Bottom Layer: Catmull/Clark

After first tesselation: only quads





1 patch per quad
Face degree n  n patches
Quad 3 times subdivided: 9  9 vertices/patch
Only 2 possibly irregular points per patch
Adaptive refinement: pre-computed triangle strips
[ Havemann,
Visual Computer 2002 ]
Computer Graphics,
TU Braunschweig
S. Havemann, GML
13
Tesselation on the fly

Irregular Vertices: Vertex & Face Rings
Tesselation hierarchy: 22, 33, 55, 99
 Down-sampling for free
 75400 Patches = 7.4 M / sec on P4 1700 MHz

Computer Graphics,
TU Braunschweig
S. Havemann, GML
14
Second Layer:
Combined BReps
Unified data structure
for shapes with both
polygonal and free-form parts
Computer Graphics,
TU Braunschweig
S. Havemann, GML
15
Edge Sharpness


red: sharp edge
green: smooth edge
1. Vertex classification
No. of incident sharp edges




< 2  smooth or dart
= 2  crease
> 2  corner
2. Face classification



smooth edge?  smooth
Only corners?  polygonal
Otherwise:
 sharp
Computer Graphics,
TU Braunschweig
S. Havemann, GML
16
Sharp Faces & Rings
Sharp face: BSpline border curve
 Rings: Trimming of polygonal or sharp faces

Computer Graphics,
TU Braunschweig
S. Havemann, GML
17
Combined BReps - Performance



View-cone culling:
sphere/cone intersection
Backface culling:
normal cone per face
Animation on
P4 1700 MHz /
Geforce 4
16K vertices
59K halfedges
13K faces
54K patches
7M triangles
Computer Graphics,
TU Braunschweig
S. Havemann, GML
18
Third Layer:
Euler Operators and
Progressive Combined BReps
Mesh manipulation
with incremental
tesselation update
Computer Graphics,
TU Braunschweig
S. Havemann, GML
19
Euler operators



Mesh access exclusively
through halfedges
Halfedges always come
in pairs (no border)
Topologic consistency vs.
Geometric consistency
i.
Each Euler operator maintains
topologic consistency
ii. Every 2-manifold mesh
of any genus can be built
 Closed and sufficient set of
mesh construction operators
Computer Graphics,
TU Braunschweig
S. Havemann, GML
20
1. Make vertex edge face shell


Shell: connected component
Creates degree 2 face (2 vertices, 2 halfedges)

No face normal – but topologically correct
Extended Euler-Poincaré: V-E+F = 2(S-H)+R
2-1+1 = 2(1- 0)+0
Computer Graphics,
TU Braunschweig
S. Havemann, GML
21
2a. Make edge vertex
Creates dangling vertex
 Good for conversion polygon  face

V-E+F = 2(S-H)+R
1-1+0 = 2(0- 0)+0
Computer Graphics,
TU Braunschweig
S. Havemann, GML
22
2b. Make edge vertex
makeEV: e0,e1 incident to same vertex
 Also known as vertex split

V-E+F = 2(S-H)+R
1-1+0 = 2(0- 0)+0
Computer Graphics,
TU Braunschweig
S. Havemann, GML
23
3. Make edge face
makeEF: e0,e1 must be incident to same face
 Order determines orientation

V-E+F = 2(S-H)+R
0-1+1 = 2(0- 0)+0
Computer Graphics,
TU Braunschweig
S. Havemann, GML
24
4. Make edge kill ring
Rings: trim polygons in face interior
 Rings are cw oriented

V-E+F = 2(S-H)+R
0 -1+0 = 2(0- 0)-1
Computer Graphics,
TU Braunschweig
S. Havemann, GML
25
5. Make face kill ring hole
(or make face shell kill ring)
Ring
Backside of
two-sided quad
V-E+F = 2(S-H)+R
0 -0+1 = 2(0+1)
2(1- 0) -1
Computer Graphics,
TU Braunschweig
S. Havemann, GML
26
6./7. Geometric operators
moveV
sharpE
change vertex position
change edge sharpness
Both are self inverse
 Don’t affect topology

Computer Graphics,
TU Braunschweig
S. Havemann, GML
27
Euler Macros

Log each Euler operator  operator sequence


Like split sequence from progressive triangle mesh
But may also contain destructive operators!
Dependencies between operators: DAG
 But: Inconsistent intermediate meshes
 Euler macros: grouping of sub-sequences
  Dependency DAG on Euler macro level
 Useful for selective undo/redo,
 Useful for macro culling using active tree

[ Luebke/Eriksson, Siggraph 97 ]
Computer Graphics,
TU Braunschweig
S. Havemann, GML
28
Euler Macros

Log each Euler operator  operator sequence



Like split sequence from progressive triangle mesh
May also contain destructive operators
Edge collapse: killEF, killEF, killEV, moveV
Computer Graphics,
TU Braunschweig
S. Havemann, GML
29
C++ API: obvious & simple
Edge* makeVEFS
bool killVEFS
Edge* makeEV
(const
const
(Edge*
(Edge*
bool
Edge*
bool
Edge*
Edge*
bool
bool
bool
bool
killEV
makeEF
killEF
makeEkillR
killEmakeR
makeFkillRH
killFmakeRH
moveV
sharpE
(Edge*
(Edge*
(Edge*
(Edge*
(Edge*
(Edge*
(Edge*
(Edge*
(Edge*
bool
bool
moveR
materialF
(Edge* eRing, Edge* eDest);
(Edge* e, int matid);
Computer Graphics,
TU Braunschweig
Vec3f& p0,
Vec3f& p1, bool sharp);
e);
e0, Edge* e1, bool sharp,
const Vec3f& p);
e);
e0, Edge* e1, bool sharp);
e);
eRing, Edge* eFace, bool sh);
e);
eRing);
eRing, Edge* eBase);
e, const Vec3f& pNew);
e, bool sharp);
S. Havemann, GML
30
Top Layer:
The GML
Proposal for a
“smallest common denominator”
for the description of procedural shapes
Computer Graphics,
TU Braunschweig
S. Havemann, GML
31
Stack Based Language: Principle
Tokens are pushed on a stack (old pocket calculator)
 Operators pop items from the stack,
process them, and push the result

2 3 add 4 mul
Program
20 Stack
2
3
5
4
2
5
Programs are just arrays of tokens
 Program execution is execution of each token

Computer Graphics,
TU Braunschweig
S. Havemann, GML
32
GUI Automation
Problem with great tools: You must use them
 Basic idea for automatization:
Put a language behind the GUI

Screenshot from
3DStudio Max

The dialog box turns into
10.00 2.80 0.25 5 2 1 createCube

Ideally, this language backend is invisible
Computer Graphics,
TU Braunschweig
S. Havemann, GML
33
Automation of Dialog Boxes

Different sets of parameters are possible:
10.00 2.80 0.25 5 2 1 createCube
{ 10.00 2.80 0.25 5 2 1 } /wall def
{ 10.00 0.10 0.10 8 1 1 } /rod def
New
{ menu
1.00 items
1.00 1.00 2 2 2 } /unitcube def
wall createBox
rod createBox

Parameter sets can be computed (spreadsheet)
{ dup dup 1 1 1 } /cube def
4.82 cube createBox
Computer Graphics,
TU Braunschweig
S. Havemann, GML
34
All Functionality from Operators

Example:
Stable extrude, avoiding self-intersections
Computer Graphics,
TU Braunschweig
S. Havemann, GML
35
All Functionality from Operators

Example:
Stable extrude, avoiding self-intersections
Computer Graphics,
TU Braunschweig
S. Havemann, GML
36
C++ API for GML operators
class GMLOpCross : public GMLOp
{
public:
GMLOpPrelude(Cross,cross)
GMLOpComment(" u:P3 v:P3 -> w:P3 %n returns the
cross product of u and v, so w is perpendicular
to both u and v.")
};
virtual bool apply (GMLInterpreter& inter) {
Var* v1 = inter.pop_stack();
Var* v0 = inter.pop_stack_leave();
if(inter.error() || !v0isP3() || !v1isP3()) {
return inter.setError(GMLInterpreter::TypeError);
}
v0->set( v0asP3().cross(v1asP3()) );
inter.commit_pop();
return true;
}
wrapped library function
Computer Graphics,
TU Braunschweig
S. Havemann, GML
37
Modeling Engine
The GML is a library on top of OpenGL
 Designed as plugin modeler
– or modeling plugin
 Extensible etc.

Computer Graphics,
TU Braunschweig
S. Havemann, GML
38
Current State
Four-layer architecture works reasonably stable
and with reasonable performance
 The core engine for modeling is available
PhD
 ~290 operators in 10 libraries today



core, math, vector, geometry, brep, modeling, …
Tutorial just finished, first students work with it

http://graphics.tu-bs.de/gml
Computer Graphics,
TU Braunschweig
S. Havemann, GML
39
GML: Interactive 3D Modeling

Spreadsheet modeler: Code generation in background





Create new tools out of existing ones
Re-use existing solutions to modeling problems
Automated 3D modeling
Model evaluation on the fly
Direct manipulation of a multiresolution mesh




Model representation: Combined BRep
Both polygonal and subdivision surface models using
smooth and sharp edges
Undo/redo using Euler operations
Built-in adaptive Level-of-Detail (frame to frame!)
Computer Graphics,
TU Braunschweig
S. Havemann, GML
40
Next steps





“Spreadsheet Modeler”
Experiments with input devices:
Video tracking, CAVE
3D GUI is needed for certain plugins (ActiveX)
modeling tools in digital library, web access
Future developer hierarchy




C++ level:
create new GML operators (.dll)
GML level:
domain-specific modeling tools (.genmod)
Spreadsheet level: Glue tools together, forming new tools
Pure users (code completely hidden)
Computer Graphics,
TU Braunschweig
S. Havemann, GML
41
Summary & Discussion

GML code generation in background

Think of Postscript printer driver

Modeling: Create new tools out of existing ones,
re-use existing solutions to modeling problems
Style libraries: GML is a functional language!
Automated 3D modeling
Semantic level of detail

Store tools used, not model created



 More space efficient

Model evaluation on the fly
Computer Graphics,
TU Braunschweig
S. Havemann, GML
42
Summary
Procedural Modeling uses high-level tools for
(interactive) model manipulation
 Idea: Store tools used, not model created

 More space efficient
Computers are fast: Evaluate model description
only on demand – at viewer runtime!
 GML as low-level description format for all
kinds of procedural models – really?

Computer Graphics,
TU Braunschweig
S. Havemann, GML
43
More fundamental issues
Different ways
to think about shape?
Computer Graphics,
TU Braunschweig
S. Havemann, GML
44
Theoretical Aspects: Shape Complexity






Kolmogorov complexity:
“Given a bit sequence and a computer model, what is
the size of the smallest computer program to produce
that sequence?”
Depends on the set of available basic operations
Intrinsic Shape Parameters:
Explicitly depend on other parameters, are computed
Extrinsic Shape Parameters: Degrees of freedom
Conversion: In both directions?
We propose as shape complexity measure:
The number of GML tokens for a shape / shape class
Computer Graphics,
TU Braunschweig
S. Havemann, GML
45
Quest for the “Nature of Shape”

Investigate existing real-world construction systems
to determine their modeling vocabulary:








Lego
Fischer-Technik
Metal construction kits (z.B. Märklin)
Ikea
Architecture, Mechanical Engineering…
Which are the domain dependent modeling operations?
Is it possible to find underlying set of general shape
construction operations?
Now formally in GML terms:
“Find minimal but sufficient set of builtin operators”
Computer Graphics,
TU Braunschweig
S. Havemann, GML
46