- 151 Views
- Uploaded on
- Presentation posted in: General

CSL 859: Advanced Computer Graphics

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

CSL 859: Advanced Computer Graphics

Dept of Computer Sc. & Engg.

IIT Delhi

- 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

- Clipping
- Scissoring

- Culling

- 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

- 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

- 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

- 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

v1t + v0(1-t)

x1t + x0(1-t) = -1

t = (1+x0)/(x0-x1)

y = y1t + y0(1-t)

v1

v0

x=-1

- 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

- Project all vertices
- Then cull

- Cull in World space

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

- 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

Sphere AABB OBB kDOP

- 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

- Extrema along each primary axis

- One face and one edge of convex polyhedron are part of OBB
OR

- Three edges of the convex polyhedron form part of the OBB

Non-separating axis

- 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

- Box is axis-aligned
- 1) test the axes that are orthogonal to the faces of the box
- That is, x,y, and z

axis

Triangle seen from side

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

- 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

- Test for a group
- If outside frustum
- Cull

- If inside frustum
- Display

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

BVH: SP:

- Object centric - Space centric

- Spatial redundancy - Object redundancy

BVH: SP:

- Object centric - Space centric

- Spatial redundancy - Object redundancy

BVH: SP:

- Object centric - Space centric

- Spatial redundancy - Object redundancy

BVH: SP:

- Object centric - Space centric

- Spatial redundancy - Object redundancy

Uniform Spatial Sub

Quadtree/Octree

kd-tree

BSP-tree

- Many others……

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

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

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

- 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

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

Convex Hull

AABB

OBB

Sphere

6-dop

increasing complexity & tightness of fit

decreasing cost of (overlap tests + BV update)

- 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

Sphere

Half the sphere is not visible

ev.n > 0

- 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

p.n > e.n for all p

c-e.n > r|n|

p

n

e

- 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

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

Wireframe Translation Fattening

- 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

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

- 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

p2

f2

f1

p1

f2

f1

O

p1

p2

F

F

View-plane

View-plane

6

4

1

7

2

3

5

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

- If region intersected by wedge
- recur

Lin

Lout

Adj Container

Tree Region

Double wedge

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

- 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

- An example:

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

A

D

E

F

B

C

G

H

A

E

B

C

D

F

G

H

A

D

E

F

B

C

G

H

A

E

B

C

D

F

G

H

A

D

E

F

B

C

G

H

A

E

B

C

D

F

G

H

A

D

E

F

B

C

G

H

A

E

B

C

D

F

G

H

A

D

E

F

B

C

G

H

A

E

B

C

D

F

G

H

A

D

E

?

F

B

C

G

H

A

E

B

C

D

F

G

?

H

A

D

E

X

F

B

C

G

H

A

E

B

C

D

F

G

X

H

A

D

E

F

B

C

G

H

- 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

A

D

E

F

B

C

G

H

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

A

D

E

B

C

G

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

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

- subject to Ax <= b
- -ve constraints

- where xi>= 0
- +ve constraints

- Maximizes cT x

- 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

- 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

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

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

}

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

glGetOcclusionQueryuivNV(queries[i], GL_PIXEL_COUNT_NV,

&pixelCount);

if (pixelCount > MAX_COUNT)

// render ith geometry

}

- 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

- 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

Rest of

the Scene

Equivalent center

of projection

Occluding

Segment

View Segment

- 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