Download presentation source

Download Report

Transcript Download presentation source

CS 551 / 645:
Introductory Computer Graphics
Level of Detail
David Luebke
7/27/2016
Recap: Ray Casting

An example:
Eyepoint
David Luebke
Screen
Scene
7/27/2016
Recap: Recursive Ray Tracing

Obvious extension:
– Spawn additional rays off reflective surfaces
– Spawn transmitted rays through transparent
surfaces

Leads to recursive
ray tracing
Secondary Rays
Primary Ray
David Luebke
7/27/2016
Recap: Ray Tracing

Ray tracing is simple
– No clipping, perspective projection matrices, scan
conversion of polygons

Ray tracing is powerful
– Hidden surface problem
– Shadow computation
– Reflection/refraction

Ray tracing is slow
– Complexity proportional to # of pixels
– Typical screen ~ 1,000,000 pixels
– Typical scene « 1,000,000 polygons
David Luebke
7/27/2016
Reacp: Basic Algorithm
Color TraceRay(Ray R)
if rayHitsObjects(R) then
Color localC, reflectC, refractC;
Object O = findNearestObject(R);
localC = shade(O,R);
Ray reflectedRay = calcReflect(O,R)
Ray refractedRay = calcRefract(O,R)
reflectC = TraceRay(reflectedRay);
refractC = TraceRay(refractedRay);
return localC  reflectC  refractC
else return backgroundColor
David Luebke
7/27/2016
Recap: Shadow Rays

Simple idea:
– Where a ray intersects a surface, send a shadow
ray to each light source
– If the shadow ray hits any surface before the light
source, ignore light

Some problems with using shadow rays as
described:
– Lots of computation
– Infinitely sharp shadows
– No semitransparent object shadows
David Luebke
7/27/2016
Recap:
Accelerating Ray Tracing




Bounding volumes
Spatial partitions
Reordering ray intersection tests
Optimizing intersection tests
David Luebke
7/27/2016
Level of Detail




Problem: even after visibility, model may
contain too many polygons
Idea: reduce complexity further by managing
level of detail (LOD)
A.k.a. multiresolution modeling
A.k.a. polygonal simplification
– My favorite term
David Luebke
7/27/2016
Level of Detail

Polygonal simplification methods simplify the
polygonal geometry of small or distant
objects
David Luebke
7/27/2016
Traditional Approach
50 Vertices
500 Vertices
2000 Vertices
Model courtesy of InfoGraphica
Traditional Approach

Create levels of detail (LODs) of each object
in a preprocess:
50 Vertices
David Luebke
500 Vertices
2000 Vertices
Model courtesy of InfoGraphica 7/27/2016
Traditional Approach

David Luebke
Distant objects use coarser LODs:
7/27/2016
Traditional Approach

Traditional LOD in a nutshell:
– Create LODs for each object separately in a
preprocess
– At run-time, pick each object’s LOD according to
the object’s distance
(or similar criterion)

Since LODs are created offline at fixed
resolutions, I refer to this as static LOD
David Luebke
7/27/2016
Creating LODs

Q: How might we create LODs of a polygonal
object?
– SubQ: How might we generate a version of the
object with fewer polygons?
– SubQ: What criteria might we try to preserve in
the simplified object?
David Luebke
7/27/2016
Creating LODs

SubQ: How might we generate a version of
the object with fewer polygons?
– A: Four basic mechanisms:




David Luebke
Sample-and-reconstruct
Decimation
Vertex-merging
Adaptive subdivision
7/27/2016
Creating LODs: Mechanism

Sample and reconstruct
– Scatter surface with sample points, then recreate
using fewer sample points than original surface
had vertices
– Q: Where to put the sample points?
– One answer: scatter at random, then let them
repel each other
– Q: How to recreate surface from samples?
– A: Good question! (open, hot topic)
David Luebke
7/27/2016
Creating LODs: Mechanism

Decimation
– Iteratively remove faces or vertices,
retriangulating hole created in current surface
during the process (draw it)
– Triangulation: well understood problem

Commonest algorithm: Loop splitting
– Q: How to pick which face/vertex to remove?
– A: What are we trying to preserve?
David Luebke
7/27/2016
Creating LODs: Mechanism

