Geometric Modeling
CSE 872 Fall 20111
Modeling
•Triangular�Mesh�Basics parameterization parameterization
•Scene-graph•Object�representations B-rep,�CSG
S i l i i
CSE 872 Fall 20112
•Spatial�organizations Octree,�kd-tree,�BSP
How to represent objects/scenes
Polygon�meshesS hScene�graphsParametric�representationsImplicit�surfacesPoint-based method
CSE 872 Fall 20113
Point-based�method
Point Clouds
Discrete�3D�point�set Raw�data�(scanner)( ) Densely�sampled
CAGD�model Point-based�method
Reconstruct�patcheson�demand
CSE 872 Fall 20114
Hidden�point�removal�possible
Polygon Soup
Unstructured�set�up�polygons Just a list of vertices for each Just�a�list�of�vertices�for�each�
polygon Redundant� Usually�transformed�into�
better model before being
CSE 872 Fall 20115
better�model�before�being�used
What is tessellation?
Representing�a�surface�with�flat approximating polygonsflat�approximating�polygons A�sampled�representation
Geometric�Aliasing Error�in�the�representation�due�
t th li ith l
CSE 872 Fall 20116
to�the�sampling�with�polygons
Polygon meshCommon�method�for�describing�geometry
Set�of�vertices Coordinates Normal Texture�coordinates Etc.
CSE 872 Fall 20117
Set�of�faces Pointers�to�vertices Material�properties
Common: Triangle mesh
Polygon Mesh
Retains�shared-vertex�relationshipsrelationships
Vertex a,b,c,d;
Polygon P1(a, b, c);Polygon P2(c, b, d);
a
b
c
d
CSE 872 Fall 20118
yg ( , , );
b,c shared by two polygons
A Common Format: VRML
V R M L
Vertices(geometry)
v1 (x1;y1;z1)
v2 (x2;y2;z2)
v3 (x3;y3;z3)
v4 (x4;y4;z4)
v5 (x5;y5;z5)
Faces(connectivity)
f1 (v1;v3;v2)
f2 (v4;v3;v1)
f3 (v4;v1;v5)
f4 (v1;v6;v5)
f5 (v6;v1;v7)
CSE 872 Fall 20119
v5 (x5;y5;z5)
v6 (x6;y6;z6)
v7 (x7;y7;z7)
f5 (v6;v1;v7)
f6 (v2;v7;v1)
f7 (…)
Valence n: n times in face list average 6
Surface normal
Assume�the�following p3following�polygon:
p
p2
p3
p4
)()(
)()(
1412
1412
pppp
ppppN
N
CSE 872 Fall 201110
p1)()( 1412 pppp
Vertex normals
Add�normals�for�surfaces�incident on vertex:incident�on�vertex:
CSE 872 Fall 201111
Winged-Edge Data Structure
Commonly�used�B-rep Close to half-edge Close�to�half edge
Maintains List�of�vertices List�of�edges List of faces
CSE 872 Fall 201112
List�of�faces Adjacency
Winged-Edge Data Structure
Vertex Incident�Edge
A
Vertex table:
A aB bC eD aFace Incident�
Edge
CSE 872 Fall 201113
Edge1 a2 c3 e4 b
Face table:
Edge TableEdge Vertices Faces Left�Traverse Right�TraverseName Start End Left Right Pred Succ Prec Succc B D 1 2 b a e d
a e
D
c B D 1 2 b a e d
CSE 872 Fall 201114
c
b d
1 2
B
Voxels
Grid�of�volumetric�samples CAT MRI etc CAT,�MRI,�etc. Enumerate�small�cubes�inside
CSE 872 Fall 201115
[HTG03]
Scene GraphsCompositeComposite
SeparatorSeparator SeparatorSeparator SeparatorSeparator
TranslateTranslate
ColorColor ColorColor
TranslateTranslateTranslateTranslate
BarbellE d
BarbellBar
CSE 872 Fall 201116
PolygonPolygon PolygonPolygon…
CompositeComposite
PolygonPolygon PolygonPolygon…
CompositeCompositeEnds
Collapsing a Scene Graph
It’s�often�possible�to�apply�transformations in a scene graphtransformations�in�a�scene�graph�once�to�the�underlying�vertices,�collapsing�some�nodes.��Example:
TranslationTranslation
CSE 872 Fall 201117
RotationRotation
PolygonPolygon
PolygonPolygonCollapse to
Cloning
If�part�of�a�scene�graph�has�two edges to it it will betwo�edges�to�it,�it�will�be�necessary�to�clone�before�collapsing
TranslationTranslationTranslationTranslation TranslationTranslation
CSE 872 Fall 201118
RotationRotation
PolygonPolygon
RotationRotation
PolygonPolygon
RotationRotation
Polygon’Polygon’
Integration of meshes with scene graphs
CompositeComposite
SeparatorSeparator SeparatorSeparator SeparatorSeparator
TranslateTranslate
ColorColor ColorColor
TranslateTranslateTranslateTranslate
BarbellE d
BarbellBar
CSE 872 Fall 201119
PolygonPolygon PolygonPolygon…
CompositeComposite Polygon MeshPolygon MeshEnds
Other possibilities?
SceneGraphs
OpenSGOpenScenGraph OpenScenGraph
Older� OpenGL�Performer Open�InventorP f i
CSE 872 Fall 201120
Part�of�game�engines
Constructive Solid Geometry
Composite�(scene�graph)->Boolean�OperationsBoolean�Operations
Union,�Intersection,�Subtraction
• Usually�in�tree�structure�(with�instancing)
CSE 872 Fall 201121
[Pictures from Prof. Shene’s webpage http://www.cs.mtu.edu/~shene]
Bounding Boxes
AABB�tree�vs�OBB�treeBounding Sphere Bounding�Sphere
CSE 872 Fall 201122
[Cybercreations.com] [Gottschalk et al]
Levels of Detail
Alternative�scene�graphs�with�different resolutionsdifferent�resolutions varying�tessellation Progressive�mesh,�subdivision
distance,�viewing�directionf h t
CSE 872 Fall 201123
performance�enhancement
Spatial Organization
•Hierarchical�Bounding�Box�Tree•Spatial Indexing or Partitioning•Spatial�Indexing�or�Partitioning Going�from�x,y,z�to�Objects
Sometimes,�with�a�viewing�direction BSP�(k-d�tree,�octree) Applications�
lli i d t ti ti l t
CSE 872 Fall 201124
collision�detection,�particle�systems,�user�interaction,�raytracing,�painter’s�algorithm…
Sample application
CSE 872 Fall 201125
[Govindaraju et al. 05]
BSP Trees
Partition space into 2 half-spaces via a hyper-plane
Binary Space Partitioning
a
b
c
e
a
cb
e d
CSE 872 Fall 201126
d
BSP Trees
Advantages DisadvantagesAdvantages
view-independent tree
anti-aliasing
transparency
Disadvantages
many, small polygons
over-rendering
hard to balance tree
CSE 872 Fall 201127
Painter’s Algorithm
Farthest z extent is insufficientCannot resolve dependency cycles
top
CSE 872 Fall 201128
front
k-d Trees
k�is�dimensionsN dNode Info x,�y lt-link
CSE 872 Fall 201129
ge-link
Levels
Level�0�– Index�X Level�1�– Index�Y
Level�2�– Index�X
level�=�0�if�root,�level(parent)+1�otherwise
For�each�level,�index:��level�mod�k
CSE 872 Fall 201130
3D:��Index�X,�Index�Y,�Index�Z,�Index�X,�etc…
Example
Banja�Luca�(19,�45)Derventa (40 50)
Banja Luca (19, 45)Banja Luca (19, 45)
Derventa (40, 50)Derventa (40, 50)Sinj (4, 4)Sinj (4, 4)
X
Y
Derventa�(40,�50)Teslic�(38,�38)Tuzla�(54,�40)Sinj�(4,�4)
Teslic (38, 38)Teslic (38, 38)
Tuzla (54, 40)Tuzla (54, 40)
X
Y
CSE 872 Fall 201131
Insert: East Broko (21, 57)Search for exact?Search for nearest?Range searches?
k-d Trees
Search�for�exact Okay but may be o(k) Okay,�but�may�be�o(k)
Search�for�nearest In�a�moment
Range search?
CSE 872 Fall 201132
Range�search?
Range SearchConsider�each�tree�level�to�be�regionRecursively�search�all�regions�that�overlap�Recursively�search�all�regions�that�overlap�
search�range
CSE 872 Fall 201133
Example Regions
B j L (19 45)B j L (19 45)( +) ( +) Banja Luca (19, 45)Banja Luca (19, 45)
Derventa (40, 50)Derventa (40, 50)
Teslic (38, 38)Teslic (38, 38)
Sinj (4, 4)Sinj (4, 4)
(-,+) (-,+)
(-,19) (-,+) [19,+) (-,+)
[19,+) (-,50) East Broko (21, 57)East Broko (21, 57)
[19,+) [50,+)
CSE 872 Fall 201134
Tuzla (54, 40)Tuzla (54, 40) [38,+) (-,50)
Range: (10,20) (20, 45)
k-d Trees
Fast�and�easyT d t b th t llTend�to�be�rather�tall�(unbalanced)
How�could�we�extend�to�disk�structure?
CSE 872 Fall 201135
What�if�k=1?
Quadtrees
2-d�onlyS lit d t 4Split�data�4�waysNode: info x,y
CSE 872 Fall 201136
,y nw,sw,ne,se
Example
• Banja Luca (19, 45)
• Derventa (40, 50)
Banja Luca (19, 45)Banja Luca (19, 45)
Derventa (40, 50)Derventa (40, 50)Sinj (4, 4)Sinj (4, 4)
ne senw
Derventa (40, 50)
• Teslic (38, 38)
• Tuzla (54, 40)
• Sinj (4, 4)
Teslic (38, 38)Teslic (38, 38)
Tuzla (54, 40)Tuzla (54, 40)
se
Insert: East Broko (21, 57)
CSE 872 Fall 201137
Search for exact?Search for nearest?Range searches?
Octtrees
3-dS lit d t 8Split�data�8�waysNode: info x,y,z
CSE 872 Fall 201138
,y, up�nw,sw,ne,se,�down�
nw,sw,ne,se