Rasterization. Computer Graphics Fabio Pellacini and Steve Marschner

Size: px
Start display at page:

Download "Rasterization. Computer Graphics Fabio Pellacini and Steve Marschner"

Transcription

1 Rasterization 1

2 Approaches to rendering Rasterization: project each object onto image real-time rendering and GPUs foreach object in scene: foreach pixel in image: if object affects pixel: do_something() Raytracing: project each pixel onto the objects offline rendering, realistic rendering foreach pixel in image: foreach object in scene: if object affects pixel: do_something() 2

3 The graphics pipeline The standard approach to object-order graphics Implemented in hardware, e.g. graphics cards in PCs amazing performance: millions of triangles per frame We ll focus on an abstract version of hardware pipeline Pipeline because of the many stages Very parallelizable, leading to remarkable performance of graphics cards (many times the flops of CPUs at ~1/5 clock speed) Minimal support for shapes: points, lines, triangles other shapes need to be translated into the above ones Trend over the decades: toward minimal primitives simple, uniform, repetitive: good for parallelism 3

4 Pipeline VERTS. INDICES TRANSFORMED VERTICES ASSEMBLED PRIMITIVES PIXEL FRAGMENTS SHADED FRAGMENTS FINAL IMAGE VERTEX PROCESSING PRIMITIVE ASSEMBLY RASTERIZATION FRAGMENT PROCESSING FRAMEBUFFER PROCESSING Transform vertices and projection Assemble vertices into primitives Fragment generation Lighting z-buffer Compositing 4

5 Programmable Pipeline VERTS. INDICES TRANSFORMED VERTICES ASSEMBLED PRIMITIVES PIXEL FRAGMENTS SHADED FRAGMENTS FINAL IMAGE VERTEX PROCESSING PRIMITIVE ASSEMBLY RASTERIZATION FRAGMENT PROCESSING FRAMEBUFFER PROCESSING VERTEX SHADER n l+r r l 0 l r 0 2n b+t 0 t b b t 0 f+n 2fn n f f n CONSTANTS TEXTURES FRAGMENT SHADER

6 Projection 6

7 Pipeline VERTS. INDICES TRANSFORMED VERTICES ASSEMBLED PRIMITIVES PIXEL FRAGMENTS SHADED FRAGMENTS FINAL IMAGE VERTEX PROCESSING PRIMITIVE ASSEMBLY RASTERIZATION FRAGMENT PROCESSING FRAMEBUFFER PROCESSING Transform vertices and projection Assemble vertices into primitives Fragment generation Lighting z-buffer Compositing 7

8 Parallel projection To render an image of a 3D scene, we project it onto a plane Simplest kind of projection is parallel projection image projection plane scene 8

9 Orthographic projection projection plane parallel to a coordinate plane projection direction perpendicular to projection plane [Carlbom & Paciorek 78] 9

10 Off-axis parallel projection [Carlbom & Paciorek 78] axonometric: projection plane perpendicular to projection direction but not parallel to coordinate planes oblique: projection plane parallel to a coordinate plane but not perpendicular to projection direction. 10

11 Orthographic projection In graphics usually we lump axonometric with orthographic Projection plane perpendicular to projection direction Image height determines size of objects in image 11

12 Orthographic projection In graphics usually we lump axonometric with orthographic Projection plane perpendicular to projection direction Image height determines size of objects in image 11

13 Orthographic projection In graphics usually we lump axonometric with orthographic Projection plane perpendicular to projection direction Image height determines size of objects in image 11

14 Orthographic projection In graphics usually we lump axonometric with orthographic Projection plane perpendicular to projection direction Image height determines size of objects in image 11

15 Oblique projection View direction no longer coincides with projection plane normal Objects at different distances still same size Objects are shifted in the image depending on their depth 12

16 Oblique projection View direction no longer coincides with projection plane normal Objects at different distances still same size Objects are shifted in the image depending on their depth 12

17 Oblique projection View direction no longer coincides with projection plane normal Objects at different distances still same size Objects are shifted in the image depending on their depth 12

18 Oblique projection View direction no longer coincides with projection plane normal Objects at different distances still same size Objects are shifted in the image depending on their depth 12

19 History of projection Ancient times: Greeks wrote about laws of perspective Renaissance: perspective is adopted by artists [Duccio c. 1308] 13

20 History of projection [da Vinci c. 1498] Later Renaissance: perspective formalized precisely 14

21 History of projection [Richard Zakia] 15

22 Perspective projection one-point: projection plane parallel to a coordinate plane two-point: projection plane parallel to one coordinate axis [Carlbom & Paciorek 78] three-point: projection plane not parallel to a coordinate axis 16

23 Perspective projection Perspective is projection by lines through a point Magnification determined by: image height h, object depth z, image plane distance d Corresponds to common cameras lenses y 0 = dy/z 17

24 Perspective projection Perspective is projection by lines through a point Magnification determined by: image height h, object depth z, image plane distance d Corresponds to common cameras lenses y 0 = dy/z 17

25 Perspective projection Perspective is projection by lines through a point Magnification determined by: image height h, object depth z, image plane distance d Corresponds to common cameras lenses y 0 = dy/z 17

26 Perspective projection Perspective is projection by lines through a point Magnification determined by: image height h, object depth z, image plane distance d Corresponds to common cameras lenses y 0 = dy/z 17

27 Perspective distortions Lengths and length ratios are not preserved Angles are not preserved [Carlbom & Paciorek 78] 18

28 Shifted perspective projection Perspective with image plane not perpendicular to view direction Like cropping an off-center rectangle from normal perspective Corresponds to view cameras in photography 19

29 Shifted perspective projection Perspective with image plane not perpendicular to view direction Like cropping an off-center rectangle from normal perspective Corresponds to view cameras in photography 19

30 Shifted perspective projection Perspective with image plane not perpendicular to view direction Like cropping an off-center rectangle from normal perspective Corresponds to view cameras in photography 19

31 Shifted perspective projection Perspective with image plane not perpendicular to view direction Like cropping an off-center rectangle from normal perspective Corresponds to view cameras in photography 19

32 Why shifted perspective? Control convergence of parallel lines Standard example: architecture buildings are taller than you, so you look up top of building is farther away, so it looks smaller Solution: make projection plane parallel to facade top of building is the same distance from the projection plane Same perspective effects can be achieved using post-processing (though not the focus effects) choice of which rays vs. arrangement of rays in image 20

33 [Philip Greenspun] camera tilted up: converging vertical lines 21

34 [Philip Greenspun] lens shifted up: parallel vertical lines 22

35 Computing Projections 23

36 Pipeline of transformations object space camera space screen space modeling transformation camera transformation projection transformation viewport transformation world space canonical view volume 24

37 Mathematics of projection Projections defined in eye coords: assume eye point at 0 and plane perpendicular to z Orthographic case: just ignore z Perspective case: scale diminishes with z and increases with d Use matrix notation eventually containing all transformations from local coordinate to pixel coordinates Screen space defined in pixel units [0,nx]x[0,ny] Canonical view volume: [-1,1] 3 25

