 Download Download Presentation # CSL 859: Advanced Computer Graphics

Download Presentation ## CSL 859: Advanced Computer Graphics

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

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 = (1+x0)/(x0-x1) y = y1t + y0(1-t) v1 v0 x=-1

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

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

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

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

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. Uniform Spatial Sub Quadtree/Octree kd-tree BSP-tree 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 parent’s 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. 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)

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. ev.n > 0 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 > e.n for all p c-e.n > r|n|

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

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

44. Results Wireframe Translation Fattening

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

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

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

48. p2 f2 Duality f1 p1

49. f2 Duality f1 O p1 p2