CSL 859: Advanced Computer Graphics - PowerPoint PPT Presentation

About This Presentation
Title:

CSL 859: Advanced Computer Graphics

Description:

if 4 supporting vertices touch the sphere. Test also: degenerate case of 2 or 3 vertices ... 6-dop. Fitting OBBs statistically. Sample the convex hull of the geometry ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 79
Provided by: sub8
Category:

less

Transcript and Presenter's Notes

Title: CSL 859: Advanced Computer Graphics


1
CSL 859 Advanced Computer Graphics
  • Dept of Computer Sc. Engg.
  • IIT Delhi

2
Basic Depth Visibility
  • Z-buffer
  • Linear in pixel and geometry complexity
  • Front to back
  • Back to front
  • Depth sorting
  • Want to cull groups
  • Of pixels
  • Hiererchical Z-buffer
  • Of primitives
  • Occlusion Culling

3
View-Frustum Visibility
  • Clipping
  • Scissoring
  • Culling

4
Clipping
  • Clip with each boundary
  • Out from In
  • Output Intersection
  • In from Out
  • Output Intersection
  • Output Vertex
  • Out from Out
  • Discard
  • In from In
  • Output Vertex

x 1
x-1
5
Clipping
  • Clip with each boundary
  • Out from In
  • Output Intersection
  • In from Out
  • Output Intersection
  • Output Vertex
  • Out from Out
  • Discard
  • In from In
  • Output Vertex

6
Clipping
  • Clip with each boundary
  • Out from In
  • Output Intersection
  • In from Out
  • Output Intersection
  • Output Vertex
  • Out from Out
  • Discard
  • In from In
  • Output Vertex

7
Clipping
  • Clip with each boundary
  • Out from In
  • Output Intersection
  • In from Out
  • Output Intersection
  • Output Vertex
  • Out from Out
  • Discard
  • In from In
  • Output Vertex

8
Intersection
v1t v0 (1-t)
x1t x0 (1-t) -1 t (1x0)/(x0-x1) y y1t
y0 (1-t)
v1
v0
x-1
9
Homogeneous Space Clipping
  • Clip coordinates projective coordinates
  • -1 lt x/z lt 1 (after perspective divide)
  • -1 lt x/w lt 1 (clip)
  • -w lt x lt w
  • -w lt y lt w
  • 0 lt z lt w

10
View-frustum Culling
  • Project all vertices
  • Then cull

11
Group Culling
  • Cull in World space

12
Group Culling
  • Cull in World space
  • Group polygons
  • Cull groups
  • Plane test

13
Groups
  • Bounding volume hierarchies
  • Bounding sphere
  • Axis-aligned bounding boxes (AABB)
  • Oriented bounding boxes (OBB)
  • Discrete oriented planes (k-DOPs)
  • Spatial Partitioning
  • Octrees
  • Binary space partition tree

14
Hierarchies
Sphere AABB OBB kDOP
15
Bounding Sphere Computation
16
Bounding Sphere Computation
  • Propose a center
  • Find radius that includes all vertices
  • Minimal volume obtained
  • if 4 supporting vertices touch the sphere
  • Test also degenerate case of 2 or 3 vertices
  • Start with sphere through 2 vertices
  • Test inclusion of other vertices in sequence
  • If v is outside
  • Compute new sphere also supported by v
  • Restart if a previously included vertex is
    outside this new sphere

17
AABB Computation
  • Extrema along each primary axis

18
OBB Computation
  • One face and one edge of convex polyhedron are
    part of OBB
  • OR
  • Three edges of the convex polyhedron form part of
    the OBB

19
Separating Axis Theorem
  • Disjoint convex polyhedrons, A and B, are
    separated along at least one of
  • An axis orthogonal to a face of A
  • An axis orthogonal to a face of B
  • An axis formed from the cross product of one edge
    from each of A and B

20
SAT example Triangle/Box
  • Box is axis-aligned
  • 1) test the axes that are orthogonal to the faces
    of the box
  • That is, x,y, and z

21
Triangle/Box with SAT
  • Assume that they overlapped on x,y,z
  • Must continue testing
  • 2) Axis orthogonal to face of triangle

22
Triangle/Box with SAT
  • If separating axis still not found
  • 3) Test axis tebox x etriangle
  • Example
  • x-axis from box ebox(1,0,0)
  • etrianglev1-v0
  • Test all such combinations
  • If there is at least one separating axis, then
    the objects do not intersect
  • Otherwise they do

23
Hierarchical Culling
  • Test for a group
  • If outside frustum
  • Cull
  • If inside frustum
  • Display
  • Otherwise,
  • Subdivide group into smaller groups
  • Recurse for each group

24
BVH vs. Spatial Partitioning
  • BVH SP
  • - Object centric - Space centric
  • - Spatial redundancy - Object redundancy

25
BVH vs. Spatial Partitioning
  • BVH SP
  • - Object centric - Space centric
  • - Spatial redundancy - Object redundancy

