Csl 859 advanced computer graphics
This presentation is the property of its rightful owner.
Sponsored Links
1 / 78

CSL 859: Advanced Computer Graphics PowerPoint PPT Presentation


  • 138 Views
  • Uploaded on
  • Presentation posted in: General

CSL 859: Advanced Computer Graphics. Dept of Computer Sc. & Engg. IIT Delhi. 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.

Download Presentation

CSL 859: Advanced Computer Graphics

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


Csl 859 advanced computer graphics

CSL 859: Advanced Computer Graphics

Dept of Computer Sc. & Engg.

IIT Delhi


Basic depth visibility

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


View frustum visibility

View-Frustum Visibility

  • Clipping

    • Scissoring

  • Culling


Clipping

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


Clipping1

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


Clipping2

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


Clipping3

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


Intersection

Intersection

v1t + v0(1-t)

x1t + x0(1-t) = -1

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

y = y1t + y0(1-t)

v1

v0

x=-1


Homogeneous space clipping

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

View-frustum Culling

  • Project all vertices

  • Then cull


Group culling

Group Culling

  • Cull in World space


Group culling1

Group Culling

  • Cull in World space

  • Group polygons

  • Cull groups

    • Plane test


Groups

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

Hierarchies

Sphere AABB OBB kDOP


Bounding sphere computation

Bounding Sphere Computation


Bounding sphere computation1

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


Aabb computation

AABB Computation

  • Extrema along each primary axis


Obb computation

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

Non-separating axis

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

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 box with sat

axis

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 sat1

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

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 vs. Spatial Partitioning

BVH: SP:

- Object centric - Space centric

- Spatial redundancy - Object redundancy


Bvh vs spatial partitioning1

BVH vs. Spatial Partitioning

BVH: SP:

- Object centric - Space centric

- Spatial redundancy - Object redundancy


Bvh vs spatial partitioning2

BVH vs. Spatial Partitioning

BVH: SP:

- Object centric - Space centric

- Spatial redundancy - Object redundancy


Bvh vs spatial partitioning3

BVH vs. Spatial Partitioning

BVH: SP:

- Object centric - Space centric

- Spatial redundancy - Object redundancy


Spatial data structures subdivision

Uniform Spatial Sub

Quadtree/Octree

kd-tree

BSP-tree

Spatial Data Structures & Subdivision

  • Many others……


Uniform spatial subdivision

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

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

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

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

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.


Trade off in choosing bv s

Convex Hull

AABB

OBB

Sphere

6-dop

Trade-off in Choosing BV’s

increasing complexity & tightness of fit

decreasing cost of (overlap tests + BV update)


Fitting obbs statistically

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


Principal components

Principal Components


Back face culling

Back-face Culling

Sphere

Half the sphere is not visible


Polygonal backfacing

ev.n > 0

Polygonal Backfacing?


Polygon groups

Polygon Groups


Hierarchical back face culling

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

Back-Patch Culling

p.n > e.n for all p

c-e.n > r|n|


Back patch visibility

Back-patch Visibility

p

n

e


Back patch culling1

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

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

Results

Wireframe Translation Fattening


Exact silhouettes

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

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

“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


Duality

p2

f2

Duality

f1

p1


Duality1

f2

Duality

f1

O

p1

p2


Silhouette update

F

F

View-plane

Silhouette Update

View-plane

6

4

1

7

2

3

5


Silhouette algorithm details

Silhouette Algorithm Details

  • Double-wedge point location query

  • Partition space

    • Octree, BAR-tree

  • If region intersected by wedge

    • recur


Silhouette algorithm details1

Silhouette Algorithm Details

Lin

Lout

Adj Container

Tree Region

Double wedge


Quiz 5

Quiz 5

  • Explain how quadric error is used for mesh simplification.

  • Define Mean curvature and Gaussian curvature of a surface.


Cells portals

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 portals1

Cells & Portals

  • An example:


Cells portals2

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…


Cells portals3

Cells & Portals

A

D

E

F

B

C

G

H

A

E

B

C

D

F

G

H


Cells portals4

Cells & Portals

A

D

E

F

B

C

G

H

A

E

B

C

D

F

G

H


Cells portals5

Cells & Portals

A

D

E

F

B

C

G

H

A

E

B

C

D

F

G

H


Cells portals6

Cells & Portals

A

D

E

F

B

C

G

H

A

E

B

C

D

F

G

H


Cells portals7

Cells & Portals

A

D

E

F

B

C

G

H

A

E

B

C

D

F

G

H


Cells portals8

Cells & Portals

A

D

E

?

F

B

C

G

H

A

E

B

C

D

F

G

?

H


Cells portals9

Cells & Portals

A

D

E

X

F

B

C

G

H

A

E

B

C

D

F

G

X

H


Cells portals10

A

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


Cells portals11

A

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

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 programming

Linear Programming

  • Canonical form: Find x that

    • Maximizes cT x

      • Objective function

    • subject to Ax <= b

      • -ve constraints

    • where xi>= 0

      • +ve constraints


Occlusion query

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 query1

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

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 use1

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 use2

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

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 culling1

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

From Region Visibility

Rest of

the Scene

Equivalent center

of projection

Occluding

Segment

View Segment


Visibility from region in 3d

Visibility From Region in 3D


Visibility from region in 3d1

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


  • Login