# CSE328 Fundamentals of Computer Graphics: Concepts, Theory, Algorithms, and Applications

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 CSE328 Fundamentals of Computer Graphics: Concepts, Theory, Algorithms, and Applications Hong Qin Stony Brook University (SUNY at Stony Brook) Stony Brook, New York Tel: (631) ; Fax: (631)

2 Hidden Surface Removal???

3 No Lines Removed

4 Hidden Lines Removed

5 Hidden Surfaces Removed

6 Hidden Surface Removal (a.k.a. Visibility)

7 Motivation Suppose that we have the polyhedron which has 3 totally visible surfaces, 4 totally invisible/hidden surfaces, and 1 partially visible/hidden surface. Obviously, invisible/hidden surfaces do not contribute to the final image during graphics production. The procedure that distinguishes between visible surfaces from invisible/hidden surfaces is called visible-surface determination, which is often called hidden-surface removal.

8 Motivation Surfaces may be back-facing: Viewer Surfaces may be occluding: Back-Facing Polygon Viewer Occluding Polygon Occluded Polygon

9 Motivation Surfaces may be overlapping: Viewer Surfaces may be intersecting: Viewer

10 Occlusion: Full, Partial, None Full Partial None The rectangle is closer than the triangle Should appear in front of the triangle

11 Hidden Surface Removal Motivation Algorithms for Hidden Surface Removal Back-face detection Painter s algorithm Ray casting Scan-line Z-buffer Area subdivision Tradeoffs when comparing different techniques

12 Image or Object Space Algorithms Ideally an object space method converts the 3D scene into a list of 2D areas to be painted Image space decides for each pixel which surface to paint

13 Hidden Surface Removal In 3D we must be concerned with whether or not objects are obscured by other objects Most objects are opaque so they should obscure/block things behind them Also Known As: visible surface detection methods or hidden surface elimination methods Related problem : Hidden Line Removal

14 Visibility Basic assumption: All polygons are opaque What polygons are visible with respect to your view frustum? Outside: View Frustum Clipping Remove polygons outside of the view volume For example, Liang-Barsky 3D Clipping Inside: Hidden Surface Removal Backface culling Polygons facing away from the viewer Occlusion Polygons farther away are obscured by closer polygons Full or partially occluded portions Why should we remove these polygons? Avoid unnecessary expensive operations on these polygons later

15 Visibility Culling Culling techniques View-frustum culling Reject geometry outside the viewing volume Back-face culling Reject geometry facing away from the observer Occlusion culling Reject objects occluded by others

16 Back Face Culling Performance goals in real-time rendering frame rate: frames/sec? resolution: 1600x1200? photorealism (if necessary): undistinguishable from real scene! Unfortunately, there is no real upper limit on the scene complexity. We should cull those portions of the scene that are not considered to contribute to the final image as early as possible, and process only the rest of the scene. The simplest is back-face culling, which distinguishes between front faces (faces towards the viewer) and back faces (faces away from the viewer).

17 Backface Culling Avoid drawing polygons facing away from the viewer Front-facing polygons occlude these polygons in a closed polyhedron Test if a polygon is front- or back-facing? back-facing Ideas? front-facing

18 Which Side of a Plane? z n y p (p - n).n = 0 x

19 Detecting Back-face Polygons The polygon normal of a front-facing polygon points towards the viewer back-facing polygon points away from the viewer If (n v) > 0 back-face If (n v) 0 front-face v = view vector back Eye-space test EASY! back-face if n z < 0 glcullface(gl_back) front

20 Polygon Normals Let polygon vertices v 0, v 1, v 2,..., v n - 1 be in counterclockwise order and co-planar Calculate normal with cross product: n = (v 1 - v 0 ) X (v n v 0 ) Normalize to unit vector with n/ n n v 3 v 4 v 2 v 0 v 1

21 Normal Direction Vertices counterclockwise Front-facing Vertices clockwise Back-facing Front facing Back facing

22 Back Face Culling Back-face culling works as a preprocessing step for hidden surface removal, and is very powerful in that almost half of polygons of an object are discarded as back faces. Especially, for a single convex polyhedron, the back-face culling does the entire job of hidden-surface removal. Hidden-surface removal is applied to only the remaining front faces. single convex polyhedron convex, but not a single polyhedron

23 Face Normal The normal of a triangle <p 1, p 2, p 3 > is computed as v 1 X v 2 where v 1 is the vector connecting p 1 and p 2, and v 2 connects p 1 and p 3. If the vertices of every polygon are ordered consistently (CCW or CW), we can make every polygon s normal point out of the polyhedron. All mesh data used in this class have triangles of CCW vertex ordering. p s q r t 1 = (p, q, r) t 2 = (s, q, p) t 1 s normal = (q-p)x(r-p) t 2 s normal = (q-s)x(p-s)

24 Dot Product (revisited) Recall the dot product of two vectors v i & v j. If v i v j = 0, v i & v j are orthogonal/perpendicular. If v i v j > 0, angle < 90 If v i v j < 0, angle > 90 The same applies to 3D. y d=(-1,0) a=(-1,1) b=(0,1) c=(1,1) x a d = (-1,1) (-1,0) = 1 > 0 b d = (0,1) (-1,0) = 0 c d = (1,1) (-1,0) = -1 < 0

25 Dot Product for Back Face Culling Determining if a polygon is a front face or a back face Generate a vector C connecting COP and a vertex of the polygon. Take the dot product C N of the vector C and the polygon s normal N. If C N > 0, it s a back face. If C N < 0, it s a front face. If C N = 0, it s a face that is projected as an edge/silhouette on the screen. C 1 N 1 = 0 N 1 C 1 C 2 N 2 COP C 3 C 2 N 2 > 0 N 3 C 3 N 3 < 0