26
BVH vs. Spatial Partitioning
  • BVH SP
  • - Object centric - Space centric
  • - Spatial redundancy - Object redundancy

27
BVH vs. Spatial Partitioning
  • BVH SP
  • - Object centric - Space centric
  • - Spatial redundancy - Object redundancy

28
Spatial Data Structures Subdivision
  • Many others

29
Uniform Spatial Subdivision
  • Decompose the objects (the entire simulated
    environment) into identical cells arranged in a
    fixed, regular grids (equal size boxes or voxels)
  • To represent an object, only need to decide which
    cells are occupied. To perform collision
    detection, check if any cell is occupied by two
    object
  • Storage to represent an object at resolution of
    n voxels per dimension requires upto n3 cells
  • Accuracy solids can only be approximated

30
Octrees
  • Quadtree is derived by subdividing a 2D-plane
    in both dimensions to form quadrants
  • Octrees are a 3D-extension of quadtree
  • Use divide-and-conquer
  • Reduce storage requirements (in comparison to
    grids/voxels)

31
Bounding Volume Hierarchies
  • Model Hierarchy
  • Each node has a simple volume that bounds a set
    of triangles
  • Children contain volumes that each bound a
    different portion of the parents triangles
  • A binary bounding volume hierarchy

32
Designing BVH
  • It should fit the original model as tightly as
    possible
  • Testing two such volumes for overlap should be as
    fast as possible
  • It should require the BV updates as infrequently
    as possible

33
Observations
  • Simple primitives (spheres, AABBs, etc.) do very
    well with respect to the second constraint. But
    they cannot fit some long skinny primitives
    tightly.
  • More complex primitives (minimal ellipsoids,
    OBBs, etc.) provide tight fits, but checking for
    overlap between them is relatively expensive.
  • Cost of BV updates needs to be considered.

34
Trade-off in Choosing BVs
  • increasing complexity tightness of fit
  • decreasing cost of (overlap tests BV update)

35
Fitting OBBs statistically
  • Sample the convex hull of the geometry
  • Find the mean and covariance matrix of the
    samples
  • The mean will be the center of the box
  • The eigenvectors of the covariance matrix are the
    principal directions axes
  • The principle directions tend to align along the
    longest axis, then the next longest that is
    orthogonal, and then the other orthogonal axis

36
Principal Components
37
Back-face Culling
Sphere
Half the sphere is not visible
38
Polygonal Backfacing?
39
Polygon Groups
40
Hierarchical Back-face Culling
  • Cluster proximate polygons
  • Keep orientations similar too
  • For a group, find the half-space intersection
  • If the eye lies in the common HS
  • Cull group
  • Coherence in traversal
  • Subdivide half-space into partitions
  • Query which partition eye lies in

41
Back-Patch Culling
p.n gt e.n for all p
c-e.n gt rn
42
Back-patch Visibility
p
n
e
43
Back-Patch Culling
  • Create bounding volume for object
  • Compute planes tangent to volume
  • passing through eye
  • Compute half-space intersection of these planes
  • Compute bounding cone of normals of the object
  • If normal cone lies in common half-space
  • Cull Object

44
Silhouettes
  • Edges between front and back faces
  • Simple hack
  • Render the front-facing polygons
  • Render the back-facing polygons (in black)
  • A common edge gets over-written
  • Render them as wide lines?
  • Offset backfaces closer?

45
Results
  • Wireframe Translation Fattening

46
Exact Silhouettes
  • For each edge check two adjacent faces
  • Can compute hierarchically
  • If an entire group front or back facing
  • Discard
  • Otherwise
  • Subdivide
  • But consider boundaries between groups

47
Notion of Duality
  • Dual of plane ax by cz 1 0 is
  • point (a, b, c)
  • And Dual of a point is a plane
  • If point v is in ve half-space of plane P
  • Dual(P) is in ve half-space of Dual (v)
  • Dual of edge e between faces f1 and f2 is
  • edge Dual(plane(f1))-Dual(plane(f2))

48
Dual Approach
  • Geometric duals
  • silhouette-edge duals cross the view-point dual
    (plane)
  • Coherence
  • consecutive view-planes form a wedge
  • Edge crossing the wedge is a silhouette update

49
Duality
f1
p1
50
Duality
f1
O
p1
p2
51
Silhouette Update
View-plane
6
4
1
7
2
3
5
52
Silhouette Algorithm Details
  • Double-wedge point location query
  • Partition space
  • Octree, BAR-tree
  • If region intersected by wedge
  • recur

53
Silhouette Algorithm Details
Lin
Lout
Adj Container
Tree Region
Double wedge
54
Quiz 5
  1. Explain how quadric error is used for mesh
    simplification.
  2. Define Mean curvature and Gaussian curvature of a
    surface.