38 Homogeneous coordinates Use a modified notation, indicating a point in 3D as a 4D vector with the last coordinate set to 1 Can allow arbitrary 4th coordinate w as well when w is not zero, we can divide by w therefore these points represent normal points when w is zero, it s a point at infinity, a.k.a. a direction In graphics, the main reason for homogeneous coordinates is perspective projection x wx x p = 4y5 6y 7 4z5 6wy 7 4wz5 z 1 w 26

39 Viewing transformation the camera frame rewrites all coordinates in eye space 27

40 Viewing transform Projections transforms are written in eye coordinates Need to transform in that space before performing projection Use the matrix corresponding to the inverse of the camera frame Remember that geometry would originally have been in the object s local coordinates; transform into world coordinates with the instance frame p eye = M view p world F = {x, y, z, o}! M view = apple x y z o

41 Orthographic projection ex. Example: assume height is 1, then transform by ignoring z Keep z around for later x canonical y canonical z canonical 1 p canonical = M ortho p eye x eye = 6y eye 7 4z eye 5 = x eye y eye z eye

42 Orthographic view volume 30

43 Orthographic view frustum 31

44 Orthographic projection Specify view by left, right, top, bottom Add two clipping planes that constrain the view volume in z near plane: parallel to view plane; things between it and the viewpoint will not be rendered far plane: also parallel; things behind it will not be rendered partly to remove unnecessary stuff (e.g. behind the camera) mostly required constrain the range of depths (we ll see later) 32

45 Orthographic projection Matrix that maps the view volume to the canonical view volume M ortho = p canonical = M ortho p eye 2 2 r+l r l 0 0 r l 2 t+b 6 0 t b 0 t b n f n+f n f

46 Viewport transform To draw in image, need coordinates in pixel units Exactly the opposite of mapping (i,j) to (u,v) in ray generation In 3D, carry z along by adding one row and one column p screen = M viewport p canonical M viewport = n x n x 1 2 n y n 0 y

47 [Ray Verrier] 35

48 Perspective projection similar triangles: 36

49 Perspective projection Example: to implement perspective, just move z to w 37

50 Perspective view volume 38

51 Perspective view volume 39

52 Perspective view frustum 40

53 Projecting depth Perspective has a varying denominator can t preserve depth! Compromise: preserve depth on near and far planes That is, choose a and b so that z (n) = n and z (f) = f. n n n + f fn

54 Perspective projection Perspective divide from the equation before Combine with rescaling to fit the view volume (orthographic) p canonical = M persp p eye M persp = n l+r r l 0 2n 0 t b l r 0 b+t b t 0 f+n n f 2fn f n

55 Pipeline of transformations object space camera space screen space modeling transformation camera transformation projection transformation viewport transformation world space canonical view volume 43

56 Pipeline of transformations Start with coordinates in object s local coordinates p local Transform into world coords Transform into eye coords Project into canonical coords Transform to pixels coords p world = M instance p local p eye = M view p world p canonical =(M persp or M ortho )p eye p screen = M viewport p canonical p screen = M viewport M proj M view M instance p local object space camera space screen space modeling transformation camera transformation projection viewport transformation transformation world space canonical view volume 44

57 Rasterization 45

58 Pipeline VERTS. INDICES TRANSFORMED VERTICES ASSEMBLED PRIMITIVES PIXEL FRAGMENTS SHADED FRAGMENTS FINAL IMAGE VERTEX PROCESSING PRIMITIVE ASSEMBLY RASTERIZATION FRAGMENT PROCESSING FRAMEBUFFER PROCESSING Transform vertices and projection Assemble vertices into primitives Fragment generation Lighting z-buffer Compositing 46

59 Rasterization First job: enumerate the pixels covered by a primitive simple, aliased definition: pixels whose centers fall inside Second job: interpolate values across the primitive e.g. colors computed at vertices e.g. normals at vertices e.g. texture coordinates 47

60 Rasterizing lines Define line as a rectangle Specify by two endpoints Ideal image: black inside, white outside 48

61 Rasterizing lines Define line as a rectangle Specify by two endpoints Ideal image: black inside, white outside 48

62 Point sampling Approximate rectangle by drawing all pixels whose centers fall within the line Problem: sometimes turns on adjacent pixels 49

63 Point sampling Approximate rectangle by drawing all pixels whose centers fall within the line Problem: sometimes turns on adjacent pixels 49

64 Point sampling 50

65 Midpoint alg. (Bresenham) Point sampling unit width rectangle leads to uneven line width Define line width parallel to pixel grid That is, turn on the single nearest pixel in each column Note that 45º lines are ånow thinner 51

66 Midpoint alg. (Bresenham) Point sampling unit width rectangle leads to uneven line width Define line width parallel to pixel grid That is, turn on the single nearest pixel in each column Note that 45º lines are ånow thinner 51

67 Midpoint alg. (Bresenham) Point sampling unit width rectangle leads to uneven line width Define line width parallel to pixel grid That is, turn on the single nearest pixel in each column Note that 45º lines are ånow thinner 51

68 Midpoint alg. 52

69 Algorithms for drawing lines Line equation: y = b + m x Simple algorithm: evaluate line equation per column Assume x0 < x1, 0 m 1 for (x : ceil(x0) floor(x1)) { auto y = b + m*x; output(x, round(y)); } y = x 53

70 Optimizing line drawing Multiplying and rounding is slow At each pixel the only options are E and NE d = m(x + 1) + b y d > 0.5 decides between E and NE 54

71 Optimizing line drawing d = m(x + 1) + b y Only need to update d for integer steps in x and y Do that with addition Known as DDA (digital differential analyzer) 55

72 Midpoint line algorithm x = ceil(x0); y = round(m*x + b); d = m*(x + 1) + b y; while(x < floor(x1)) { if(d > 0.5) { y += 1; d = 1; } x += 1; d += m; output(x, y); } 56

73 Linear interpolation We often attach attributes to vertices e.g. computed diffuse color of a hair being drawn using lines want color to vary smoothly along a chain of line segments Recall basic definition 1D: f(x) = (1 α) y0 + α y1 where α = (x x0) / (x1 x0) In the 2D case of a line segment, alpha is just the fraction of the distance from (x0, y0) to (x1, y1) 57

74 Linear interpolation Pixels are not exactly on the line Define 2D function by projection on line This is linear in 2D, therefore can use DDA to interpolate 58

75 Linear interpolation Pixels are not exactly on the line Define 2D function by projection on line This is linear in 2D, therefore can use DDA to interpolate 58

76 Linear interpolation Pixels are not exactly on the line Define 2D function by projection on line This is linear in 2D, therefore can use DDA to interpolate 58

77 Alternate interpretation We are updating d and α as we step from pixel to pixel d tells us how far from the line we are α tells us how far along the line we are So d and α are coordinates in a coordinate system oriented to the line 59

78 Alternate interpretation View loop as visiting all pixels the line passes through Interpolate d and α for each pixel Only output fragment if pixel is in band This makes linear interpolation the primary operation 60

