1 / 118

CSCE 441: Computer Graphics Hidden Surface Removal

CSCE 441: Computer Graphics Hidden Surface Removal. Jinxiang Chai. Review: 3D Geometry Pipeline. Object space. World space. View space. Normalized project space. Image space. 2. 3D Rendering Pipeline. Modeling transformation. lighting. Viewing transformation. Project transformation.

jacquelynh
Download Presentation

CSCE 441: Computer Graphics Hidden Surface Removal

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai

  2. Review: 3D Geometry Pipeline Object space World space View space Normalized project space Image space 2

  3. 3D Rendering Pipeline Modeling transformation lighting Viewing transformation Project transformation Clipping Scan conversion Image

  4. 3D Rendering Pipeline Modeling transformation Transform into 3D world system Illuminate according to lighting and reflectance lighting Transform into 3D camera coordinate system Viewing transformation Transform into 3D normalized project space Project transformation Clip primitives outside camera’s view Clipping Draw pixels (includes texturing, hidden surface, etc.) Scan conversion Image

  5. 3D Geometry Pipeline Object space World space View space Normalized project space Image space 5

  6. Hidden Surface Removal

  7. Hidden Surfaces

  8. Hidden Surfaces

  9. Hidden Surfaces

  10. Polygon Mesh Representation

  11. Hidden Surfaces Removal • The goal is to determine which surfaces and parts of surfaces are not visible from a certain viewpoint • A.K.A occlusion culling or visible surface determination

  12. Outline • Backface Culling • Painter’s algorithm • BSP • Z-buffer • Ray casting • Required reading: section 16-1 to 16-11

  13. Backface Culling Normalized project space

  14. Backface Culling Normalized project space view direction

  15. Backface Culling Normalized project space view direction

  16. Backface Culling view direction

  17. Backface Culling , draw polygon view direction

  18. Backface Culling , cull polygon view direction

  19. Backface Culling • Is this all we have to do?

  20. Backface Culling • Is this all we have to do? No! • Can still have 2 (or more) front faces that map to the same screen pixel

  21. Backface Culling • Is this all we have to do? No! • Can still have 2 (or more) front faces that map to the same screen pixel • Which actually gets drawn?

  22. Backface Culling • Advantages • Improves rendering speed by removing roughly half of polygons from scan conversion • Disadvantages • Assumes closed surface with consistently oriented polygons • NOT a true hidden surface algorithm!!!

  23. Painter’s Algorithm • Basic idea: similar to oil painting - draw background first - then most distant object - then nearer object - and so forth

  24. Painter’s Algorithm • Sort polygons according to distance from viewer • Draw from back (farthest) to front (nearest) - the entire object • Near objects will overwrite farther ones

  25. z = 0.7 z = 0.3 z = 0.1 z = 0 Painter’s Example Sort by depth: Green rect Red circle Blue tri

  26. Painter’s Algorithm • Does anyone see a problem with this?

  27. Painter’s Algorithm • Does anyone see a problem with this? - Objects can have a range of depth, not just a single value - Need to make sure they don’t overlap for this algorithm to work

  28. Painter’s Algorithm • Does anyone see a problem with this? - Objects can have a range of depth, not just a single value - Need to make sure they don’t overlap for this algorithm to work

  29. Painter’s Algorithm • Sort all objects’ zmin and zmax

  30. Painter’s Algorithm • Sort all objects’ zmin and zmax • If an object is uninterrupted (its zmin and zmax are adjacent in the sorted list), it is fine

  31. Painter’s Algorithm • Sort all objects’ zmin and zmax • If an object is uninterrupted (its zmin and zmax are adjacent in the sorted list), it is fine • If 2 objects DO overlap 3.1 Check if they overlap in x - If not, they are fine 3.2 Check if they overlap in y - If not, they are fine - If yes, need to split one

  32. Painter’s Algorithm • The splitting step is the tough one - Need to find a plane to split one polygon so that each new polygon is entirely in front of or entirely behind the other - Polygons may actually intersect, so then need to split each polygon by the other

  33. Painter’s Algorithm • The splitting step is the tough one - Need to find a plane to split one polygon so that each new polygon is entirely in front of or entirely behind the other - Polygons may actually intersect, so then need to split each polygon by the other • After splitting, you can resort the list and should be fine

  34. Painter’s Algorithm-Summary • Advantages - Simple algorithm for ordering polygons • Disadvantages - Splitting is not an easy task - Sorting can also be expensive - Redraws same pixel many times

  35. Binary Space Partitioning Trees • Basic principle: Objects in the half space opposite of the viewpoint do not obscure objects in the half space containing the viewpoint; thus, one can safely render them without covering foreground objects 6 4 5 7 1 3 2

  36. Binary Space Partitioning Trees • Basic principle: Objects in the half space opposite of the viewpoint do not obscure objects in the half space containing the viewpoint; thus, one can safely render them without covering foreground objects - 6 + 4 5 7 1 3 2

  37. Binary Space Partitioning Trees • Basic principle: Objects in the half space opposite of the viewpoint do not obscure objects in the half space containing the viewpoint; thus, one can safely render them without covering foreground objects - 6 + 4 5 7 If we want to draw 5 correctly - we need draw 6 and 7 first, - then draw 5, - then draw 1,2,3,4 1 3 2

  38. Binary Space Partitioning Trees • Basic principle: Objects in the half space opposite of the viewpoint do not obscure objects in the half space containing the viewpoint; thus, one can safely render them without covering foreground objects - 6 + 4 5 7 If we want to draw 5 correctly - we need draw 6 and 7 first, - then draw 5, - then draw 1,2,3,4 1 3 2 We need to do this for every polygon Can we do this more efficiently?

  39. Binary Space Partitioning Trees • Basic principle: Objects in the half space opposite of the viewpoint do not obscure objects in the half space containing the viewpoint; thus, one can safely render them without covering foreground objects - 6 + 4 5 7 If we want to draw 5 correctly - we need draw 6 and 7 first, - then draw 5, - then draw 1,2,3,4 1 3 2 We need to do this for every polygon Can we do this more efficiently? BSP tree

  40. Binary Space Partition Trees • BSP tree: organize all of space (hence partition)into a binary tree - Preprocess: overlay a binary tree on objects in the scene - Runtime: correctly traversing this tree enumerates objects from back to front // similar to painter’s algorithm - Idea: divide space recursively into half-spaces by choosing splitting planes • Splitting planes can be arbitrarily oriented

  41. Binary Space Partition Trees (1979) • BSP tree: organize all of space (hence partition)into a binary tree - Preprocess: overlay a binary tree on objects in the scene - Runtime: correctly traversing this tree enumerates objects from back to front - Idea: divide space recursively into half-spaces by choosing splitting planes • Splitting planes can be arbitrarily oriented

  42. BSP Trees: Objects 9 8 7 6 5 4 1 2 3

  43. BSP Trees: Objects 9 - 8 + 7 6 5 4 1 2 3

  44. BSP Trees: Objects Put front objects in the left branch + - 9 - 8 + 7 6 1 4 6 7 8 9 2 3 5 5 4 1 2 3

  45. BSP Trees: Objects Put front objects in the left branch + - 9 - 8 + 7 6 1 4 6 7 8 9 2 3 5 - + 5 4 ? ? 1 2 3

  46. BSP Trees: Objects Put front objects in the left branch + - 9 - 8 + 7 6 6 7 8 9 5 - + 5 4 1 4 4 2 3 1 2 3

  47. BSP Trees: Objects Put front objects in the left branch + - 9 - 8 + 7 6 6 7 8 9 5 - + + - 5 4 1 4 4 ? ? 9 2 3 1 2 3

  48. BSP Trees: Objects Put front objects in the left branch + - 9 8 7 6 - + + - 5 4 1 4 6 7 8 9 2 3 5 1 2 3

  49. BSP Trees: Objects Put front objects in the left branch + - 9 8 7 6 - + + - 5 4 1 - - - + + + 1 2 3 3 2 4 5 6 7 9 8

  50. BSP Trees: Objects Put front objects in the left branch + - 9 8 7 6 - + + - 5 4 1 - - - + + + 1 2 3 3 5 6 8 6 - - 2 + + 2 4 7 9

More Related