55
Cells Portals
  • Goal walk through architectural models
    (buildings, cities, catacombs)
  • These divide naturally into cells
  • Rooms, alcoves, corridors
  • Transparent portals connect cells
  • Doorways, entrances, windows
  • Cells only see other cells through portals

56
Cells Portals
  • An example

57
Cells Portals
  • Idea
  • Cells form the basic unit of PVS
  • Create an adjacency graph of cells
  • Starting with cell containing eyepoint, traverse
    graph, rendering visible cells
  • A cell is only visible if it can be seen through
    a sequence of portals
  • So cell visibility reduces to testing portal
    sequences for a line of sight

58
Cells Portals
A
D
E
F
C
B
G
H
E
A
B
C
D
F
G
H
59
Cells Portals
A
D
E
F
C
B
G
H
E
A
B
C
D
F
G
H
60
Cells Portals
A
D
E
F
C
B
G
H
E
A
B
C
D
F
G
H
61
Cells Portals
A
D
E
F
C
B
G
H
E
A
B
C
D
F
G
H
62
Cells Portals
A
D
E
F
C
B
G
H
E
A
B
C
D
F
G
H
63
Cells Portals
A
D
E
?
F
C
B
G
H
E
A
B
C
D
F
G
?
H
64
Cells Portals
A
D
E
X
F
C
B
G
H
E
A
B
C
D
F
G
X
H
65
Cells Portals
  • View-independent solution find all cells a
    particular cell could possibly see
  • C can only see A, D, E, and H

A
D
E
H
66
Cells Portals
  • View-independent solution find all cells a
    particular cell could possibly see
  • H will never see F

A
D
E
C
B
G
67
Cells and Portals
  • Factor into View-independent view-dependent
  • Portal-portal visibility line stabbing
  • Linear program Teller 1993
  • Cell-cell visibility stored in stab trees
  • View-dependent eye-portal visibility stage
    further refines PVS at run time
  • Slow pre-process
  • Pointer following at render time

68
Linear Programming
  • Canonical form Find x that
  • Maximizes cT x
  • Objective function
  • subject to Ax lt b
  • -ve constraints
  • where xi gt 0
  • ve constraints

69
Occlusion Query
  • HW mechanism to determining visibility of a set
    of geometry
  • After rendering geometry, query if any of the
    geometry could have or did modify the depth
    buffer.
  • If Query answer is false, geometry could not
    have affected depth buffer
  • If true, it could have or did modify depth
    buffer
  • Ex Render bounding box, Query

70
Occlusion Query
  • Returns pixel count the no. of pixels that pass
  • May issue multiple queries at once before asking
    for the result of any one
  • Applications can overlap the time it takes for
    the queries to return with other CPU work

71
Occlusion Query How to Use
  • (Optional) Disable Depth/Color Buffers
  • (Optional) Disable any other irrelevant state
  • Generate occlusion queries
  • Begin ith occlusion query
  • Render ith (bounding) geometry
  • End occlusion query
  • Do other CPU computation now
  • (Optional) Enable Depth/Color Buffers
  • (Optional) Re-enable any other state
  • Get pixel count of ith query
  • If (count gt MAX_COUNT) render ith geometry

72
Occlusion Query How to Use
  • Generate occlusion queries
  • Gluint queriesN
  • GLuint pixelCount
  • glGenOcclusionQueriesNV(N, queries)
  • Loop over queries
  • for (i 0 i lt N i)
  • glBeginOcclusionQueryNV(queriesi)
  • // render bounding box for ith
    geometry
  • glEndOcclusionQueryNV()

73
Occlusion Query How to Use
  • Get pixel counts
  • for (i 0 i lt N i)
  • glGetOcclusionQueryuivNV(queriesi,
    GL_PIXEL_COUNT_NV,

  • pixelCount)
  • if (pixelCount gt MAX_COUNT)
  • // render ith geometry

74
Incremental Object Culling
  • How valuable is it?
  • Bounding box still must be filled
  • Must Query against something
  • More intelligent queries possible
  • Big win if you use query for object that you were
    going to render in any case
  • Can amortize
  • Skip query for visible objects for the next few
    frames
  • Visible objects of last frame could occlude

75
Incremental Object Culling
  • Useful for multi-pass algorithms
  • Render scene (roughly) from front to back
  • Draw big occluders (walls) first
  • Issue queries for other objects in the scene
  • If query returns 0 in a pass, skip the object in
    subsequent passes
  • Works well if the first pass sets up the depth
    buffer only

76
From Region Visibility
Rest of the Scene
Equivalent center of projection
Occluding Segment
View Segment
77
Visibility From Region in 3D
78
Visibility From Region in 3D
  • Find all supporting planes
  • occluder and occludee in the same half-space
  • Find a COP in that half-space of planes
  • Clip occluders with planes parallel to supporting
    planes
  • Render Scene
  • Render clipped triangles
  • Re-render triangles with occlusion query
Write a Comment
User Comments (0)
About PowerShow.com