26 Back Face Removal (Culling) Used to remove unseen polygons from convex, closed polyhedron (Cube, Sphere) Does not completely solve hidden surface problem since one polyhedron may obscure another

27 Backface Culling For all polygons P i Find Polygon Normal n Find Viewer Direction v IF ( n v 0) Then CULL P i Does not work well for: Overlapping front faces due to Multiple objects Concave objects Non-polygonal models Non-closed Objects

28 Painter s Algorithm Basic Idea A painter creates a picture by drawing background scene elements before foreground ones Requirements Draw polygons in back-tofront order Need to sort the polygons by depth order to get a correct image from Shirley

29 Painter s Algorithm 1. Sort all objects zmin and zmax

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

31 Painter s Algorithm 1. Sort all objects zmin and zmax 2. If an object is uninterrupted (its zmin and zmax are adjacent in the sorted list), it is fine 3. 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 Sorting criteria difficult to produce Redraws same pixel many times Sorting can also be expensive

35 Painter s Algorithm Compute z min ranges for each polygon Project polygons with furthest z min first (z) depth z min z min z min z min

36 Depth Sorting The painter s algorithm: draw from back to front Depth-sort hidden surface removal: sort display list by z-coordinate from back to front render/display Drawbacks it takes some time (especially with bubble sort!) it doesn t work

37 Depth Sorting Requires ordering of polygons first O(n log n) calculation for ordering Not every polygon is either in front or behind all other polygons Order polygons and deal with easy cases first, harder later Polygons sorted by distance from COP

38 Easy Cases A lies behind all other polygons Can render Polygons overlap in z but not in either x or y Can render independently

39 Depth Sorting Example Painter s Algorithm: Sort surfaces in order of decreasing maximum depth Scan convert surfaces in order starting with ones of greatest depth, reordering as necessary based on overlaps A D E Viewer View Plane B C Depth Sort

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

41 Hard Cases Overlap in all directions but can one be fully on one side of the other cyclic overlap penetration

42 Painter s Algorithm Problem: Can you get a total sorting? z min z min z min z min Correct?

43 Depth-sorting Difficulties Polygons with overlapping projections Cyclic overlap Interpenetrating polygons What to do?

44 Painter s Algorithm Cyclic Overlap How do we sort these three polygons? Sorting is nontrivial Split polygons in order to get a total ordering Not easy to do in general

45 Depth Sorting Completely in front put in front Not overlapping in x, y either Intersecting divide along intersection overlapping divide along plane of one polygon.

46 Depth Sorting Cyclically overlapping surfaces that alternately obscure one another We can divide the surfaces to eliminate the cyclic overlaps CSE528 Lectures

47 Painter s Algorithm

48 y x

49

50 The Painters Algorithm Sort polygons according to their z values and render from back to front Ends up drawing over the polygons in the back (more or less) Problems arise when polygons overlap or are allowed to pierce one another Heedless Painter s Algorithm: sort by farthest point and draw in order Depth sort improves on this by splitting up overlapping polygons into less ambiguous pieces

51 Visibility How do we ensure that closer polygons overwrite further ones in general?

52 Image Space Approach Look at each projection (nm for an n x m frame buffer) and find closest of k polygons Complexity O(nmk) Ray tracing z-buffer

53 Ray Casting Algorithm: Cast ray from viewpoint through each pixel to find front-most surface A D E Viewer C View Plane B

54 The Z-buffer Algorithm The most widely-used hidden surface removal algorithm Relatively easy to implement in hardware or software An image-space algorithm which traverses scene and operates per polygon rather than per pixels We rasterize polygon by polygon and determine which (parts of) polygons get drawn on the screen Relies on a Secondary Buffer called the z-buffer or depth buffer Depth buffer has same width and height as the frame-buffer Each cell contains the z-value (distance from viewer) of the object at that pixel position

55 Z-Buffer Depth buffer (Z-Buffer) A secondary image buffer that holds depth values Same pixel resolution as the color buffer Why is it called a Z-Buffer? After eye space, depth is simply the z-coordinate Sorting is done at the pixel level Rule: Only draw a polygon at a pixel if it is closer than a polygon that has already been drawn to this pixel

56 Z-Buffer Algorithm Visibility testing is done during rasterization

57 The Z-buffer Algorithm 1. Initialize all depth(x,y) to 0 and refresh(x,y) to background color 2. For each pixel 1. Get current value depth(x,y) 2. Evaluate depth value z if z > depth(x,y) then { depth(x,y) = z refresh(x,y) = I s (x,y) Calculate this using shading } z algorithm/illumination/fill color/texture y B x A z 2 z 1

58 Z-buffer: A Secondary Buffer Color buffer Depth buffer