79 Pixel-walk line rasterization x = ceil(x0); y = round(m*x + b); d = m*x + b y; while(x < floor(x1)) { if(d > 0.5) y += 1; d = 1; else x += 1; d += m; if( 0.5 < d 0.5) output(x, y); } 61

80 Rasterizing triangles The most common case in most applications with good antialiasing can be the only case some systems render a line as two skinny triangles Triangle represented by three vertices Simple way to think of algorithm follows the pixel-walk interpretation of line rasterization walk from pixel to pixel over (at least) the polygon s area evaluate linear functions as you go use those functions to decide which pixels are inside 62

81 Rasterizing triangles Input: three 2D points (the triangle s vertices in pixel space) (x0, y0); (x1, y1); (x2, y2) parameter values at each vertex q00,, q0n; q10,, q1n; q20,, q2n Output: a list of fragments, each with the integer pixel coordinates (x, y) interpolated parameter values q0,, qn 63

82 Rasterizing triangles 1. evaluation of linear functions on pixel grid 2. functions defined by parameter values at vertices 3. using extra parameters to determine fragment set 64

83 Incremental linear evaluation A linear (affine, really) function on the plane is: Linear functions are efficient to evaluate on a grid: 65

84 Incremental linear evaluation lineval(xm, xm, ym, ym, cx, cy, ck) { // setup auto qrow = cx*xm + cy*ym + ck; } // traversal for(auto y : range(ym, ym)) { auto qpix = qrow; for(auto x : range(xm, xm)) { output(x, y, qpix); qpix += cx; } qrow += cy; } cx =.005; cy =.005; ck = 0 (image size 100x100) 66

85 Rasterizing triangles 1. evaluation of linear functions on pixel grid 2. functions defined by parameter values at vertices 3. using extra parameters to determine fragment set 67

86 Defining parameter functions To interpolate parameters across a triangle we need to find the cx, cy, and ck that define the (unique) linear function that matches the given values at all 3 vertices We can solve as a linear system of 3 equations for 3 unknowns: (each states that the function agrees with the given value at one vertex) Leading to a 3x3 matrix equation for the coefficients: (singular iff triangle is degenerate) 68

87 Defining parameter functions More efficient version: shift origin to (x0, y0) q(x, y) = c x (x x 0 ) + c y (y y 0 ) + q 0 q(x 1, y 1 ) = c x (x 1 x 0 ) + c y (y 1 y 0 ) + q 0 = q 1 q(x 2, y 2 ) = c x (x 2 x 0 ) + c y (y 2 y 0 ) + q 0 = q 2 Now this is a 2x2 linear system (since q0 falls out): Solve using Cramer s rule (see Shirley): 69

88 Defining parameter functions lininterp(xm, xm, ym, ym, x0, y0, q0, x1, y1, q1, x2, y2, q2) { // setup det = (x1 x0)*(y2 y0) (x2 x0)*(y1 y0); cx = ((q1 q0)*(y2 y0) (q2 q0)*(y1 y0)) / det; cy = ((q2 q0)*(x1 x0) (q1 q0)*(x2 x0)) / det; qrow = cx*(xm x0)+cy*(ym y0)+q0; // traversal (same as before) for(auto y : range(ym, ym)) { auto qpix = qrow; for(auto x : range(xm, xm)) { output(x, y, qpix); qpix += cx; } qrow += cy; } } 70

89 Interpolating several lininterp(xm, xm, ym, ym, n, x0, y0, q0[], x1, y1, q1[], x2, y2, q2[]) { // setup for(auto k : range(0, n 1)) { // compute cx[k], cy[k], qrow[k] // from q0[k], q1[k], q2[k] // traversal for(auto y : range(ym, ym)) { for(auto k : range(1, n)) qpix[k] = qrow[k]; for(auto x : range(xm, xm)) { output(x, y, qpix); for(auto k : range(1, n)) qpix[k] += cx[k]; } for(auto k : range(1, n)) qrow[k] += cy[k]; } } 71

90 Rasterizing triangles 1. evaluation of linear functions on pixel grid 2. functions defined by parameter values at vertices 3. using extra parameters to determine fragment set 72

91 Clipping to the triangle Interpolate three barycentric coordinates across the plane recall each barycentric coord is 1 at one vert. and 0 at the other two Output fragments only when all three are > 0. 73

92 Pixel-walk (Pineda) rasterization Conservatively visit a superset of the pixels you want Interpolate linear functions Use those functions to determine when to emit a fragment 74

93 Rasterizing triangles Exercise caution with rounding and arbitrary decisions Need to visit these pixels once But it s important not to visit them twice! 75

94 Clipping Rasterizer tends to assume triangles are on screen particularly problematic to have triangles crossing the plane z = 0 After projection, before perspective divide clip against the planes x, y, z = 1, 1 (6 planes) primitive operation: clip triangle against axis-aligned plane 76

95 Clipping a triangle against a plane 4 cases, based on sidedness of vertices all in (keep) all out (discard) one in, two out (one clipped triangle) two in, one out (two clipped triangles) 77

96 Hidden Surface Removal 78

97 Pipeline VERTS. INDICES TRANSFORMED VERTICES ASSEMBLED PRIMITIVES PIXEL FRAGMENTS SHADED FRAGMENTS FINAL IMAGE VERTEX PROCESSING PRIMITIVE ASSEMBLY RASTERIZATION FRAGMENT PROCESSING FRAMEBUFFER PROCESSING Transform vertices and projection Assemble vertices into primitives Fragment generation Lighting z-buffer Compositing 79

98 Hidden surface elimination We have discussed how to map primitives to image space projection and perspective are depth cues occlusion is another very important cue 80

99 Painter s algorithm Simplest way to do hidden surfaces Draw from back to front, use overwriting in framebuffer [WikimediaCommons] 81

100 Painter s algorithm Simplest way to do hidden surfaces Draw from back to front, use overwriting in framebuffer 82

101 Painter s algorithm Simplest way to do hidden surfaces Draw from back to front, use overwriting in framebuffer 82

102 Painter s algorithm Simplest way to do hidden surfaces Draw from back to front, use overwriting in framebuffer 82

103 Painter s algorithm Simplest way to do hidden surfaces Draw from back to front, use overwriting in framebuffer 82

104 Painter s algorithm Simplest way to do hidden surfaces Draw from back to front, use overwriting in framebuffer 82

105 Painter s algorithm Simplest way to do hidden surfaces Draw from back to front, use overwriting in framebuffer 82

106 Painter s algorithm Amounts to a topological sort of the graph of occlusions But when the graph has cycles, no sort is valid [WikimediaCommons] 83

107 The z buffer In many (most) applications maintaining a z sort is too expensive changes all the time as the view changes many data structures exist, but complex Solution: draw in any order, keep track of closest object at pixel allocate extra channel per pixel to keep track of closest depth when drawing, compare object s depth to current closest depth and discard if greater this works just like any other compositing operation Another example of a memory-intensive brute force approach that works and has become the standard 84

108 The z buffer [WikimediaCommons] 85

109 Precision in z buffer Z precision is distributed between the near and far clipping planes this is why these planes have to exist also why you can t always just set them to very small and very large distances Generally use z (not world z) in z buffer 86

110 Interpolating in projection linear interp. in screen space linear interp. in world (eye) space 87

111 Interpolating in projection linear interp. in screen space linear interp. in world (eye) space 87

112 Interpolating in projection linear interp. in screen space linear interp. in world (eye) space 87

113 Interpolating in projection linear interp. in screen space linear interp. in world (eye) space 87

114 Interpolating in projection linear interp. in screen space linear interp. in world (eye) space 87

115 Interpolating in projection linear interp. in screen space linear interp. in world (eye) space 87

116 Interpolating in projection linear interp. in screen space linear interp. in world (eye) space 87

117 Minimal Pipeline Example 88

118 Pipeline for minimal operation Vertex stage (input: position / vtx; color / tri) transform position (object to screen space) pass through color Rasterizer pass through color Fragment stage (output: color) write to color planes 89

119 Result of minimal pipeline 90

120 Pipeline for basic z buffer Vertex stage (input: position / vtx; color / tri) transform position (object to screen space) pass through color Rasterizer interpolated parameter: z (screen z) pass through color Fragment stage (output: color, z ) write to color planes only if interpolated z < current z 91

121 Result of z-buffer pipeline 92

122 Flat shading Shade using the real normal of the triangle Leads to constant shading and faceted appearance [Foley et al.] 93

123 Pipeline for flat shading Vertex stage (input: position / vtx; color and normal / tri) transform position and normal (object to eye space) compute shaded color per triangle using normal transform position (eye to screen space) Rasterizer interpolated parameters: z (screen z) pass through color Fragment stage (output: color, z ) write to color planes only if interpolated z < current z 94

124 Result of flat-shading pipeline 95

125 Transforming normal vectors Transforming surface normals differences of points (and therefore tangents) transform OK normals do not --> use inverse transpose matrix 96

126 Transforming normal vectors Transforming surface normals differences of points (and therefore tangents) transform OK normals do not --> use inverse transpose matrix 96

127 Gouraud shading Compute colors at vertices using vertex normals Interpolate colors across triangles [Foley et al.] 97

128 Pipeline for Gouraud shading Vertex stage (input: position, color, and normal / vtx) transform position and normal (object to eye space) compute shaded color per vertex transform position (eye to screen space) Rasterizer interpolated parameters: z (screen z); r, g, b color Fragment stage (output: color, z ) write to color planes only if interpolated z < current z 98

129 Result of Gouraud shading 99

130 Local vs. infinite viewer, light Phong illumination requires geometric information: light vector (function of position) eye vector (function of position) surface normal (from application) Light and eye vectors change per vertex 100

131 Local vs. infinite viewer, light Look at case when eye or light is far away: distant light source: nearly parallel illumination distant eye point: nearly orthographic projection in both cases, eye or light vector changes very little Optimization: approximate eye and/or light as infinitely far away 101

132 Directional light Light vector always points in the same direction many pipelines are faster if you use directional lights 102

133 Directional light Light vector always points in the same direction many pipelines are faster if you use directional lights 102

134 Infinite viewer Orthographic camera: projection direction is constant Infinite viewer : even with perspective, we can approximate eye vector using the image plane normal 103

135 Non-diffuse Gouraud shading Can apply Gouraud shading to any illumination model Results are not so good for specular shading [Foley et al.] 104

136 Per-pixel (Phong) shading Get higher quality by interpolating the normal just as easy as interpolating the color but now we are evaluating the illumination model per pixel rather than per vertex (and normalizing the normal first) in pipeline, this means we are moving illumination from the vertex processing stage to the fragment processing stage 105

137 Per-pixel (Phong) shading Bottom line: produces much better highlights [Foley et al.] 106

138 Pipeline for per-pixel shading Vertex stage (input: position, color, and normal / vtx) transform position and normal (object to eye space) transform position (eye to screen space) pass through color Rasterizer interpolated parameters: z (screen z); r, g, b color; x, y, z normal Fragment stage (output: color, z ) compute shading using interpolated color and normal write to color planes only if interpolated z < current z 107

139 Result of per-pixel shading 108

140 Antialiasing 109

141 Aliasing continuous image defined by ray tracing procedure continuous image defined by a bunch of black rectangles 110

142 Rasterizing lines Define line as a rectangle Specify by two endpoints Ideal image: black inside, white outside 111

143 Rasterizing lines Define line as a rectangle Specify by two endpoints Ideal image: black inside, white outside 111

144 Point sampling Approximate rectangle by drawing all pixels whose centers fall within the line Problem: all-or-nothing leads to jaggies This is sampling with no filter (aka. point sampling) 112

145 Point sampling Approximate rectangle by drawing all pixels whose centers fall within the line Problem: all-or-nothing leads to jaggies This is sampling with no filter (aka. point sampling) 112

146 Point sampling 113

147 Aliasing Point sampling is fast and simple But the lines have stair steps and variations in width This is an aliasing phenomenon: sharp edges of line contain high frequencies Introduces features to image that are not supposed to be there! 114

148 Antialiasing Point sampling makes an all-or-nothing choice in each pixel therefore steps are inevitable when the choice changes yet another example where discontinuities are bad On bitmap devices this is necessary hence high resolutions required 600+ dpi in laser printers to make aliasing invisible On continuous-tone devices we can do better 115

149 Antialiasing Basic idea: replace is the image black at the pixel center? with how much is pixel covered by black? Replace yes/no question with quantitative question. 116

150 Box filtering Pixel intensity is proportional to area of overlap with square pixel area Also called unweighted area averaging 117

151 Box filtering by supersampling Compute coverage fraction by counting subpixels Simple and accurate But slow 118

152 Box filtering 119

153 Weighted filtering Box filtering problem: treats area near edge same as area near center results in pixel turning on too abruptly Alternative: weight area by a smooth function unweighted averaging corresponds to using a box function a gaussian is a popular choice of smooth filter important property: normalization (unit integral) 120

154 Weighted filtering Compute filtering integral by summing filter values for covered subpixels Simple, accurate But really slow 121

155 Weighted filtering Compute filtering integral by summing filter values for covered subpixels Simple, accurate But really slow 121

156 Gaussian filtering 122

157 Filter comparison Point sampling Box filtering Gaussian filtering 123

158 Supersampling vs. multisampling Supersampling is terribly expensive GPUs use an approximation called multisampling Compute one shading value per pixel Store it at many subpixel samples, each with its own depth 124

159 Multisample rasterization Each fragment carries several (color,depth) samples shading is computed per-fragment depth test is resolved per-sample final color is average of sample colors single- sample multi- sample [ 125

160 Antialiasing textures With multisampling, we evaluate textures once per fragment Need to filter the texture somehow since perspective produces high minification Solution: render textures with one (few) samples/pixel but filter them first [Akenine-Möller et al. 2008] 126

161 Solution: pixel filtering point sampling area averaging [Akenine-Möller et al. 2008] 127

162 Pixel footprints image space texture space [Akenine-Möller et al. 2008] 128

163 Pixel vs. texels Optimal viewing distance: one-to-one mapping between pixel area and texel area When closer, magnification: each pixel is a small part of the texel When farther, minification: each pixel includes many texels [Akenine-Möller et al. 2008] upsampling magnification downsampling minification 129

164 Filter size by Jacobian image space texture space (0,1) ( u y, v ) y ( u x, v ) x (1,0) y x v ψ(x) x u 130

165 Mipmap pyramid MIP Maps: (Multum in Parvo) Store a hierarchy of pre-filtered versions of texture While rendering, use the version with texel size closer to pixel size [Akenine-Möller et al. 2002] 131

166 Compute Mipmaps Average over 4x4 neighbors or use Gaussian filtering Storage increase by 33% [WikimediaCommons] 132

167 Point sampling 133

168 Point sampling 133

169 Gaussian filtering 134

170 Gaussian filtering 134

171 Mipmap filtering 135

172 Mipmap filtering 135

173 Lighting with Textures 136

174 Lighting In rasterization, no access to the geometry during shading significantly better efficiency, parallelism, memory locality Shadows need occluder information Reflections need recursive evaluation Option 1: drop pipeline done in offline rendering, not any time soon for real-time Option 2: cheat the lighting use approximate, or even plainly wrong, alsorithms run data multiple times through the pipeline 137

175 Shadow mapping Pass 1: Render from the light, store z buffer as a depth texture Pass 1: Render from eye, check if distance to the light computed in fragment shader is less then the one saved in the depth texture [NVisia Cg Tutorial] 138

176 Shadow mapping Render from light Store z-buffer in shadow map Render from eye [WikimediaCommons] Project shadow map Test if shadow map closer than light Multiply by color for final image 139

177 Shadow mapping artifacts Pixelation due to mismatched resolution [Fernando et al.] 140

178 Shadow mapping artifacts [Fernando et al.] Pixelation due to mismatched resolution 141

179 Reflection mapping [M. C. Escher] [Paul Debevec] 142

180 Reflection mapping Pass 1-6: Render from object center into a 360 panorama using 6 cameras arranged as a cube often store as cube map Pass 7: Render from eye, look up the texture in mirror direction [Paul Haeberly] 143

181 Reflection mapping Pass 1-6: Render from object center into a 360 panorama using 6 cameras arranged as a cube often store as cube map [WikimediaCommons] 144

182 Reflection mapping artifacts Geometric distortions: works only at the center of projection Visibility is missing: reflect what it should not [WikimediaCommons] 145

Rasterization. CS4620 Lecture 13

Rasterization. CS4620 Lecture 13 Rasterization CS4620 Lecture 13 2014 Steve Marschner 1 The graphics pipeline The standard approach to object-order graphics Many versions exist software, e.g. Pixar s REYES architecture many options for

More information

Rasterization. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 16

Rasterization. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 16 Rasterization CS 4620 Lecture 16 1 Announcements A3 due on Thu Will send mail about grading once finalized 2 Pipeline overview you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX

More information

Surface shading: lights and rasterization. Computer Graphics CSE 167 Lecture 6

Surface shading: lights and rasterization. Computer Graphics CSE 167 Lecture 6 Surface shading: lights and rasterization Computer Graphics CSE 167 Lecture 6 CSE 167: Computer Graphics Surface shading Materials Lights Rasterization 2 Scene data Rendering pipeline Modeling and viewing

More information

The graphics pipeline. Pipeline and Rasterization. Primitives. Pipeline

The graphics pipeline. Pipeline and Rasterization. Primitives. Pipeline The graphics pipeline Pipeline and Rasterization CS4620 Lecture 9 The standard approach to object-order graphics Many versions exist software, e.g. Pixar s REYES architecture many options for quality and

More information

Pipeline and Rasterization. COMP770 Fall 2011

Pipeline and Rasterization. COMP770 Fall 2011 Pipeline and Rasterization COMP770 Fall 2011 1 The graphics pipeline The standard approach to object-order graphics Many versions exist software, e.g. Pixar s REYES architecture many options for quality

More information

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11 Pipeline Operations CS 4620 Lecture 11 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives to pixels RASTERIZATION

More information

Pipeline Operations. CS 4620 Lecture 14

Pipeline Operations. CS 4620 Lecture 14 Pipeline Operations CS 4620 Lecture 14 2014 Steve Marschner 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives

More information

Rasterization. CS4620/5620: Lecture 12. Announcements. Turn in HW 1. PPA 1 out. Friday lecture. History of graphics PPA 1 in 4621.

Rasterization. CS4620/5620: Lecture 12. Announcements. Turn in HW 1. PPA 1 out. Friday lecture. History of graphics PPA 1 in 4621. CS4620/5620: Lecture 12 Rasterization 1 Announcements Turn in HW 1 PPA 1 out Friday lecture History of graphics PPA 1 in 4621 2 The graphics pipeline The standard approach to object-order graphics Many

More information

Pipeline Operations. CS 4620 Lecture 10

Pipeline Operations. CS 4620 Lecture 10 Pipeline Operations CS 4620 Lecture 10 2008 Steve Marschner 1 Hidden surface elimination Goal is to figure out which color to make the pixels based on what s in front of what. Hidden surface elimination

More information

CS4620/5620: Lecture 14 Pipeline

CS4620/5620: Lecture 14 Pipeline CS4620/5620: Lecture 14 Pipeline 1 Rasterizing triangles Summary 1! evaluation of linear functions on pixel grid 2! functions defined by parameter values at vertices 3! using extra parameters to determine

More information

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

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

More information

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

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

More information

3D Viewing. CS 4620 Lecture 8

3D Viewing. CS 4620 Lecture 8 3D Viewing CS 46 Lecture 8 13 Steve Marschner 1 Viewing, backward and forward So far have used the backward approach to viewing start from pixel ask what part of scene projects to pixel explicitly construct

More information

Rasterization. COMP 575/770 Spring 2013

Rasterization. COMP 575/770 Spring 2013 Rasterization COMP 575/770 Spring 2013 The Rasterization Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives to

More information

3D Viewing. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 9

3D Viewing. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 9 3D Viewing CS 46 Lecture 9 Cornell CS46 Spring 18 Lecture 9 18 Steve Marschner 1 Viewing, backward and forward So far have used the backward approach to viewing start from pixel ask what part of scene

More information

Rasterization Overview

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

More information

CS 130 Final. Fall 2015

CS 130 Final. Fall 2015 CS 130 Final Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying

More information

3D Rasterization II COS 426

3D Rasterization II COS 426 3D Rasterization II COS 426 3D Rendering Pipeline (for direct illumination) 3D Primitives Modeling Transformation Lighting Viewing Transformation Projection Transformation Clipping Viewport Transformation

More information

Reading. 18. Projections and Z-buffers. Required: Watt, Section , 6.3, 6.6 (esp. intro and subsections 1, 4, and 8 10), Further reading:

Reading. 18. Projections and Z-buffers. Required: Watt, Section , 6.3, 6.6 (esp. intro and subsections 1, 4, and 8 10), Further reading: Reading Required: Watt, Section 5.2.2 5.2.4, 6.3, 6.6 (esp. intro and subsections 1, 4, and 8 10), Further reading: 18. Projections and Z-buffers Foley, et al, Chapter 5.6 and Chapter 6 David F. Rogers

More information

CEng 477 Introduction to Computer Graphics Fall 2007

CEng 477 Introduction to Computer Graphics Fall 2007 Visible Surface Detection CEng 477 Introduction to Computer Graphics Fall 2007 Visible Surface Detection Visible surface detection or hidden surface removal. Realistic scenes: closer objects occludes the

More information

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

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

More information

CHAPTER 1 Graphics Systems and Models 3

CHAPTER 1 Graphics Systems and Models 3 ?????? 1 CHAPTER 1 Graphics Systems and Models 3 1.1 Applications of Computer Graphics 4 1.1.1 Display of Information............. 4 1.1.2 Design.................... 5 1.1.3 Simulation and Animation...........

More information

Graphics Pipeline 2D Geometric Transformations

Graphics Pipeline 2D Geometric Transformations Graphics Pipeline 2D Geometric Transformations CS 4620 Lecture 8 1 Plane projection in drawing Albrecht Dürer 2 Plane projection in drawing source unknown 3 Rasterizing triangles Summary 1 evaluation of

More information

Introduction to Visualization and Computer Graphics

Introduction to Visualization and Computer Graphics Introduction to Visualization and Computer Graphics DH2320, Fall 2015 Prof. Dr. Tino Weinkauf Introduction to Visualization and Computer Graphics Visibility Shading 3D Rendering Geometric Model Color Perspective

More information

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into 2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into the viewport of the current application window. A pixel

More information

Shadows in the graphics pipeline

Shadows in the graphics pipeline Shadows in the graphics pipeline Steve Marschner Cornell University CS 569 Spring 2008, 19 February There are a number of visual cues that help let the viewer know about the 3D relationships between objects

More information

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

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

More information

Line Drawing. Foundations of Computer Graphics Torsten Möller

Line Drawing. Foundations of Computer Graphics Torsten Möller Line Drawing Foundations of Computer Graphics Torsten Möller Rendering Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Interaction Color Texture/ Realism Reading Angel

More information

The Rasterization Pipeline

The Rasterization Pipeline Lecture 5: The Rasterization Pipeline Computer Graphics and Imaging UC Berkeley CS184/284A, Spring 2016 What We ve Covered So Far z x y z x y (0, 0) (w, h) Position objects and the camera in the world

More information

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline Last Time? The Traditional Graphics Pipeline Participating Media Measuring BRDFs 3D Digitizing & Scattering BSSRDFs Monte Carlo Simulation Dipole Approximation Today Ray Casting / Tracing Advantages? Ray

More information

RASTERISED RENDERING

RASTERISED RENDERING DH2323 DGI16 INTRODUCTION TO COMPUTER GRAPHICS AND INTERACTION RASTERISED RENDERING Christopher Peters HPCViz, KTH Royal Institute of Technology, Sweden chpeters@kth.se http://kth.academia.edu/christopheredwardpeters

More information

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

More information

CS451Real-time Rendering Pipeline

CS451Real-time Rendering Pipeline 1 CS451Real-time Rendering Pipeline JYH-MING LIEN DEPARTMENT OF COMPUTER SCIENCE GEORGE MASON UNIVERSITY Based on Tomas Akenine-Möller s lecture note You say that you render a 3D 2 scene, but what does

More information

CS559: Computer Graphics. Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008

CS559: Computer Graphics. Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008 CS559: Computer Graphics Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008 Antialising Today Hidden Surface Removal Reading: Shirley ch 3.7 8 OpenGL ch 1 Last time A 2 (x 0 y 0 ) (x 1 y 1 ) P

More information

Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz

Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz Computing Visibility BSP Trees Ray Casting Depth Buffering Quiz Power of Plane Equations We ve gotten a lot of mileage out of one simple equation. Basis for D outcode-clipping Basis for plane-at-a-time

More information

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline Final Projects Proposals due Thursday 4/8 Proposed project summary At least 3 related papers (read & summarized) Description of series of test cases Timeline & initial task assignment The Traditional Graphics

More information

Lecture 4. Viewing, Projection and Viewport Transformations

Lecture 4. Viewing, Projection and Viewport Transformations Notes on Assignment Notes on Assignment Hw2 is dependent on hw1 so hw1 and hw2 will be graded together i.e. You have time to finish both by next monday 11:59p Email list issues - please cc: elif@cs.nyu.edu

More information

Institutionen för systemteknik

Institutionen för systemteknik Code: Day: Lokal: M7002E 19 March E1026 Institutionen för systemteknik Examination in: M7002E, Computer Graphics and Virtual Environments Number of sections: 7 Max. score: 100 (normally 60 is required

More information

Perspective Projection and Texture Mapping

Perspective Projection and Texture Mapping Lecture 7: Perspective Projection and Texture Mapping Computer Graphics CMU 15-462/15-662, Spring 2018 Perspective & Texture PREVIOUSLY: - transformation (how to manipulate primitives in space) - rasterization

More information

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

More information

Homework #2. Shading, Ray Tracing, and Texture Mapping

Homework #2. Shading, Ray Tracing, and Texture Mapping Computer Graphics Prof. Brian Curless CSE 457 Spring 2000 Homework #2 Shading, Ray Tracing, and Texture Mapping Prepared by: Doug Johnson, Maya Widyasari, and Brian Curless Assigned: Monday, May 8, 2000

More information

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline 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

More information

Line Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller

Line Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller Line Drawing Introduction to Computer Graphics Torsten Möller / Mike Phillips Rendering Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Color Interaction Texture/ Realism

More information

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane Rendering Pipeline Rendering Converting a 3D scene to a 2D image Rendering Light Camera 3D Model View Plane Rendering Converting a 3D scene to a 2D image Basic rendering tasks: Modeling: creating the world

More information

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008. CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions The Midterm Exam was given in class on Thursday, October 23, 2008. 1. [4 pts] Drawing Where? Your instructor says that objects should always be

More information

CS 464 Review. Review of Computer Graphics for Final Exam

CS 464 Review. Review of Computer Graphics for Final Exam CS 464 Review Review of Computer Graphics for Final Exam Goal: Draw 3D Scenes on Display Device 3D Scene Abstract Model Framebuffer Matrix of Screen Pixels In Computer Graphics: If it looks right then

More information

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CSE528 Computer Graphics: Theory, Algorithms, and Applications CSE528 Computer Graphics: Theory, Algorithms, and Applications Hong Qin Stony Brook University (SUNY at Stony Brook) Stony Brook, New York 11794-2424 Tel: (631)632-845; Fax: (631)632-8334 qin@cs.stonybrook.edu

More information

Today. Rendering pipeline. Rendering pipeline. Object vs. Image order. Rendering engine Rendering engine (jtrt) Computergrafik. Rendering pipeline

Today. Rendering pipeline. Rendering pipeline. Object vs. Image order. Rendering engine Rendering engine (jtrt) Computergrafik. Rendering pipeline Computergrafik Today Rendering pipeline s View volumes, clipping Viewport Matthias Zwicker Universität Bern Herbst 2008 Rendering pipeline Rendering pipeline Hardware & software that draws 3D scenes on

More information

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops. OpenGl Pipeline Individual Vertices Transformed Vertices Commands Processor Per-vertex ops Primitive assembly triangles, lines, points, images Primitives Fragments Rasterization Texturing Per-fragment

More information

Adaptive Point Cloud Rendering

Adaptive Point Cloud Rendering 1 Adaptive Point Cloud Rendering Project Plan Final Group: May13-11 Christopher Jeffers Eric Jensen Joel Rausch Client: Siemens PLM Software Client Contact: Michael Carter Adviser: Simanta Mitra 4/29/13

More information

Announcements. Submitting Programs Upload source and executable(s) (Windows or Mac) to digital dropbox on Blackboard

Announcements. Submitting Programs Upload source and executable(s) (Windows or Mac) to digital dropbox on Blackboard Now Playing: Vertex Processing: Viewing Coulibaly Amadou & Mariam from Dimanche a Bamako Released August 2, 2005 Rick Skarbez, Instructor COMP 575 September 27, 2007 Announcements Programming Assignment

More information

Computer Graphics. Lecture 8 Antialiasing, Texture Mapping

Computer Graphics. Lecture 8 Antialiasing, Texture Mapping Computer Graphics Lecture 8 Antialiasing, Texture Mapping Today Texture mapping Antialiasing Antialiasing-textures Texture Mapping : Why needed? Adding details using high resolution polygon meshes is costly

More information

Computer Graphics I Lecture 11

Computer Graphics I Lecture 11 15-462 Computer Graphics I Lecture 11 Midterm Review Assignment 3 Movie Midterm Review Midterm Preview February 26, 2002 Frank Pfenning Carnegie Mellon University http://www.cs.cmu.edu/~fp/courses/graphics/

More information

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU FROM VERTICES TO FRAGMENTS Lecture 5 Comp3080 Computer Graphics HKBU OBJECTIVES Introduce basic implementation strategies Clipping Scan conversion OCTOBER 9, 2011 2 OVERVIEW At end of the geometric pipeline,

More information

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007 Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007 Programming For this assignment you will write a simple ray tracer. It will be written in C++ without

More information

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005 INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Renderer Implementation: Basics and Clipping David Carr Virtual Environments, Fundamentals Spring 2005 Feb-28-05 SMM009, Basics and Clipping 1

More information

The Graphics Pipeline

The Graphics Pipeline The Graphics Pipeline Ray Tracing: Why Slow? Basic ray tracing: 1 ray/pixel Ray Tracing: Why Slow? Basic ray tracing: 1 ray/pixel But you really want shadows, reflections, global illumination, antialiasing

More information

Chapter 5. Projections and Rendering

Chapter 5. Projections and Rendering Chapter 5 Projections and Rendering Topics: Perspective Projections The rendering pipeline In order to view manipulate and view a graphics object we must find ways of storing it a computer-compatible way.

More information

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

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

More information

Computer Graphics and GPGPU Programming

Computer Graphics and GPGPU Programming Computer Graphics and GPGPU Programming Donato D Ambrosio Department of Mathematics and Computer Science and Center of Excellence for High Performace Computing Cubo 22B, University of Calabria, Rende 87036,

More information

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

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:

More information

Computergrafik. Matthias Zwicker. Herbst 2010

Computergrafik. Matthias Zwicker. Herbst 2010 Computergrafik Matthias Zwicker Universität Bern Herbst 2010 Today Bump mapping Shadows Shadow mapping Shadow mapping in OpenGL Bump mapping Surface detail is often the result of small perturbations in

More information

CS 4620 Program 3: Pipeline

CS 4620 Program 3: Pipeline CS 4620 Program 3: Pipeline out: Wednesday 14 October 2009 due: Friday 30 October 2009 1 Introduction In this assignment, you will implement several types of shading in a simple software graphics pipeline.

More information

Soft shadows. Steve Marschner Cornell University CS 569 Spring 2008, 21 February

Soft shadows. Steve Marschner Cornell University CS 569 Spring 2008, 21 February Soft shadows Steve Marschner Cornell University CS 569 Spring 2008, 21 February Soft shadows are what we normally see in the real world. If you are near a bare halogen bulb, a stage spotlight, or other

More information

Visibility: Z Buffering

Visibility: Z Buffering University of British Columbia CPSC 414 Computer Graphics Visibility: Z Buffering Week 1, Mon 3 Nov 23 Tamara Munzner 1 Poll how far are people on project 2? preferences for Plan A: status quo P2 stays

More information

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment Notes on Assignment Notes on Assignment Objects on screen - made of primitives Primitives are points, lines, polygons - watch vertex ordering The main object you need is a box When the MODELVIEW matrix

More information

Game Architecture. 2/19/16: Rasterization

Game Architecture. 2/19/16: Rasterization Game Architecture 2/19/16: Rasterization Viewing To render a scene, need to know Where am I and What am I looking at The view transform is the matrix that does this Maps a standard view space into world

More information

CSE328 Fundamentals of Computer Graphics

CSE328 Fundamentals of Computer Graphics CSE328 Fundamentals of Computer Graphics Hong Qin State University of New York at Stony Brook (Stony Brook University) Stony Brook, New York 794--44 Tel: (63)632-845; Fax: (63)632-8334 qin@cs.sunysb.edu

More information

CS 130 Exam I. Fall 2015

CS 130 Exam I. Fall 2015 S 3 Exam I Fall 25 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying

More information

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading)

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading) Lecture 9 Graphics pipeline (rasterization and shading) Graphics pipeline - part 1 (recap) Perspective projection by matrix multiplication: x pixel y pixel z canonical 1 x = M vpm per M cam y z 1 This

More information

CS 543: Computer Graphics. Rasterization

CS 543: Computer Graphics. Rasterization CS 543: Computer Graphics Rasterization Robert W. Lindeman Associate Professor Interactive Media & Game Development Department of Computer Science Worcester Polytechnic Institute gogo@wpi.edu (with lots

More information

Graphics for VEs. Ruth Aylett

Graphics for VEs. Ruth Aylett Graphics for VEs Ruth Aylett Overview VE Software Graphics for VEs The graphics pipeline Projections Lighting Shading VR software Two main types of software used: off-line authoring or modelling packages

More information

Computer Graphics 10 - Shadows

Computer Graphics 10 - Shadows Computer Graphics 10 - Shadows Tom Thorne Slides courtesy of Taku Komura www.inf.ed.ac.uk/teaching/courses/cg Overview Shadows Overview Projective shadows Shadow textures Shadow volume Shadow map Soft

More information

https://ilearn.marist.edu/xsl-portal/tool/d4e4fd3a-a3...

https://ilearn.marist.edu/xsl-portal/tool/d4e4fd3a-a3... Assessment Preview - This is an example student view of this assessment done Exam 2 Part 1 of 5 - Modern Graphics Pipeline Question 1 of 27 Match each stage in the graphics pipeline with a description

More information

Computer Graphics. - Rasterization - Philipp Slusallek

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

More information

Projections and Hardware Rendering. Brian Curless CSE 557 Fall 2014

Projections and Hardware Rendering. Brian Curless CSE 557 Fall 2014 Projections and Hardware Rendering Brian Curless CSE 557 Fall 2014 1 Reading Required: Shirley, Ch. 7, Sec. 8.2, Ch. 18 Further reading: Foley, et al, Chapter 5.6 and Chapter 6 David F. Rogers and J. Alan

More information

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

More information

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

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2014 CSE 167: Introduction to Computer Graphics Lecture #6: Lights Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2014 Announcements Project 2 due Friday, Oct. 24 th Midterm Exam

More information

Deferred Rendering Due: Wednesday November 15 at 10pm

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

More information

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources.

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources. 11 11.1 Basics So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources. Global models include incident light that arrives

More information

Graphics Hardware and Display Devices

Graphics Hardware and Display Devices Graphics Hardware and Display Devices CSE328 Lectures Graphics/Visualization Hardware Many graphics/visualization algorithms can be implemented efficiently and inexpensively in hardware Facilitates interactive

More information

The Rasterizer Stage. Texturing, Lighting, Testing and Blending

The Rasterizer Stage. Texturing, Lighting, Testing and Blending 1 The Rasterizer Stage Texturing, Lighting, Testing and Blending 2 Triangle Setup, Triangle Traversal and Back Face Culling From Primitives To Fragments Post Clipping 3 In the last stages of the geometry

More information

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models 3D Programming Concepts Outline 3D Concepts Displaying 3D Models 3D Programming CS 4390 3D Computer 1 2 3D Concepts 3D Model is a 3D simulation of an object. Coordinate Systems 3D Models 3D Shapes 3D Concepts

More information

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows Recollection Models Pixels Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows Can be computed in different stages 1 So far we came to Geometry model 3 Surface

More information

CS 4204 Computer Graphics

CS 4204 Computer Graphics CS 4204 Computer Graphics 3D Viewing and Projection Yong Cao Virginia Tech Objective We will develop methods to camera through scenes. We will develop mathematical tools to handle perspective projection.

More information

CS 354R: Computer Game Technology

CS 354R: Computer Game Technology CS 354R: Computer Game Technology Texture and Environment Maps Fall 2018 Texture Mapping Problem: colors, normals, etc. are only specified at vertices How do we add detail between vertices without incurring

More information

Topic #1: Rasterization (Scan Conversion)

Topic #1: Rasterization (Scan Conversion) Topic #1: Rasterization (Scan Conversion) We will generally model objects with geometric primitives points, lines, and polygons For display, we need to convert them to pixels for points it s obvious but

More information

Texture Mapping. Michael Kazhdan ( /467) HB Ch. 14.8,14.9 FvDFH Ch. 16.3, , 16.6

Texture Mapping. Michael Kazhdan ( /467) HB Ch. 14.8,14.9 FvDFH Ch. 16.3, , 16.6 Texture Mapping Michael Kazhdan (61.457/467) HB Ch. 14.8,14.9 FvDFH Ch. 16.3, 16.4.5, 16.6 Textures We know how to go from this to this J. Birn Textures But what about this to this? J. Birn Textures How

More information

Hidden surface removal. Computer Graphics

Hidden surface removal. Computer Graphics Lecture Hidden Surface Removal and Rasterization Taku Komura Hidden surface removal Drawing polygonal faces on screen consumes CPU cycles Illumination We cannot see every surface in scene We don t want

More information

E.Order of Operations

E.Order of Operations Appendix E E.Order of Operations This book describes all the performed between initial specification of vertices and final writing of fragments into the framebuffer. The chapters of this book are arranged

More information

Real-Time Shadows. Last Time? Today. Why are Shadows Important? Shadows as a Depth Cue. For Intuition about Scene Lighting

Real-Time Shadows. Last Time? Today. Why are Shadows Important? Shadows as a Depth Cue. For Intuition about Scene Lighting Last Time? Real-Time Shadows Today Why are Shadows Important? Shadows & Soft Shadows in Ray Tracing Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes Why are Shadows Important? Depth

More information

CMSC427: Computer Graphics Lecture Notes Last update: November 21, 2014

CMSC427: Computer Graphics Lecture Notes Last update: November 21, 2014 CMSC427: Computer Graphics Lecture Notes Last update: November 21, 2014 TA: Josh Bradley 1 Linear Algebra Review 1.1 Vector Multiplication Suppose we have a vector a = [ x a y a ] T z a. Then for some

More information

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside CS230 : Computer Graphics Lecture 4 Tamar Shinar Computer Science & Engineering UC Riverside Shadows Shadows for each pixel do compute viewing ray if ( ray hits an object with t in [0, inf] ) then compute

More information

Blue colour text questions Black colour text sample answers Red colour text further explanation or references for the sample answers

Blue colour text questions Black colour text sample answers Red colour text further explanation or references for the sample answers Blue colour text questions Black colour text sample answers Red colour text further explanation or references for the sample answers Question 1. a) (5 marks) Explain the OpenGL synthetic camera model,

More information

Previously... contour or image rendering in 2D

Previously... contour or image rendering in 2D Volume Rendering Visualisation Lecture 10 Taku Komura Institute for Perception, Action & Behaviour School of Informatics Volume Rendering 1 Previously... contour or image rendering in 2D 2D Contour line

More information

Real-Time Shadows. Last Time? Textures can Alias. Schedule. Questions? Quiz 1: Tuesday October 26 th, in class (1 week from today!

Real-Time Shadows. Last Time? Textures can Alias. Schedule. Questions? Quiz 1: Tuesday October 26 th, in class (1 week from today! Last Time? Real-Time Shadows Perspective-Correct Interpolation Texture Coordinates Procedural Solid Textures Other Mapping Bump Displacement Environment Lighting Textures can Alias Aliasing is the under-sampling

More information

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL International Edition Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL Sixth Edition Edward Angel Dave Shreiner Interactive Computer Graphics: A Top-Down Approach with Shader-Based

More information

CS 498 VR. Lecture 18-4/4/18. go.illinois.edu/vrlect18

CS 498 VR. Lecture 18-4/4/18. go.illinois.edu/vrlect18 CS 498 VR Lecture 18-4/4/18 go.illinois.edu/vrlect18 Review and Supplement for last lecture 1. What is aliasing? What is Screen Door Effect? 2. How image-order rendering works? 3. If there are several

More information

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines COMP30019 Graphics and Interaction Scan Converting Polygons and Lines Department of Computer Science and Software Engineering The Lecture outline Introduction Scan conversion Scan-line algorithm Edge coherence

More information

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping Topic 12: Texture Mapping Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping Texture sources: Photographs Texture sources: Procedural Texture sources: Solid textures

More information