Loading in 5 sec....

CSL 859: Advanced Computer GraphicsPowerPoint Presentation

CSL 859: Advanced Computer Graphics

- 186 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about 'CSL 859: Advanced Computer Graphics' - triage

**An Image/Link below is provided (as is) to download presentation**

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

BVH vs. Spatial Partitioning

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

- Of pixels

View-Frustum Visibility

- Clipping
- Scissoring

- Culling

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

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

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

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

Homogeneous Space Clipping

- Clip coordinates = projective coordinates
- -1 < x/z < +1 (after perspective divide)
- -1 < x/w < +1 (clip)
- -w < x < w
- -w < y < w
- 0 < z < w

View-frustum Culling

- Project all vertices
- Then cull

Group Culling

- Cull in World space

Group Culling

- Cull in World space
- Group polygons
- Cull groups
- Plane test

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

Hierarchies

Sphere AABB OBB kDOP

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

- if 4 supporting vertices touch the sphere
- 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

AABB Computation

- Extrema along each primary axis

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

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

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

Triangle seen from side

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

Triangle/Box with SAT

- If separating axis still not found…
- 3) Test axis: t=ebox x etriangle
- Example:
- x-axis from box: ebox=(1,0,0)
- etriangle=v1-v0

- Test all such combinations
- If there is at least one separating axis, then the objects do not intersect
- Otherwise they do

Hierarchical Culling

- Test for a group
- If outside frustum
- Cull

- If inside frustum
- Display

- Otherwise,
- Subdivide group into smaller groups
- Recurse for each group

BVH vs. Spatial Partitioning

BVH: SP:

- Object centric - Space centric

- Spatial redundancy - Object redundancy

BVH vs. Spatial Partitioning

BVH: SP:

- Object centric - Space centric

- Spatial redundancy - Object redundancy

BVH vs. Spatial Partitioning

BVH: SP:

- Object centric - Space centric

- Spatial redundancy - Object redundancy

BVH: SP:

- Object centric - Space centric

- Spatial redundancy - Object redundancy

Quadtree/Octree

kd-tree

BSP-tree

Spatial Data Structures & Subdivision- Many others……

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”

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)

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 parent’s triangles

- A binary bounding volume hierarchy:

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

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.

AABB

OBB

Sphere

6-dop

Trade-off in Choosing BV’sincreasing complexity & tightness of fit

decreasing cost of (overlap tests + BV update)

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

Polygonal Backfacing?

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

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

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?

Results

Wireframe Translation Fattening

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

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))

“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

Silhouette Algorithm Details

- Double-wedge point location query
- Partition space
- Octree, BAR-tree

- If region intersected by wedge
- recur

Quiz 5

- Explain how quadric error is used for mesh simplification.
- Define Mean curvature and Gaussian curvature of a surface.

Cells & Portals

- Goal: walk through architectural models (buildings, cities, catacombs)
- These divide naturally into cells
- Rooms, alcoves, corridors…

- Transparent portalsconnect cells
- Doorways, entrances, windows…

- Cells only see other cells through portals

Cells & Portals

- An example:

Cells & Portals

- Idea:
- Cells form the basic unit of PVS
- Create an adjacency graphof 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…

D

E

F

B

C

G

H

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

D

E

F

B

C

G

H

Cells & Portals- View-independent solution: find all cells a particular cell could possibly see:
H will never see F

A

D

E

B

C

G

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

- Linear program [Teller 1993]

Linear Programming

- Canonical form: Find x that
- Maximizes cT x
- Objective function

- subject to Ax <= b
- -ve constraints

- where xi>= 0
- +ve constraints

- Maximizes cT x

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

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

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 > MAX_COUNT) render ith geometry

Occlusion Query: How to Use

- Generate occlusion queries
Gluint queries[N];

GLuint pixelCount;

glGenOcclusionQueriesNV(N, queries);

- Loop over queries
for (i = 0; i < N; i++) {

glBeginOcclusionQueryNV(queries[i]);

// render bounding box for ith geometry

glEndOcclusionQueryNV();

}

Occlusion Query: How to Use

- Get pixel counts
for (i = 0; i < N; i++) {

glGetOcclusionQueryuivNV(queries[i], GL_PIXEL_COUNT_NV,

&pixelCount);

if (pixelCount > MAX_COUNT)

// render ith geometry

}

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

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

From Region Visibility

Rest of

the Scene

Equivalent center

of projection

Occluding

Segment

View Segment

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

Download Presentation

Connecting to Server..