59 Z-Buffer How do we calculate the depth values on the polygon interior? P 1 P 2 P 3 P 4 y s z a z p z b Scanline order ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( b a p a a b a p s b s a x x x x z z z z y y y y z z z z y y y y z z z z Bilinear Interpolation

60 Example Z-buffer Screen CSE528 Lectures

61 Parallel with the image plane CSE528 Lectures

62 Not Parallel CSE528 Lectures

63 Z-Buffer Algorithm Algorithm easily handles this case

64 Z-buffering in OpenGL Create depth buffer by setting GLUT_DEPTH flag in glutinitdisplaymode()or the appropriate flag in the PIXELFORMATDESCRIPTOR Enable per-pixel depth testing with glenable(gl_depth_test) Clear depth buffer by setting GL_DEPTH_BUFFER_BIT in glclear()

65 Without Hidden surface removal the wrong polygons can be drawn over With Backface culling Alternatively we could cull the front faces to see inside the solid

66 No hidden surface removal Culling can reduce workload for depth testing but we need to ensure that objects are proper solids. This teapot is not quite a proper solid and as a result the image is incorrect. However, combining backface culling with more expensive depth-testing is usually a good practice. Backface Culling only: correct in some places but not adequate for objects which have holes, are non convex or multiple objects CSE528 Lectures Depth Testing Only

67 Scan Line Algorithm Similar in some respects to the z-buffer method but handles the image scan-line by scan-line Due to coherency in data, this can be relatively efficient. 1. Rasterize all polygon boundaries (edges) i 2. Scanning across each scan line we determine the color of each pixel j a. By default color everything as background b. If we encounter the edge of one polygon, start evaluating polygon color at each point and shade the scanline it accordingly c. For multiple edges do depth evaluation to see which polygon wins

68 Scan Line Algorithm Work one scan line at a time Compute intersections of faces along scanline Keep track of all open segments and draw the closest

69 Scan Line Algorithm Can combine shading and hsr through scan line algorithm scan line i: no need for depth information, can only be in no or one polygon scan line j: need depth information only when in more than one polygon

70 Scan Conversion At this point in the pipeline, we have only polygons and line segments. Render! To render, convert to pixels ( fragments ) with integer screen coordinates (ix, iy), depth, and color Send fragments into fragment-processing pipeline

71 Hidden Surface Removal Object-space vs. Image space The main image-space algorithm: z-buffer Drawbacks Aliasing Rendering invisible objects How would object-space hidden surface removal work?

72 Visibility Testing In many real-time applications, such as games, we want to eliminate as many objects as possible within the application Reduce burden on pipeline Reduce traffic on bus Partition space with Binary Spatial Partition (BSP) Tree

73 Simple Example consider 6 parallel polygons top view The plane of A separates B and C from D, E and F

74 Painter s Algorithm with BSP Trees Building the tree May need to split some polygons Slow, but done only once Traverse back-to-front or front-to-back Order is viewer-direction dependent However, the tree is viewer-independent What is front and what is back of each line changes Determine order on the fly

75 Divide Scene with a Plane Everything on the same side of that plane as the eye is in front of everything else. Divide front and back with more planes. If necessary split polygons by planes.

76 Details of Painter s Algorithm Each face has form Ax + By + Cz + D = 0 Plug in coordinates and determine Positive: front side Zero: on plane Negative: back side Back-to-front: inorder traversal, farther child first Front-to-back: inorder traversal, near child first Do backface culling with same sign test Clip against visible portion of space (portals)

77 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

78 BSP trees

79 BSP Tree Split space with any line (2D) or plane (3D) Applications Painters algorithm for hidden surface removal Ray casting Solid modeling Inherent spatial ordering given viewpoint Left subtree: in front right subtree: behind Problem: finding good space partitions Proper ordering for the tree Balance tree

80 BSP Tree Can continue recursively Plane of C separates B from A Plane of D separates E and F Can put this information in a BSP tree Use for visibility and occlusion testing

81 Building BSP Trees Use hidden surface removal as intuition Using line 1 or line 2 as root is easy

82 Building BSP Trees Using line 3 as root requires splitting

83 Building a Good Tree Naive partitioning of n polygons yields O(n 3 ) polygons (in 3D) Algorithms with O(n 2 ) increase exist Try all, use polygon with fewest splits Do not need to split exactly along polygon planes Should balance tree More splits allow easier balancing Rebalancing?

84 Binary Space Partitioning Trees Basic idea: 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

85 Binary Space Partitioning Trees Basic Idea: 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 If we want to draw 5 correctly - we need draw 6 and 7 first, - then draw 5, - then draw 1,2,3,4

86 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 If we want to draw 5 correctly - we need draw 6 and 7 first, 2 - then draw 5, - then draw 1,2,3,4 We need to do this for every polygon Can we do this efficiently?

87 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 - Idea: divide space recursively into half-spaces by choosing splitting planes Splitting planes can be arbitrarily oriented

88 BSP-Trees Binary Space Partition Trees Split space along planes Allows fast queries of some spatial relations Simple construction algorithm Select a plane as sub-tree root Everything on one side to one child Everything on the other side to other child Use random polygon for splitting plane

89 BSP-Trees

90 BSP-Trees

91 BSP-Trees

92 BSP-Trees

93 BSP-Trees

94 BSP-Trees

95 How Do We Traverse BSP Tree? Visibility traversal based on BSP tree Variation of in-order-traversal»child one»sub-tree root»child two Select child one based on location of viewpoint Child one on same side of sub-tree root as viewpoint

96 BSP-Trees

97 BSP-Trees

98 BSP Trees: Another Example

99 BSP Trees: Objects

100 BSP Trees: Objects

101 BSP Trees: Objects

102 BSP Trees: Objects

103 BSP Trees: Objects

104 BSP Trees: Objects When to stop the recursion?

105 Object Splitting No bunnies were harmed in my example But what if a splitting plane passes through an object? - Split the object; give half to each node: - Worst case: can create up to O(n 3 ) objects! Ouch CSE528 Lectures

106 Polygons: BSP Tree Construction Split along the plane containing any polygon Classify all polygons into positive or negative half-space of the plane If a polygon intersects plane, split it into two Recursion down the negative half-space Recursion down the positive half-space

107 BSP Trees: Objects Traversal order?

108 BSP Trees: Objects Traversal order: 8->9->7->6->5->3->4->2->

109 Building a BSP Tree for Polygons Choose a splitting polygon Sort all other polygons as Front Behind Crossing On Add front polygons to front child, behind to back child Split crossing polygons with infinite plane Add on polygons to root Recursion

110 Building a BSP Tree

111 Building a BSP Tree b 2,34,5,6,7

112 Building a BSP Tree b 2,34,5,6,7 How to divide 2,3,4,5,6,7?

113 Building a BSP Tree ,4,5-1,7-1 f 1 b 3 b 7-2, 6,5-2

114 Building a BSP Tree ,4,5-1,7-1 f 1 b 3 b 7-2, 6,5-2

115 Building a BSP Tree f 2 b f b 3 b 7-2, 6,5-2 4,5-1

116 Building a BSP Tree f 2 1 b f b 4 3 b 7-2, 6,5-2 b 5-1

117 Building a BSP Tree f 1 f b b b 7-2, 6,5-2 b

118 Building a BSP Tree f 1 f b b b 7-2, 6,5-2 b

119 Building a BSP Tree f 1 f b b b 7-2 b b 6,5-2

120 Building a BSP Tree f 1 f b b 4 3 b 7-2 b b f

121 Building a BSP Tree f 1 f b b 3 b b b f

122 Building a BSP Tree f 1 f b b 3 b b b f

123 Rendering with a BSP Tree If eye is in front of plane Draw back polygons Draw on polygons Draw front polygons If eye is behind plane Draw front polygons Draw on polygons Draw back polygons Else eye is on plane Draw front polygons Draw back polygons

124 Building a BSP Tree Traversal order: f 1 f b b 3 b b b f

125 Building a BSP Tree Traversal order: 6->(5-2)->(7-2)->3->(5-1)->4->(7-1)->2-> f 1 f b b 3 b b b f

126 Building a BSP Tree Traversal order: f 1 f b b 3 b b b f

127 Building a BSP Tree Traversal order: 1->2->(7-1)->4->(5-1)->3->(7-2)->(5-2)-> f f b 1 b b 3 b b 6 b f

128 Building a BSP Tree Traversal order? f f 1 b b 3 b b b f

129 Summary: BSP Trees Pros: Simple, elegant scheme No depth comparisons needed Polygons split and ordered automatically Only writes to framebuffer (i.e., painters algorithm)

130 Summary: BSP Trees Cons: Computationally intense preprocess stage restricts algorithm to static scenes Splitting increases polygon count Redraws the same pixel many times Choosing splitting plane not an exact science

131 Improved BSP Rendering Take advantage of view direction to cull away polygons behind viewer

132 Improved BSP Rendering Take advantage of view direction to cull away polygons behind viewer View frustum

133 Efficiency BSP trees are order n log(n) in the number of polygons. Good for VR walkthrough because you only re-compute when the eye crosses a separating plane.

134 Z-Buffer Record r, g, b and z (depth) for each pixel. Process each polygon line by line and if closer replace r,g,b,z in the buffer.

135 Scan Line in Screen Space

136 Area Subdivision Fill area if: All surfaces are outside Only one surface intersects One surface occludes other surfaces within area. Otherwise, subdivide

137 The Warnock s Algorithm The Warnock algorithm divides the screen into smaller areas and sorts triangles within these. If there is ambiguity (i.e., polygons overlap in depth extent within these areas), then further subdivision occurs. At the limit, subdivision may occur down to the pixel level.

138 Warnock Algorithm Takes advantage of area coherence: divide the display area into successively smaller rectangles until the entire rectangle can be filled with a single color

139 Finding the Depth Plane equation is Ax + By + Cz + D = 0 z = - (Ax + By + D)/C replace x by x+1 z' = - (A(x+1) + By + D)/C Dz = z' - z = -A/C New z is found by adding a constant.

140 CSE528 Lectures

141 CSE528 Lectures

142

143 CSE528 Lectures

### CSE528 Computer Graphics: Theory, Algorithms, and Applications

CSE528 Computer Graphics: Theory, Algorithms, and Applications Hong Qin State University of New York at Stony Brook (Stony Brook University) Stony Brook, New York 11794--4400 Tel: (631)632-8450; Fax: (631)632-8334

### 9. Visible-Surface Detection Methods

9. Visible-Surface Detection Methods More information about Modelling and Perspective Viewing: Before going to visible surface detection, we first review and discuss the followings: 1. Modelling Transformation:

### Identifying those parts of a scene that are visible from a chosen viewing position, and only process (scan convert) those parts

Visible Surface Detection Identifying those parts of a scene that are visible from a chosen viewing position, and only process (scan convert) those parts Two approaches: 1. Object space methods 2. Image

### Computer Graphics. Bing-Yu Chen National Taiwan University

Computer Graphics Bing-Yu Chen National Taiwan University Visible-Surface Determination Back-Face Culling The Depth-Sort Algorithm Binary Space-Partitioning Trees The z-buffer Algorithm Scan-Line Algorithm

### Hidden Surface Removal

Outline Introduction Hidden Surface Removal Hidden Surface Removal Simone Gasparini gasparini@elet.polimi.it Back face culling Depth sort Z-buffer Introduction Graphics pipeline Introduction Modeling Geom

### Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

Computer Graphics Lecture 9 Hidden Surface Removal Taku Komura 1 Why Hidden Surface Removal? A correct rendering requires correct visibility calculations When multiple opaque polygons cover the same screen

### Clipping. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Clipping 1 Objectives Clipping lines First of implementation algorithms Clipping polygons (next lecture) Focus on pipeline plus a few classic algorithms 2 Clipping 2D against clipping window 3D against

### Spatial Data Structures

CSCI 480 Computer Graphics Lecture 7 Spatial Data Structures Hierarchical Bounding Volumes Regular Grids BSP Trees [Ch. 0.] March 8, 0 Jernej Barbic University of Southern California http://www-bcf.usc.edu/~jbarbic/cs480-s/

### Spatial Data Structures

15-462 Computer Graphics I Lecture 17 Spatial Data Structures Hierarchical Bounding Volumes Regular Grids Octrees BSP Trees Constructive Solid Geometry (CSG) April 1, 2003 [Angel 9.10] Frank Pfenning Carnegie

### Werner Purgathofer

Einführung in Visual Computing 186.822 Visible Surface Detection Werner Purgathofer Visibility in the Rendering Pipeline scene objects in object space object capture/creation ti modeling viewing projection

### Hidden Surface Elimination: BSP trees

Hidden Surface Elimination: BSP trees Outline Binary space partition (BSP) trees Polygon-aligned 1 BSP Trees Basic idea: Preprocess geometric primitives in scene to build a spatial data structure such

### Spatial Data Structures

Spatial Data Structures Hierarchical Bounding Volumes Regular Grids Octrees BSP Trees Constructive Solid Geometry (CSG) [Angel 9.10] Outline Ray tracing review what rays matter? Ray tracing speedup faster

### Clipping & Culling. Lecture 11 Spring Trivial Rejection Outcode Clipping Plane-at-a-time Clipping Backface Culling

Clipping & Culling Trivial Rejection Outcode Clipping Plane-at-a-time Clipping Backface Culling Lecture 11 Spring 2015 What is Clipping? Clipping is a procedure for spatially partitioning geometric primitives,

### CS Computer Graphics: Hidden Surface Removal

CS 543 - Computer Graphics: Hidden Surface Removal by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) Hidden Surface Removal Drawing polygonal faces on screen consumes CPU cycles We cannot