Vertex merging
– Collapse multiple vertices together and remove
degenerate triangles
– Edge collapse: Specific form of vertex merge
operating on exactly two vertices that share an
edge


David Luebke
Q: How many triangles will this remove?
Q: Why might this be preferable? Why not?
7/27/2016
Creating LODs: Mechanism

Adaptive subdivision
– Create a very simple base model that represents
the model
– Selectively subdivide faces of base model until
fidelity criterion met (draw)
– Q: Why might this be hard?
– Q: Why might this not simplify model?
– Big potential application: multiresolution modeling
David Luebke
7/27/2016
Creating LODs

SubQ: What criteria might we try to preserve
in the simplified object?
– A: Generally, its visual appearance
– But this is hard to quantify


Imperfectly understood visual system
Very computationally intensive
– Often settle for geometric criteria like:


David Luebke
Distance from old surface to new surface
Volume swept out by displaced surface
7/27/2016
Algorithm 1:
Vertex Clustering



Rossignac and Borrel, 1992
Apply a uniform 3D grid to the object
Collapse all vertices in each grid cell to single
most important vertex, defined by:
– Curvature (1 / maximum edge angle)
– Size of polygons (edge length)

Filter out degenerate polygons
David Luebke
7/27/2016
Vertex Clustering

Resolution of grid determines degree of
simplification
– Coarse grid  lots of simplification
– Fine grid  little simplification

Representing degenerate triangles
– Edges  use OpenGL line primitive
– Points  use OpenGL point primitive
David Luebke
7/27/2016
Vertex Clustering

Low and Tan, 1997
– Refinement of Rossignac-Borrel



David Luebke
Use cos(max edge angle/2) for curvature
Floating-cell clustering
Thick lines and dynamic shading
7/27/2016
Vertex Clustering

Pros
– Fast, very fast
– Robust (topology-insensitive)

Cons
– Difficult to specify simplification degree
– Low fidelity (topology-insensitive)
– Underlying grid creates sensitivity to model
orientation in Rossignac-Borrel
David Luebke
7/27/2016
Vertex Clustering

Rossignac-Borrel examples:
10,108 polys 1,383 polys
David Luebke
Courtesy IBM
474 polys
46 polys
7/27/2016
Algorithm 2:
Decimation

The algorithm: multiple passes over all model
vertices
– Consider each vertex for deletion



David Luebke
Characterize local geometry/topology
Evaluate criteria & possibly delete vertex with
surrounding triangles
If deleted, triangulate resulting hole
7/27/2016
Decimation Issues


Characterizing vertices
Decimation criteria
– Simple vertices: distance to plane
– Boundary & edge vertices: distance to edge

Triangulating holes: loop splitting
David Luebke
7/27/2016
Algorithm 3:
Edge Collapses
V2
Collapse
V1
V2
Edge Collapse Benefits


Edge collapse operation is simple
Supports non-manifold topology:
David Luebke
7/27/2016
Edge Collapse vs.
Vertex-Pair Merging

Even better: vertex-pair merging merges two
vertices that:
– Share an edge, or
– Are within some threshold distance t

Q: What does vertex-pair merging enable
over edge collapse?
David Luebke
7/27/2016
Edge-Collapse Issues:
Preventing Mesh Inversion

Preventing foldovers:
7
8
8
2
2
10
A
9
3


A
9
5
6
3
merge
1
4
10
6
4
5
Calculate the adjacent face normals, then
test if they would flip after simplification
If so, that simplification can be weighted
heavier or disallowed.
David Luebke
7/27/2016
Dynamic LOD

Recall definition of static LOD: LODs are
created offline at fixed resolution
– Simplest programming model; decouples
simplification and rendering


LOD creation need not address real-time rendering constraints
Run-time rendering need only pick LODs
– Fits modern graphics hardware well


David Luebke
Can compile each LOD into triangle strips and display
lists
These render much faster than unorganized polygons
on today’s hardware
7/27/2016
Dynamic Level of Detail

A relatively recent departure from the
traditional static approach:
– Static LOD: create individual LODs in a
preprocess
– Dynamic LOD: create data structure from which
any desired level of detail can be extracted at run
time.
David Luebke
7/27/2016
Advantages of
Dynamic LOD