### Incremental Form. Idea. More efficient if we look at d k, the value of the decision variable at x = k

Idea 1 m 0 candidates last pixel Note that line could have passed through any part of this pixel Decision variable: d = x(a-b) d is an integer d < 0 use upper pixel d > 0 use lower pixel Incremental Form

### Determination (Penentuan Permukaan Tampak)

Visible Surface Determination (Penentuan Permukaan Tampak) Visible Surface Determination 1/26 Outline Definisi VSD Tiga Kelas Algoritma VSD Kelas : Conservative Spatial Subdivison Bounding Volume Back

### Computer Graphics: 8-Hidden Surface Removal

Computer Graphics: 8-Hidden Surface Removal Prof. Dr. Charles A. Wüthrich, Fakultät Medien, Medieninformatik Bauhaus-Universität Weimar caw AT medien.uni-weimar.de Depth information Depth information is

### Two basic types: image-precision and object-precision. Image-precision For each pixel, determine which object is visable Requires np operations

walters@buffalo.edu CSE 480/580 Lecture 21 Slide 1 Visible-Surface Determination (Hidden Surface Removal) Computationaly expensive Two basic types: image-precision and object-precision For n objects and

### 8. Hidden Surface Elimination

8. Hidden Surface Elimination Identification and Removal of parts of picture that are not visible from a chosen viewing position. 1 8. Hidden Surface Elimination Basic idea: Overwriting Paint things in