Better granularity  better fidelity
Better granularity  smoother transitions
Supports progressive transmission
Supports view-dependent LOD
– Use current view parameters to select best
representation for the current view
– Single objects may thus span several levels of
detail
David Luebke
7/27/2016
View-Dependent LOD:
Examples

Show nearby portions of object at higher
resolution than distant portions
View from eyepoint
David Luebke
Birds-eye view
7/27/2016
View-Dependent LOD:
Examples

Show silhouette regions of object at higher
resolution than interior regions
David Luebke
7/27/2016
Dynamic LOD:
How Does It Work?


So…dynamic LOD is great, but how do we
implement it?
Basically, with one big data structure: the
vertex tree
– Represents the entire model
– Hierarchy of all vertices in model
– Queried each frame for updated scene
David Luebke
7/27/2016
The Vertex Tree

Each vertex tree node contains:
– A subset of model vertices
– A representative vertex or repvert


Folding a node collapses its vertices to the
repvert
Unfolding a node splits the repvert back into
vertices
David Luebke
7/27/2016
Vertex Tree Example
8
7
R
2
I
10
II
6
9
3
10
1
A
1
4
7
4
5
C
6
8
3
9
5
Triangles in active list
David Luebke
2
B
Vertex tree
7/27/2016
Vertex Tree Example
8
7
R
2
A
I
10
II
6
9
3
10
1
A
1
4
7
4
5
C
6
8
3
9
5
Triangles in active list
David Luebke
2
B
Vertex tree
7/27/2016
Vertex Tree Example
8
R
A
I
10
II
6
9
3
10
A
1
4
7
4
5
C
6
8
3
9
5
Triangles in active list
David Luebke
2
B
Vertex tree
7/27/2016
Vertex Tree Example
8
R
A
I
10
II
6
9
3
10
B
4
1
2
B
7
4
5
C
6
8
3
9
5
Triangles in active list
David Luebke
A
Vertex tree
7/27/2016
Vertex Tree Example
8
R
A
I
10
9
II
3
10
B
Triangles in active list
David Luebke
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
8
R
A
C
9
I
10
II
3
10
B
Triangles in active list
David Luebke
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
R
A
C
I
10
II
3
10
B
Triangles in active list
David Luebke
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
R
A
C
II
I
10
II
3
10
B
Triangles in active list
David Luebke
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
R
A
II
I
10
10
B
Triangles in active list
David Luebke
II
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
R
A
I
II
I
10
10
B
Triangles in active list
David Luebke
II
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
R
I
II
I
10
B
Triangles in active list
David Luebke
II
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
R
I
II
I
II
R
10
B
Triangles in active list
David Luebke
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
R
I
II
R
10
A
1
Triangles in active list
David Luebke
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
The Vertex Tree:
Tris and Subtris
8
8
7
Fold Node A
2
A
10
10
6
9
1
4
6
9
3
3
Unfold Node A
5
4
5
Node->Tris: triangles that change shape upon folding
Node->Subtris: triangles that disappear completely
David Luebke
7/27/2016
The Vertex Tree:
Tris and Subtris


Each node’s tris and subtris can be
computed offline to be accessed very quickly
at run time
This is the key observation behind dynamic
simplification
David Luebke
7/27/2016
Gaze-Directed Rendering

View-dependent rendering opens up a new
door: gaze-directed rendering
– Track the user’s eye gaze
– Give more detail to region of interest, less
elsewhere
David Luebke
7/27/2016
Gaze-Directed Rendering:
ERICA


Problem 1: how to do eye tracking?
Answer ERICA project (Systems
Engineering, Tom Hutchinson P.I.)
– Infrared camera sits under/near monitor, watches
user’s eye
– LED in center of camera lens creates glint and
glare (=redeye)
– Relation of the two gives eye position
David Luebke
7/27/2016
Gaze-Directed Rendering:
Perceptual Science

Problem 2: how to degrade detail?
– Want a rigorous solution, not a hack
– Goal 1: Imperceptible LOD


Idea: use findings from perceptual physiology
Map contrast gratings to nodes in tree, only fold nodes
when gratings are imperceptible
– Goal 2: better LOD, with an understanding of
degradation effects
David Luebke
7/27/2016