### Hidden-Surface Removal.

Hidden-Surface emoval. Here we need to discover whether an object is visible or another one obscures it. here are two fundamental approaches to remove the hidden surfaces: ) he object-space approach )

### Drawing the Visible Objects

Drawing the Visible Objects We want to generate the image that the eye would see, given the objects in our space How do we draw the correct object at each pixel, given that some objects may obscure others

### INFOGR Computer Graphics. J. Bikker - April-July Lecture 11: Visibility. Welcome!

INFOGR Computer Graphics J. Bikker - April-July 2016 - Lecture 11: Visibility Welcome! Smallest Ray Tracers: Executable 5692598 & 5683777: RTMini_minimal.exe 2803 bytes 5741858: ASM_CPU_Min_Exe 994 bytes

### CSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Homework project #2 due this Friday, October

### Hidden Surfaces / Depth Test

University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner Hidden Surfaces / Depth Test http://www.ugrad.cs.ubc.ca/~cs314/vjan2016 Hidden Surface Removal 2 THE REDERIG PIPELIE

### Lecture 25 of 41. Spatial Sorting: Binary Space Partitioning Quadtrees & Octrees

Spatial Sorting: Binary Space Partitioning Quadtrees & Octrees William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://bit.ly/hgvxlh / http://bit.ly/evizre Public

### (Refer Slide Time 03:00)

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture #30 Visible Surface Detection (Contd ) We continue the discussion on Visible

### 8. Hidden Surface Elimination

-04-8 Hidden Surface Elimination To eliminate edges and surfaces not visible to the viewer Two categories: Object space methods: Image space methods: deal with object definitions directly Order the surfaces

### graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1 graphics pipeline sequence of operations to generate an image using object-order processing primitives processed one-at-a-time

### Visible Surface Determination: Intro

Visible Surface Determination: Intro VSD deals with determining what is visible in a scene 2 general approaches are used: 1. Object precision Older approach Designed for vector displays Determines visibility

### CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015 Announcements Project 4 due tomorrow Project

Last Time? The Traditional Graphics Pipeline Reading for Today A Practical Model for Subsurface Light Transport, Jensen, Marschner, Levoy, & Hanrahan, SIGGRAPH 2001 Participating Media Measuring BRDFs

### Intro to Modeling Modeling in 3D

Intro to Modeling Modeling in 3D Polygon sets can approximate more complex shapes as discretized surfaces 2 1 2 3 Curve surfaces in 3D Sphere, ellipsoids, etc Curved Surfaces Modeling in 3D ) ( 2 2 2 2

### CSE 167: Introduction to Computer Graphics Lecture #5: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

CSE 167: Introduction to Computer Graphics Lecture #5: Projection Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017 Announcements Friday: homework 1 due at 2pm Upload to TritonEd

### Robust Stencil Shadow Volumes. CEDEC 2001 Tokyo, Japan

Robust Stencil Shadow Volumes CEDEC 2001 Tokyo, Japan Mark J. Kilgard Graphics Software Engineer NVIDIA Corporation 2 Games Begin to Embrace Robust Shadows 3 John Carmack s new Doom engine leads the way

### CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department

CSE 690: GPGPU Lecture 2: Understanding the Fabric - Intro to Graphics Klaus Mueller Stony Brook University Computer Science Department Klaus Mueller, Stony Brook 2005 1 Surface Graphics Objects are explicitely

### VIII. Visibility algorithms (II)

VIII. Visibility algorithms (II) Hybrid algorithsms: priority list algorithms Find the object visibility Combine the operations in object space (examples: comparisons and object partitioning) with operations

### Chapter 11 Global Illumination. Part 1 Ray Tracing. Reading: Angel s Interactive Computer Graphics (6 th ed.) Sections 11.1, 11.2, 11.

Chapter 11 Global Illumination Part 1 Ray Tracing Reading: Angel s Interactive Computer Graphics (6 th ed.) Sections 11.1, 11.2, 11.3 CG(U), Chap.11 Part 1:Ray Tracing 1 Can pipeline graphics renders images

### Projection and viewing. Computer Graphics CSE 167 Lecture 4

Projection and viewing Computer Graphics CSE 167 Lecture 4 CSE 167: Computer Graphics Review: transformation from the object (or model) coordinate frame to the camera (or eye) coordinate frame Projection

### Interpolation using scanline algorithm

Interpolation using scanline algorithm Idea: Exploit knowledge about already computed color values. Traverse projected triangle top-down using scanline. Compute start and end color value of each pixel

### CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

CMSC427 Advanced shading getting global illumination by local methods Credit: slides Prof. Zwicker Topics Shadows Environment maps Reflection mapping Irradiance environment maps Ambient occlusion Reflection

### Rasterization Overview

Rendering Overview The process of generating an image given a virtual camera objects light sources Various techniques rasterization (topic of this course) raytracing (topic of the course Advanced Computer

### Visible-Surface Detection 1. 2IV60 Computer graphics set 11: Hidden Surfaces. Visible-Surface Detection 3. Visible-Surface Detection 2

Visible-urface Detection IV60 omputer graphics set : Hidden urfaces Problem: Given a scene and a projection, what can we see? Jack van Wijk TU/e Visible-urface Detection Terminology: Visible-surface detection

### Deferred Rendering Due: Wednesday November 15 at 10pm

CMSC 23700 Autumn 2017 Introduction to Computer Graphics Project 4 November 2, 2017 Deferred Rendering Due: Wednesday November 15 at 10pm 1 Summary This assignment uses the same application architecture

### Computer Graphics Lecture 11

1 / 14 Computer Graphics Lecture 11 Dr. Marc Eduard Frîncu West University of Timisoara May 15th 2012 2 / 14 Outline 1 Introduction 2 Transparency 3 Reflection 4 Recap 3 / 14 Introduction light = local

### Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

Surface Graphics Objects are explicitely defined by a surface or boundary representation (explicit inside vs outside) This boundary representation can be given by: - a mesh of polygons: 200 polys 1,000

### CS535 Fall Department of Computer Science Purdue University

Culling CS535 Fall 2010 Daniel G Aliaga Daniel G. Aliaga Department of Computer Science Purdue University Types of culling View frustum culling Visibility culling e.g., backface culling, portal tlculling,

### Hidden Surface Elimination Raytracing. Pre-lecture business. Outline for today. Review Quiz. Image-Space vs. Object-Space

Hidden Surface Elimination Raytracing Pre-lecture business Get going on pp4 Submit exam questions by Sunday CS148: Intro to CG Instructor: Dan Morris TA: Sean Walker August 2, 2005 Remote folks: let us

### CSCI 4620/8626. Computer Graphics Clipping Algorithms (Chapter 8-5 )

CSCI 4620/8626 Computer Graphics Clipping Algorithms (Chapter 8-5 ) Last update: 2016-03-15 Clipping Algorithms A clipping algorithm is any procedure that eliminates those portions of a picture outside

### More Hidden Surface Removal

Lecture 8 More Hidden Surface Removal Efficient Painter - binary space partition (BSP) tree Efficient Ray Casting - spatial partitioning (uniform, octrees) - bounding volumes Recall last lecture... front

### Lecture 17: Recursive Ray Tracing. Where is the way where light dwelleth? Job 38:19

Lecture 17: Recursive Ray Tracing Where is the way where light dwelleth? Job 38:19 1. Raster Graphics Typical graphics terminals today are raster displays. A raster display renders a picture scan line

### CMSC 435 Introductory Computer Graphics Pipeline. Announcements

CMSC 435 Introductory Computer Graphics Pipeline Penny Rheingans UMBC Wed-Sat on travel Announcements Limited email access Guest lecture Thurs by Wes Griffin on OpenGL Project 2 Status/issues 1 Graphics

### General Hidden Surface Removal Algorithms. Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science CS 460/560

Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced

### Computer Graphics. Lecture 9 Environment mapping, Mirroring

Computer Graphics Lecture 9 Environment mapping, Mirroring Today Environment Mapping Introduction Cubic mapping Sphere mapping refractive mapping Mirroring Introduction reflection first stencil buffer

### Triangle Rasterization

Triangle Rasterization Computer Graphics COMP 770 (236) Spring 2007 Instructor: Brandon Lloyd 2/07/07 1 From last time Lines and planes Culling View frustum culling Back-face culling Occlusion culling

### Clipping and Scan Conversion

15-462 Computer Graphics I Lecture 14 Clipping and Scan Conversion Line Clipping Polygon Clipping Clipping in Three Dimensions Scan Conversion (Rasterization) [Angel 7.3-7.6, 7.8-7.9] March 19, 2002 Frank

### Clipping. CSC 7443: Scientific Information Visualization

Clipping Clipping to See Inside Obscuring critical information contained in a volume data Contour displays show only exterior visible surfaces Isosurfaces can hide other isosurfaces Other displays can

### The Rendering Pipeline (1)

The Rendering Pipeline (1) Alessandro Martinelli alessandro.martinelli@unipv.it 30 settembre 2014 The Rendering Pipeline (1) Rendering Architecture First Rendering Pipeline Second Pipeline: Illumination

### Computer Graphics. - Rasterization - Philipp Slusallek

Computer Graphics - Rasterization - Philipp Slusallek Rasterization Definition Given some geometry (point, 2D line, circle, triangle, polygon, ), specify which pixels of a raster display each primitive

### Visualization Concepts

AML710 CAD LECTURE 36 Visualization Concepts Visible Lines and Surfaces Visibility - Hidden lines / Surfaces Many applications require the visibility determination for lines, points, edges, surfaces or

### Direct Rendering of Trimmed NURBS Surfaces

Direct Rendering of Trimmed NURBS Surfaces Hardware Graphics Pipeline 2/ 81 Hardware Graphics Pipeline GPU Video Memory CPU Vertex Processor Raster Unit Fragment Processor Render Target Screen Extended

### PowerVR Hardware. Architecture Overview for Developers

Public Imagination Technologies PowerVR Hardware Public. This publication contains proprietary information which is subject to change without notice and is supplied 'as is' without warranty of any kind.

### THE DEPTH-BUFFER VISIBLE SURFACE ALGORITHM

On-Line Computer Graphics Notes THE DEPTH-BUFFER VISIBLE SURFACE ALGORITHM Kenneth I. Joy Visualization and Graphics Research Group Department of Computer Science University of California, Davis To accurately

### 3D Rendering Pipeline (for direct illumination)

Clipping 3D Rendering Pipeline (for direct illumination) 3D Primitives 3D Modeling Coordinates Modeling Transformation Lighting 3D Camera Coordinates Projection Transformation Clipping 2D Screen Coordinates

### From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

From Vertices to Fragments: Rasterization Reading Assignment: Chapter 7 Frame Buffer Special memory where pixel colors are stored. System Bus CPU Main Memory Graphics Card -- Graphics Processing Unit (GPU)

### Binary Space Partition Trees. Overview. Binary Space Partitioning Trees (Fuchs, Kedem and Naylor `80)

Binary Space Partition Trees Anthony Steed, Yiorgos Chrysanthou 999-200, Celine Loscos 200, Jan Kautz 2007-2009 Overview Previous list priority algorithms fail in a number of cases, non of them is completely

### What is Clipping? Why do we Clip? Lecture 9 Comp 236 Spring Clipping is an important optimization

Clipping, Culling, Picking & Selection Trivial Rejection Outcode Clipping Plane-at-a-time Clipping Backface Culling Picking Selection Programming Assignment #2 Lecture 9 Comp 236 Spring 2005 What is Clipping?

### Shadow Algorithms. CSE 781 Winter Han-Wei Shen

Shadow Algorithms CSE 781 Winter 2010 Han-Wei Shen Why Shadows? Makes 3D Graphics more believable Provides additional cues for the shapes and relative positions of objects in 3D What is shadow? Shadow:

### Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development Chap. 5 Scene Management Overview Scene Management vs Rendering This chapter is about rendering

### Painter s Algorithm: Problems

Universit of British Columbia CPSC Computer Graphics Jan-Apr 0 Tamara Munzner Hidden Surfaces Clarification: Blinn-Phong Model onl change vs Phong model is to have the specular calculation to use (h n)

### Photorealistic 3D Rendering for VW in Mobile Devices

Abstract University of Arkansas CSCE Department Advanced Virtual Worlds Spring 2013 Photorealistic 3D Rendering for VW in Mobile Devices Rafael Aroxa In the past few years, the demand for high performance

### 3D Drawing Visibility & Rasterization. CS559 Spring 2016 Lecture 9 February 23, 2016

3D Drawing Visibility & Rasterization CS559 Spring 2016 Lecture 9 February 23, 2016 1. Put a 3D primitive in the World Modeling 2. Figure out what color it should be Shading 3. Position relative to the

### Physically-Based Laser Simulation

Physically-Based Laser Simulation Greg Reshko Carnegie Mellon University reshko@cs.cmu.edu Dave Mowatt Carnegie Mellon University dmowatt@andrew.cmu.edu Abstract In this paper, we describe our work on

### White Paper. Solid Wireframe. February 2007 WP _v01

White Paper Solid Wireframe February 2007 WP-03014-001_v01 White Paper Document Change History Version Date Responsible Reason for Change _v01 SG, TS Initial release Go to sdkfeedback@nvidia.com to provide

### Topics. From vertices to fragments

Topics From vertices to fragments From Vertices to Fragments Assign a color to every pixel Pass every object through the system Required tasks: Modeling Geometric processing Rasterization Fragment processing

### Parallel Triangle Rendering on a Modern GPU

Lecture 27: Parallel Triangle Rendering on a Modern GPU Parallel Computer Architecture and Programming CMU 15-418/15-618, Spring 2015 Let s draw a triangle on the screen Question 1: what pixels does the

### Real-Time Graphics Architecture

Real-Time Graphics Architecture Kurt Akeley Pat Hanrahan http://www.graphics.stanford.edu/courses/cs448a-01-fall Rasterization Outline Fundamentals Examples Special topics (Depth-buffer, cracks and holes,

### CSE 167: Introduction to Computer Graphics Lecture #5: Visibility, OpenGL

CSE 167: Introduction to Computer Graphics Lecture #5: Visibility, OpenGL Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016 Announcements Tomorrow: assignment 1 due Grading

### MIT EECS 6.837, Teller and Durand 1

MIT EECS 6.837, Teller and Durand 1 Clipping MIT EECS 6.837 Frédo Durand and Seth Teller Some slides and images courtesy of Leonard McMillan MIT EECS 6.837, Teller and Durand 2 Administrative Assignment

### C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE UGRAD.CS.UBC.C A/~CS314 Mikhail Bessmeltsev 1 WHAT IS RENDERING? Generating image from a 3D scene 2 WHAT IS RENDERING? Generating image

### Two-Dimensional Viewing. Chapter 6

Two-Dimensional Viewing Chapter 6 Viewing Pipeline Two-Dimensional Viewing Two dimensional viewing transformation From world coordinate scene description to device (screen) coordinates Normalization and

### Volume Rendering. Lecture 21

Volume Rendering Lecture 21 Acknowledgements These slides are collected from many sources. A particularly valuable source is the IEEE Visualization conference tutorials. Sources from: Roger Crawfis, Klaus

### Ulf Assarsson Department of Computer Engineering Chalmers University of Technology

Ulf Assarsson Department of Computer Engineering Chalmers University of Technology Tracing Photons One way to form an image is to follow rays of light from a point source finding which rays enter the lens

### Computer graphic -- Programming with OpenGL I

Computer graphic -- Programming with OpenGL I A simple example using OpenGL Download the example code "basic shapes", and compile and run it Take a look at it, and hit ESC when you're done. It shows the

### Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Shading Models There are two main types of rendering that we cover, polygon rendering ray tracing Polygon rendering is used to apply illumination models to polygons, whereas ray tracing applies to arbitrary

### CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo)

CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo) www.vucybarien.com Question No: 1 What are the two focusing methods in CRT? Explain briefly. Page no : 26 1. Electrostatic focusing

### Computer Graphics. - Clipping - Philipp Slusallek & Stefan Lemme

Computer Graphics - Clipping - Philipp Slusallek & Stefan Lemme Clipping Motivation Projected primitive might fall (partially) outside of the visible display window E.g. if standing inside a building Eliminate

### CSE528 Computer Graphics: Theory, Algorithms, and Applications

CSE528 Computer Graphics: Theory, Algorithms, and Applications Hong Qin State University of New York at Stony Brook (Stony Brook University) Stony Brook, New York 11794--4400 Tel: (631)632-8450; Fax: (631)632-8334

### PowerVR Series5. Architecture Guide for Developers

Public Imagination Technologies PowerVR Series5 Public. This publication contains proprietary information which is subject to change without notice and is supplied 'as is' without warranty of any kind.

### COMPUTER GRAPHICS COURSE. Rendering Pipelines

COMPUTER GRAPHICS COURSE Rendering Pipelines Georgios Papaioannou - 2014 A Rendering Pipeline Rendering or Graphics Pipeline is the sequence of steps that we use to create the final image Many graphics/rendering

### Contouring and Isosurfaces. Ronald Peikert SciVis Contouring 2-1

Contouring and Isosurfaces Ronald Peikert SciVis 2007 - Contouring 2-1 What are contours? Set of points where the scalar field s has a given value c: Examples in 2D: height contours on maps isobars on

### - Rasterization. Geometry. Scan Conversion. Rasterization

Computer Graphics - The graphics pipeline - Geometry Modelview Geometry Processing Lighting Perspective Clipping Scan Conversion Texturing Fragment Tests Blending Framebuffer Fragment Processing - So far,

### Volume Shadows Tutorial Nuclear / the Lab

Volume Shadows Tutorial Nuclear / the Lab Introduction As you probably know the most popular rendering technique, when speed is more important than quality (i.e. realtime rendering), is polygon rasterization.

### Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Orthogonal Projection Matrices 1 Objectives Derive the projection matrices used for standard orthogonal projections Introduce oblique projections Introduce projection normalization 2 Normalization Rather

### Data Structures and Algorithms

Data Structures and Algorithms Data Structures static arrays if sorted, supports binary search (O(log n)) linked lists - dynamic size doubly-linked lists - easier deletion queues - FIFO stacks - LIFO dequeues

### Lecture 13: Reyes Architecture and Implementation. Kayvon Fatahalian CMU : Graphics and Imaging Architectures (Fall 2011)

Lecture 13: Reyes Architecture and Implementation Kayvon Fatahalian CMU 15-869: Graphics and Imaging Architectures (Fall 2011) A gallery of images rendered using Reyes Image credit: Lucasfilm (Adventures

### Computer Graphics 7 - Rasterisation

Computer Graphics 7 - Rasterisation Tom Thorne Slides courtesy of Taku Komura www.inf.ed.ac.uk/teaching/courses/cg Overview Line rasterisation Polygon rasterisation Mean value coordinates Decomposing polygons

### 11 - Spatial Data Structures

11 - Spatial Data Structures cknowledgement: Marco Tarini Types of Queries Graphic applications often require spatial queries Find the k points closer to a specific point p (k-nearest Neighbours, knn)

### Real-Time Voxelization for Global Illumination

Lecture 26: Real-Time Voxelization for Global Illumination Visual Computing Systems Voxelization to regular grid Input: scene triangles Output: surface information at each voxel in 3D grid - Simple case: