Rendering Pipeline and Coordinates Transforms
|
|
- Philip Foster
- 5 years ago
- Views:
Transcription
1 Rendering Pipeline and Coordinates Transforms Alessandro Martinelli 16 October 2013 Rendering Pipeline (3): Coordinates Transforms Rendering Architecture First Rendering Pipeline Second Pipeline: Illumination and Shading Third Pipeline: Coordinates Transforms Fourth Pipeline: Texturing Fifth Pipeline: Memory Structures Programmable Graphics Hardware Computer Graphics
2 Planar 2D Transforms Rendering Pipeline (3): Coordinates Transforms Rendering Architecture First Rendering Pipeline Second Pipeline: Illumination and Shading Third Pipeline: Coordinates Transforms Planar 2D Transforms Spatial 3D Transforms Homogeneous Coordinates Parallel Projection, Perspective Projection and Perspective Transforms The SceneGraph and OpenGL Transforms Fourth Pipeline: Texturing Fifth Pipeline: Memory Structures Programmable Graphics Hardware A. Martinelli Transforms 16/10/ / 39
3 Planar 2D Transforms Planar 2D Coordinates Transforms Planar Coordinates Transforms move a coordinates couple (x, y) into a new position (x,y ) And they are used to move virtual objects on the plane. (x,y) (x,y ) (1) A. Martinelli Transforms 16/10/ / 39
4 Planar 2D Transforms Planar 2D Coordinates Transforms Planar Coordinates Transforms move a coordinates couple (x, y) into a new position (x,y ) (x,y) (x,y ) (1) And they are used to move virtual objects on the plane. The Transforms we are considering are linear transforms, and they are described with this formulas: x = ax +by +e y = cx +dy +f (2) A. Martinelli Transforms 16/10/ / 39
5 Planar 2D Transforms Planar 2D Coordinates Transforms Planar Coordinates Transforms move a coordinates couple (x, y) into a new position (x,y ) (x,y) (x,y ) (1) And they are used to move virtual objects on the plane. The Transforms we are considering are linear transforms, and they are described with this formulas: x = ax +by +e y = cx +dy +f (2) With matrix notation a+b : [ [ x a b y = c d [ x y [ e + f You should remember that the matrix-vector product is the result of the dot product of each row in the matrix with the vector itself (3) A. Martinelli Transforms 16/10/ / 39
6 Planar 2D Transforms Planar Transforms: Reference Systems Each Planar Transform is related to a Reference System [ [ [ [ x a b x e y = + c d y f (4) A. Martinelli Transforms 16/10/ / 39
7 Planar 2D Transforms Planar Transforms: Reference Systems Each Planar Transform is related to a Reference System [ [ [ [ x a b x e y = + c d y f (4) a+b If If If [ x y [ x y [ x y [ 0 = 0 [ 1 = 0 [ 0 = 1 then then then [ [ x e y = f [ [ x a y = c [ [ x b y = d [ e + f [ e + f (5) [ b d [ e + f [ 0 1 [ 0 0 [ 1 0 [ e f [ a c [ e + f A. Martinelli Transforms 16/10/ / 39
8 Planar 2D Transforms Planar Transforms: Translation a+b Translation moves the Reference System of an Object without changing its axes [ [ [ [ x 1 0 x e y = + (6) 0 1 y f A. Martinelli Transforms 16/10/ / 39
9 Planar 2D Transforms Planar Transforms: Translation a+b Translation moves the Reference System of an Object without changing its axes [ [ [ [ x 1 0 x e y = + (6) 0 1 y f [ [ 0 e [ + 1 f 0 1 [ 0 0 [ 1 0 [ e f [ 1 0 [ e + f A. Martinelli Transforms 16/10/ / 39
10 Planar 2D Transforms Planar Transforms: Scaling a+b Scaling applies a change in the axes size [ [ [ x sx 0 x y = 0 s y y [ (7) A. Martinelli Transforms 16/10/ / 39
11 Planar 2D Transforms Planar Transforms: Scaling a+b Scaling applies a change in the axes size [ [ [ x sx 0 x y = 0 s y y [ 0 sy [ (7) [ 0 1 [ 0 0 [ 1 0 [ sx0 A. Martinelli Transforms 16/10/ / 39
12 Planar 2D Transforms Planar Transforms: Rotation around the origin (1/3) Planar Rotations rotate the axes with an angle α As for translations, rotations are rigid transforms, because they keep fixed dimensions and angles. The points (1,0) and (0,1) will move on the Unit Circumference A. Martinelli Transforms 16/10/ / 39
13 Planar 2D Transforms Planar Transforms: Rotation around the origin (1/3) Planar Rotations rotate the axes with an angle α As for translations, rotations are rigid transforms, because they keep fixed dimensions and angles. The points (1,0) and (0,1) will move on the Unit Circumference [ 0 1 [?? α [ 0 0 α [?? [ 1 0 Unit Circumference A. Martinelli Transforms 16/10/ / 39
14 Planar 2D Transforms Planar Transforms: Rotation around the origin (2/3) a+b The Point (1,0) got moved to (cos(α),sin(α)) The Point (0,1) got moved to (cos(α+ π 2 ),sin(α+ π 2 )) = ( sin(α),cos(α)) a+b A. Martinelli Transforms 16/10/ / 39
15 Planar 2D Transforms Planar Transforms: Rotation around the origin (2/3) a+b The Point (1,0) got moved to (cos(α),sin(α)) The Point (0,1) got moved to (cos(α+ π 2 ),sin(α+ π 2 )) = ( sin(α),cos(α)) a+b [ sin(α) cos(α) [ 0 1 α [ 0 0 α [ cos(α) sin(α) [ 1 0 Unit Circumference A. Martinelli Transforms 16/10/ / 39
16 Planar 2D Transforms Planar Transforms: Rotation around the origin (3/3) a+b The set of all the 2D rotation matrices is defined as : [ [ [ x cos(α) sin(α) x y = sin(α) cos(α) y (8) Rotation matrices are also called orthogonal matrices, because they transform π 2 angles into π 2 angles (they indeed keep the dimensions of any angle). Rotation matrices are also called normal matrices, because they transform unit vectors into unit vectors (they indeed keep the size of any vector) A. Martinelli Transforms 16/10/ / 39
17 Planar 2D Transforms Applying Transforms(1/2) Let s suppose to apply 2 transforms which move the point (x,y) into the point (x 1,y 1 ) (T 1 ) and (x 1,y 1 ) into (x 2,y 2 ) (T 2 ). [ x1 = y 1 [ a1 b 1 c 1 d 1 [ x y [ [ [ [ [ e1 x2 a2 b + = 2 x1 e2 + f 1 y 2 c 2 d 2 y 1 f 2 (9) (x 2,y 2 ) is the result of applying 2 transforms on (x,y) [ [ ([ [ [ )[ x2 a2 b = 2 a1 b 1 x e1 x + y 2 c 2 d 2 c 1 d 1 y f 1 y The order in which this transforms are applied is relevant. [ e2 + f 2 (10) A. Martinelli Transforms 16/10/ / 39
18 Planar 2D Transforms Applying Transforms(2/2) Example [ [ a1 b 2 2 T 1 : 1 = 2 2 c 1 d , [ [ e1 0 = f 1 0 [ [ a2 b T 2 : 2 10 = c 2 d 2 01 [ [ e2 1, = f 2 0 (11) The first transform is a π 4 rotation, the second is a translation. A. Martinelli Transforms 16/10/ / 39
19 Planar 2D Transforms Applying Transforms(2/2) Example [ [ a1 b 2 2 T 1 : 1 = 2 2 c 1 d , [ [ e1 0 = f 1 0 [ [ a2 b T 2 : 2 10 = c 2 d 2 01 [ [ e2 1, = f 2 0 (11) The first transform is a π 4 rotation, the second is a translation. First case: T 1 before T 2 [ [ x2 1 0 = y ([ [ x y [ ) [ [ 2 = 2 x 2 2 y x y (12) A. Martinelli Transforms 16/10/ / 39
20 Planar 2D Transforms Applying Transforms(2/2) Example [ [ a1 b 2 2 T 1 : 1 = 2 2 c 1 d , [ [ e1 0 = f 1 0 [ [ a2 b T 2 : 2 10 = c 2 d 2 01 [ [ e2 1, = f 2 0 (11) The first transform is a π 4 rotation, the second is a translation. First case: T 1 before T 2 [ [ x2 1 0 = y ([ [ x y [ ) [ [ 2 = 2 x 2 2 y x y (12) First case: T 2 before T 1 [ [ 2 2 x2 = 2 2 y ([ [ x y [ ) [ [ 2 = 2 (x +1) 2 2 y 2 2 (x +1)+ 2 2 y (13) A. Martinelli Transforms 16/10/ / 39
21 Spatial 3D Transforms Rendering Pipeline (3): Coordinates Transforms Rendering Architecture First Rendering Pipeline Second Pipeline: Illumination and Shading Third Pipeline: Coordinates Transforms Planar 2D Transforms Spatial 3D Transforms Homogeneous Coordinates Parallel Projection, Perspective Projection and Perspective Transforms The SceneGraph and OpenGL Transforms Fourth Pipeline: Texturing Fifth Pipeline: Memory Structures Programmable Graphics Hardware A. Martinelli Transforms 16/10/ / 39
22 Spatial 3D Transforms Spatial 3D Transforms (1/3) 3D Transforms are described similarly to the 2D case [ x [ [ a b c x = d e f y g h i z y z A 3D Transform is related to a 3D Reference System (0,0,0) is moved to (l,m,n) (1,0,0) is moved to (l,m,n)+(a,d,g) (0,1,0) is moved to (l,m,n)+(b,e,h) (0,0,1) is moved to (l,m,n)+(c,f,i) a+b : +[ l m n (14) A. Martinelli Transforms 16/10/ / 39
23 Spatial 3D Transforms Spatial 3D Transforms (2/3) b e h + l m n c f i + l m n l m n a d g + l m n A. Martinelli Transforms 16/10/ / 39
24 Spatial 3D Transforms Spatial 3D Transforms (2/3) Translation a+b : [ x y z = [ [ x y z + [ tx t y t z (15) Scaling a+b : [ x y z = [ sx s y s z [ x y z +[ (16) gltranslatef(t x,t y,t z ); glscalef(s x,s y,s z ); A. Martinelli Transforms 16/10/ / 39
25 Spatial 3D Transforms Rotazione: Angoli di Eulero (1/2) While 2D rotations are easy, because of the unique rotation axes, 3D Rotations are more complex because the possible rotation axes are infinite. A. Martinelli Transforms 16/10/ / 39
26 Spatial 3D Transforms Rotazione: Angoli di Eulero (1/2) While 2D rotations are easy, because of the unique rotation axes, 3D Rotations are more complex because the possible rotation axes are infinite. Rotazioni di Eulero Euler Rotations are defined starting from Euler angles: α x,α y,α z. R = R x (α x )R y (α y )R z (α z ) (17) Where each rotation is the rotation around one of the 3 Cartesian axes. A. Martinelli Transforms 16/10/ / 39
27 Spatial 3D Transforms Rotazione: Angoli di Eulero (1/2) While 2D rotations are easy, because of the unique rotation axes, 3D Rotations are more complex because the possible rotation axes are infinite. Rotazioni di Eulero Euler Rotations are defined starting from Euler angles: α x,α y,α z. R = R x (α x )R y (α y )R z (α z ) (17) Where each rotation is the rotation around one of the 3 Cartesian axes. R z (α z ) is the rotation around the z axes, that is the rotation around the origin in a+b the xy plane. [ x [ [ +cz s z 0 x c z = cos(α z ),s z = sin(α z ) y = +s z +c z 0 y (18) z z A. Martinelli Transforms 16/10/ / 39
28 Spatial 3D Transforms Rotazione: Angoli di Eulero (2/2) R x (α x ) is the rotation around the x axes, that is the rotation around the origin in a+b the yz plane. [ x [ [ x c x = cos(α x ),s x = sin(α x ) y = 0 +c x s x y (19) z 0 +s x +c x z A. Martinelli Transforms 16/10/ / 39
29 Spatial 3D Transforms Rotazione: Angoli di Eulero (2/2) R x (α x ) is the rotation around the x axes, that is the rotation around the origin in a+b the yz plane. [ x [ [ x c x = cos(α x ),s x = sin(α x ) y = 0 +c x s x y (19) z 0 +s x +c x z R y (α y ) is the rotation around the y axes, that is the rotation around the origin in a+b the zx plane plane. [ x [ [ +cy 0 +s y x c y = cos(α y ),s y = sin(α y ) y = y (20) z s y 0 +c y z A. Martinelli Transforms 16/10/ / 39
30 Spatial 3D Transforms Rotazione intorno ad asse generico Any rotation can be described as the rotation around some (generic) axes. D D 2 α D 1 The Rotation Matrix is built starting from the matrix C D describing a cross product with D a+b???? [ 0 Dz D y C = D z 0 D y D y D x 0, R(α,D) = I +sin(α)c +(1 cos(α))c 2 (21) glrotatef(α,d x,d y,d z ); Euler Transforms: glrotatef(α x,1,0,0);glrotatef(α y,0,1,0);glrotatef(α z,0,0,1); A. Martinelli Transforms 16/10/ / 39
31 Homogeneous Coordinates Rendering Pipeline (3): Coordinates Transforms Rendering Architecture First Rendering Pipeline Second Pipeline: Illumination and Shading Third Pipeline: Coordinates Transforms Planar 2D Transforms Spatial 3D Transforms Homogeneous Coordinates Parallel Projection, Perspective Projection and Perspective Transforms The SceneGraph and OpenGL Transforms Fourth Pipeline: Texturing Fifth Pipeline: Memory Structures Programmable Graphics Hardware A. Martinelli Transforms 16/10/ / 39
32 Homogeneous Coordinates Homogeneous Coordinates(1/2) Homogeneous Coordinates are a very smart instrument in order to describe coordinates transforms. A. Martinelli Transforms 16/10/ / 39
33 Homogeneous Coordinates Homogeneous Coordinates(1/2) Homogeneous Coordinates are a very smart instrument in order to describe coordinates transforms. The transform: is equivalent to: [ x y z = [ a b c d e f g h i [ x y z x = ax +by +cz +l y = dx +ey +fz +m z = gx +hy +iz +n +[ l m n (22) (23) A. Martinelli Transforms 16/10/ / 39
34 Homogeneous Coordinates Homogeneous Coordinates(1/2) Homogeneous Coordinates are a very smart instrument in order to describe coordinates transforms. The transform: is equivalent to: [ x y z = [ a b c d e f g h i [ x y z x = ax +by +cz +l y = dx +ey +fz +m z = gx +hy +iz +n +[ l m n Which may be written in this way (marking the products with ): x = a x +b y +c z +l 1 y = d x +e y +f z +m 1 z = g x +h y +i z +n 1 1 = 0 x +0 y +0 z +1 1 (22) (23) (24) A. Martinelli Transforms 16/10/ / 39
35 Homogeneous Coordinates Homogeneous Coordinates(2/2) the equation we have seen: x = a x +b y +c z +l 1 y = d x +e y +f z +m 1 z = g x +h y +i z +n 1 1 = 0 x +0 y +0 z +1 1 (25) A. Martinelli Transforms 16/10/ / 39
36 Homogeneous Coordinates Homogeneous Coordinates(2/2) the equation we have seen: x = a x +b y +c z +l 1 y = d x +e y +f z +m 1 z = g x +h y +i z +n 1 1 = 0 x +0 y +0 z +1 1 (25) Can be written (again) with matrix notation x y z = 1 a+b a b c l d e f m g h i n : x y z 1 (26) A. Martinelli Transforms 16/10/ / 39
37 Homogeneous Coordinates Homogeneous Coordinates(2/2) the equation we have seen: x = a x +b y +c z +l 1 y = d x +e y +f z +m 1 z = g x +h y +i z +n 1 1 = 0 x +0 y +0 z +1 1 (25) Can be written (again) with matrix notation x y z = 1 a+b a b c l d e f m g h i n : x y z 1 (26) (x,y,z,1) T is a vector written with Homogeneous Coordinates. Using Homogeneous Coordinates, we can write any linear 3D transform using a 4x4 matrix. A. Martinelli Transforms 16/10/ / 39
38 Homogeneous Coordinates Projective Geometry A vector written with Homogeneous Coordinates is obtained by adding the component w: (x,y,z,w) T (27) A. Martinelli Transforms 16/10/ / 39
39 Homogeneous Coordinates Projective Geometry A vector written with Homogeneous Coordinates is obtained by adding the component w: (x,y,z,w) T (27) Projective Geometry studies vectors written with Homogeneous Coordinates. To each vector written with Homogeneous Coordinates there is a 3D vector a+b like this : ( x (X,Y,Z) T = w, y w, z ) T (28) w A. Martinelli Transforms 16/10/ / 39
40 Homogeneous Coordinates Projective Geometry A vector written with Homogeneous Coordinates is obtained by adding the component w: (x,y,z,w) T (27) Projective Geometry studies vectors written with Homogeneous Coordinates. To each vector written with Homogeneous Coordinates there is a 3D vector a+b like this : ( x (X,Y,Z) T = w, y w, z ) T (28) w An Infinit Points Set (x,y,z,w) T will map to a unique (X,Y,Z). Points having w = 0 are called Point at infinity. A. Martinelli Transforms 16/10/ / 39
41 Homogeneous Coordinates Projective Geometry A vector written with Homogeneous Coordinates is obtained by adding the component w: (x,y,z,w) T (27) Projective Geometry studies vectors written with Homogeneous Coordinates. To each vector written with Homogeneous Coordinates there is a 3D vector a+b like this : ( x (X,Y,Z) T = w, y w, z ) T (28) w An Infinit Points Set (x,y,z,w) T will map to a unique (X,Y,Z). Points having w = 0 are called Point at infinity. Note Our Rendering Pipeline treats transforms as 4x4 matrices and vectors as 4-components vectors with Homogeneous Coordinates. Vertices and Vectors are transformed into 3 coordinates vectors applying the projective relation, BEFORE any rasterization process. A. Martinelli Transforms 16/10/ / 39
42 Parallel Projection, Perspective Projection and Perspective Transforms Rendering Pipeline (3): Coordinates Transforms Rendering Architecture First Rendering Pipeline Second Pipeline: Illumination and Shading Third Pipeline: Coordinates Transforms Planar 2D Transforms Spatial 3D Transforms Homogeneous Coordinates Parallel Projection, Perspective Projection and Perspective Transforms The SceneGraph and OpenGL Transforms Fourth Pipeline: Texturing Fifth Pipeline: Memory Structures Programmable Graphics Hardware A. Martinelli Transforms 16/10/ / 39
43 Parallel Projection, Perspective Projection and Perspective Transforms Projection Matrices During the Rendering Process, all the vertices are transformed using a 4x4 transform which is the projection matrix. This matrix resemble a camera placed somewhere in the 3D space. A. Martinelli Transforms 16/10/ / 39
44 Parallel Projection, Perspective Projection and Perspective Transforms Projection Matrices During the Rendering Process, all the vertices are transformed using a 4x4 transform which is the projection matrix. This matrix resemble a camera placed somewhere in the 3D space. Projection Matrix A 4x4 Homogeneous Coordinates Transform Matrix defining the position of the world 3D with respect to the camera space. A. Martinelli Transforms 16/10/ / 39
45 Parallel Projection, Perspective Projection and Perspective Transforms Projection Matrices During the Rendering Process, all the vertices are transformed using a 4x4 transform which is the projection matrix. This matrix resemble a camera placed somewhere in the 3D space. Projection Matrix A 4x4 Homogeneous Coordinates Transform Matrix defining the position of the world 3D with respect to the camera space.... so : not the position of the camera in the world, but its inverse matrix!!! A. Martinelli Transforms 16/10/ / 39
46 Parallel Projection, Perspective Projection and Perspective Transforms Projection Matrices During the Rendering Process, all the vertices are transformed using a 4x4 transform which is the projection matrix. This matrix resemble a camera placed somewhere in the 3D space. Projection Matrix A 4x4 Homogeneous Coordinates Transform Matrix defining the position of the world 3D with respect to the camera space.... so : not the position of the camera in the world, but its inverse matrix!!! This is because the rasterization process will be performed in the camera internal reference system. Our Virtual World got projected into the camera space, and the projection matrix tells us how this projection is performed. A. Martinelli Transforms 16/10/ / 39
47 Parallel Projection, Perspective Projection and Perspective Transforms Parallel Projection Matrix Parallel Projection Matrices We can build a simple projection matrix buy applying rigid transforms like rotations and translation, or a scaling. In this way we will create a World projection through parallel lines. A. Martinelli Transforms 16/10/ / 39
48 Parallel Projection, Perspective Projection and Perspective Transforms Parallel Projection Matrix Parallel Projection Matrices We can build a simple projection matrix buy applying rigid transforms like rotations and translation, or a scaling. In this way we will create a World projection through parallel lines. An Important case: The Identity Projection The 4x4 Identity matrix is not projecting at all. It is like a default projection on the z axes. A. Martinelli Transforms 16/10/ / 39
49 Parallel Projection, Perspective Projection and Perspective Transforms Parallel Projection Matrix Parallel Projection Matrices We can build a simple projection matrix buy applying rigid transforms like rotations and translation, or a scaling. In this way we will create a World projection through parallel lines. An Important case: The Identity Projection The 4x4 Identity matrix is not projecting at all. It is like a default projection on the z axes. Starting from the identity matrix and applying rotations, we will have a change in the projection direction. NOTE: the projection will still be performed using the z axes in the camera reference system A. Martinelli Transforms 16/10/ / 39
50 Parallel Projection, Perspective Projection and Perspective Transforms Perspective Projection (1/2) A Perspective Projection is a projection of a point P on a plane π (Projection Plane) along the line connecting P with a particular point F we will call the Eye. A. Martinelli Transforms 16/10/ / 39
51 Parallel Projection, Perspective Projection and Perspective Transforms Perspective Projection (1/2) A Perspective Projection is a projection of a point P on a plane π (Projection Plane) along the line connecting P with a particular point F we will call the Eye. Esempio Considering the Eye F = (0,0,0) and the plane π : z = d π : z = dp = (x,y,z) P pr = (x,y,z ) F = (0,0,0) (0,0,d) A. Martinelli Transforms 16/10/ / 39
52 Parallel Projection, Perspective Projection and Perspective Transforms Perspective Projection (1/2) A Perspective Projection is a projection of a point P on a plane π (Projection Plane) along the line connecting P with a particular point F we will call the Eye. Esempio Considering the Eye F = (0,0,0) and the plane π : z = d F = (0,0,0) π : z = dp = (x,y,z) P pr = (x,y,z ) (0,0,d) The line connecting (0,0,0) with P is the set of points (x,y,z ) satisfing this constraints: x x = y y = z z (29) A. Martinelli Transforms 16/10/ / 39
53 Parallel Projection, Perspective Projection and Perspective Transforms Perspective Projection (1/2) A Perspective Projection is a projection of a point P on a plane π (Projection Plane) along the line connecting P with a particular point F we will call the Eye. Esempio Considering the Eye F = (0,0,0) and the plane π : z = d F = (0,0,0) π : z = dp = (x,y,z) P pr = (x,y,z ) (0,0,d) The line connecting (0,0,0) with P is the set of points (x,y,z ) satisfing this constraints: x x = y y = z z (29) The intersection with π is given by adding the constraint z = d. So x = dx z y = dy z z = d a+b : (30) A. Martinelli Transforms 16/10/ / 39
54 Parallel Projection, Perspective Projection and Perspective Transforms Perspective Projection (2/2) From the last slide: x = dx z y = dy z z = d (31) A. Martinelli Transforms 16/10/ / 39
55 Parallel Projection, Perspective Projection and Perspective Transforms Perspective Projection (2/2) From the last slide: This can be rewritten as: x = dx z y = dy z z = d x = d x+0 y+0 z x+0 y+1 z+0 1 y = 0 x+d y+0 z x+0 y+1 z+0 1 z = 0 x+0 y+d z x+0 y+1 z+0 1 (31) (32) A. Martinelli Transforms 16/10/ / 39
56 Parallel Projection, Perspective Projection and Perspective Transforms Perspective Projection (2/2) From the last slide: This can be rewritten as: x = dx z y = dy z z = d x = d x+0 y+0 z x+0 y+1 z+0 1 y = 0 x+d y+0 z x+0 y+1 z+0 1 z = 0 x+0 y+d z x+0 y+1 z+0 1 (31) (32) a+b Which may be written in homogeneus coordinates x = d x +0 y +0 z +0 1 y = 0 x +d y +0 z +0 1 z = 0 x +0 y +d z +0 1 w = 0 x +0 y +1 z +0 1, x y z w = : d d d x y z 1 (33) A. Martinelli Transforms 16/10/ / 39
57 Parallel Projection, Perspective Projection and Perspective Transforms Perspective Transform (1/2) a+b???? The matrix: d d d (34) Is a degenerated rank-0 matrix. Indeed: it s been built to transform all the 3D points of the space into points on the plane π. A. Martinelli Transforms 16/10/ / 39
58 Parallel Projection, Perspective Projection and Perspective Transforms Perspective Transform (1/2) a+b???? The matrix: d d d (34) Is a degenerated rank-0 matrix. Indeed: it s been built to transform all the 3D points of the space into points on the plane π. The truth is: we need to keep the informations about z values, beacuse we need them for out rendering algorithms (Z-Buffering). We would also like to control Clipping depth values (di default -1 e 1). A. Martinelli Transforms 16/10/ / 39
59 Parallel Projection, Perspective Projection and Perspective Transforms Perspective Transform (1/2) a+b???? The matrix: d d d (34) Is a degenerated rank-0 matrix. Indeed: it s been built to transform all the 3D points of the space into points on the plane π. The truth is: we need to keep the informations about z values, beacuse we need them for out rendering algorithms (Z-Buffering). We would also like to control Clipping depth values (di default -1 e 1). A usefull matrix would look like this: s x s y α β (35) A. Martinelli Transforms 16/10/ / 39
60 Parallel Projection, Perspective Projection and Perspective Transforms Perspective Transform (2/2) a+b???? α and β are functions based on values z near and z far. And they are evaluated starting from the equation z : z αz +β = z (36) A. Martinelli Transforms 16/10/ / 39
61 Parallel Projection, Perspective Projection and Perspective Transforms Perspective Transform (2/2) a+b???? α and β are functions based on values z near and z far. And they are evaluated starting from the equation z : z αz +β = (36) z When z = z near, z = 1. When z = z far, z = 1. 1 = αz near +β, 1 = αz far +β (37) z near z far A. Martinelli Transforms 16/10/ / 39
62 Parallel Projection, Perspective Projection and Perspective Transforms Perspective Transform (2/2) a+b???? α and β are functions based on values z near and z far. And they are evaluated starting from the equation z : z αz +β = (36) z When z = z near, z = 1. When z = z far, z = 1. 1 = αz near +β, 1 = αz far +β (37) z near z far Solving: α = z far +z near, β = 2z farz near (38) z far z near z far z near s x s y z far+z near 2z far z near (39) z far z near z far z near gluperspective(angle y,rap xy,z near,z far ); Applies a perspective projection. angle y,rap xy are angular openings parameters of the Viewing Frustum, on which they are evaluated s x ed s y A. Martinelli Transforms 16/10/ / 39
63 Parallel Projection, Perspective Projection and Perspective Transforms Viewing Frustum A Viewing Frustum is the set of points in the space 3D which, once projected, will be transformed into the Unit Volume Points When we use Perspective Projections, its shape is the one of a Pyramidal Frustum with a Rectangular Base Perspective 3D World Transform Camera Space Viewing Frustum A. Martinelli Transforms 16/10/ / 39
64 The SceneGraph and OpenGL Transforms Rendering Pipeline (3): Coordinates Transforms Rendering Architecture First Rendering Pipeline Second Pipeline: Illumination and Shading Third Pipeline: Coordinates Transforms Planar 2D Transforms Spatial 3D Transforms Homogeneous Coordinates Parallel Projection, Perspective Projection and Perspective Transforms The SceneGraph and OpenGL Transforms Fourth Pipeline: Texturing Fifth Pipeline: Memory Structures Programmable Graphics Hardware A. Martinelli Transforms 16/10/ / 39
65 The SceneGraph and OpenGL Transforms The SceneGraph The SceneGraph The Scene Graph is a tree: Whose nodes are coordinates transforms (4x4 matrices) TPr T1 House A. Martinelli Transforms 16/10/ / 39
66 The SceneGraph and OpenGL Transforms The SceneGraph The SceneGraph The Scene Graph is a tree: Whose nodes are coordinates transforms (4x4 matrices) Whose leaves are 3D Objects TPr T1 House A. Martinelli Transforms 16/10/ / 39
67 The SceneGraph and OpenGL Transforms The SceneGraph The SceneGraph The Scene Graph is a tree: Whose nodes are coordinates transforms (4x4 matrices) Whose leaves are 3D Objects Whose Projection Matrix (TPr in the example) is on the root of the tree TPr T1 House A. Martinelli Transforms 16/10/ / 39
68 The SceneGraph and OpenGL Transforms The SceneGraph The SceneGraph The Scene Graph is a tree: Whose nodes are coordinates transforms (4x4 matrices) Whose leaves are 3D Objects Whose Projection Matrix (TPr in the example) is on the root of the tree The Vertices of the Objects must be transformed appling sequentially all the matrices node after node from the leaves to the root. The last transform is always the Projection. TPr T1 House A. Martinelli Transforms 16/10/ / 39
69 The SceneGraph and OpenGL Transforms Rendering Pipeline: Coordinates Transforms GL PROJECTION (P) is a 4x4 Projection Matrix. GL MODELVIEW (M) is a 4x4 Matrix describing the 3D reference system where an object should be placed. The Vertex Pipeline implements the overall coordinates transform: v out = PMv in (40) OpenGL functions will allow to modify only one matrix at a time: Transforms Functions glloadidentity: setup the Identity (null) transform gltranslatef(t x,t y,t z ): translation glscalef(s x,s y,s z ): scaling glrotatef(α,d x,d y,d z ): rotation around the (d x,d y,d z ) direction Apart LoadIdentity this functions are Multiplicative: Each of them evaluates a 4x4 matrix Each of them will multiply the previous GL PROJECTION or GL MODELVIEW with the new matrix. A. Martinelli Transforms 16/10/ / 39 a+b :
70 The SceneGraph and OpenGL Transforms OpenGL: Coordinates Transforms (A very important example) We will call M the GL MODELVIEW, T i each matrix written from gltranslate, R i each matrix written from glrotate, I the Identity Matrix. A. Martinelli Transforms 16/10/ / 39
71 The SceneGraph and OpenGL Transforms OpenGL: Coordinates Transforms (A very important example) We will call M the GL MODELVIEW, T i each matrix written from gltranslate, R i each matrix written from glrotate, I the Identity Matrix. In the following code: glloadidentity(); : M = I gltranslatef(t x1,t y1,t z1 ); : M = IT 1 glrotatef(α 2,d x2,d y2,d z2 ); : M = IT 1 R 2 gltranslatef(t x3,t y3,t z3 ); : M = IT 1 R 2 T 3 A. Martinelli Transforms 16/10/ / 39
72 The SceneGraph and OpenGL Transforms OpenGL: Coordinates Transforms (A very important example) We will call M the GL MODELVIEW, T i each matrix written from gltranslate, R i each matrix written from glrotate, I the Identity Matrix. In the following code: glloadidentity(); : M = I gltranslatef(t x1,t y1,t z1 ); : M = IT 1 glrotatef(α 2,d x2,d y2,d z2 ); : M = IT 1 R 2 gltranslatef(t x3,t y3,t z3 ); : M = IT 1 R 2 T 3 A vertex v is applied M before being drawn v = Mv (41) which is the same as v = IT 1 R 2 T 3 v (42) A. Martinelli Transforms 16/10/ / 39
73 The SceneGraph and OpenGL Transforms OpenGL: Coordinates Transforms (A very important example) We will call M the GL MODELVIEW, T i each matrix written from gltranslate, R i each matrix written from glrotate, I the Identity Matrix. In the following code: glloadidentity(); : M = I gltranslatef(t x1,t y1,t z1 ); : M = IT 1 glrotatef(α 2,d x2,d y2,d z2 ); : M = IT 1 R 2 gltranslatef(t x3,t y3,t z3 ); : M = IT 1 R 2 T 3 A vertex v is applied M before being drawn which is the same as That is: v got applied (in the correct order) Transform T 3 Transform R 2 v = Mv (41) v = IT 1 R 2 T 3 v (42) Transform T 1 The order of appliance of each transform is the opposite to the order in which they are written in OpenGL A. Martinelli Transforms 16/10/ / 39
74 The SceneGraph and OpenGL Transforms SceneGraphs and OpenGL (1/3) A good way to desing the Projection Matrix (once before drawing anything) glmatrixmode(gl PROJECTION);From this point, we work on P Setting ModelView on each Object ( Objects) A. Martinelli Transforms 16/10/ / 39
75 The SceneGraph and OpenGL Transforms SceneGraphs and OpenGL (1/3) A good way to desing the Projection Matrix (once before drawing anything) glmatrixmode(gl PROJECTION);From this point, we work on P glloadidentity();p is set to the Identity Setting ModelView on each Object ( Objects) A. Martinelli Transforms 16/10/ / 39
76 The SceneGraph and OpenGL Transforms SceneGraphs and OpenGL (1/3) A good way to desing the Projection Matrix (once before drawing anything) glmatrixmode(gl PROJECTION);From this point, we work on P glloadidentity();p is set to the Identity glscale( size/width, size/height, eps ); Terms correcting Viewport Transforms Setting ModelView on each Object ( Objects) A. Martinelli Transforms 16/10/ / 39
77 The SceneGraph and OpenGL Transforms SceneGraphs and OpenGL (1/3) A good way to desing the Projection Matrix (once before drawing anything) glmatrixmode(gl PROJECTION);From this point, we work on P glloadidentity();p is set to the Identity glscale( size/width, size/height, eps ); Terms correcting Viewport Transforms gluperspective( angle, rapport,z near,z far ); Basic Perspective Transform Setting ModelView on each Object ( Objects) A. Martinelli Transforms 16/10/ / 39
78 The SceneGraph and OpenGL Transforms SceneGraphs and OpenGL (1/3) A good way to desing the Projection Matrix (once before drawing anything) glmatrixmode(gl PROJECTION);From this point, we work on P glloadidentity();p is set to the Identity glscale( size/width, size/height, eps ); Terms correcting Viewport Transforms gluperspective( angle, rapport,z near,z far ); Basic Perspective Transform gltranslatef( t xmondo,t ymondo,t zmondo ); World Translation Setting ModelView on each Object ( Objects) A. Martinelli Transforms 16/10/ / 39
79 The SceneGraph and OpenGL Transforms SceneGraphs and OpenGL (1/3) A good way to desing the Projection Matrix (once before drawing anything) glmatrixmode(gl PROJECTION);From this point, we work on P glloadidentity();p is set to the Identity glscale( size/width, size/height, eps ); Terms correcting Viewport Transforms gluperspective( angle, rapport,z near,z far ); Basic Perspective Transform gltranslatef( t xmondo,t ymondo,t zmondo ); World Translation glrotatef( α Mondo,D xmondo,d ymondo,d zmondo ); World Rotation Setting ModelView on each Object ( Objects) A. Martinelli Transforms 16/10/ / 39
80 The SceneGraph and OpenGL Transforms SceneGraphs and OpenGL (1/3) A good way to desing the Projection Matrix (once before drawing anything) glmatrixmode(gl PROJECTION);From this point, we work on P glloadidentity();p is set to the Identity glscale( size/width, size/height, eps ); Terms correcting Viewport Transforms gluperspective( angle, rapport,z near,z far ); Basic Perspective Transform gltranslatef( t xmondo,t ymondo,t zmondo ); World Translation glrotatef( α Mondo,D xmondo,d ymondo,d zmondo ); World Rotation Setting ModelView on each Object ( Objects) glmatrixmode(gl MODELVIEW);From this point, we work on M A. Martinelli Transforms 16/10/ / 39
81 The SceneGraph and OpenGL Transforms SceneGraphs and OpenGL (1/3) A good way to desing the Projection Matrix (once before drawing anything) glmatrixmode(gl PROJECTION);From this point, we work on P glloadidentity();p is set to the Identity glscale( size/width, size/height, eps ); Terms correcting Viewport Transforms gluperspective( angle, rapport,z near,z far ); Basic Perspective Transform gltranslatef( t xmondo,t ymondo,t zmondo ); World Translation glrotatef( α Mondo,D xmondo,d ymondo,d zmondo ); World Rotation Setting ModelView on each Object ( Objects) glmatrixmode(gl MODELVIEW);From this point, we work on M glloadidentity();setting M to Identity A. Martinelli Transforms 16/10/ / 39
82 The SceneGraph and OpenGL Transforms SceneGraphs and OpenGL (1/3) A good way to desing the Projection Matrix (once before drawing anything) glmatrixmode(gl PROJECTION);From this point, we work on P glloadidentity();p is set to the Identity glscale( size/width, size/height, eps ); Terms correcting Viewport Transforms gluperspective( angle, rapport,z near,z far ); Basic Perspective Transform gltranslatef( t xmondo,t ymondo,t zmondo ); World Translation glrotatef( α Mondo,D xmondo,d ymondo,d zmondo ); World Rotation Setting ModelView on each Object ( Objects) glmatrixmode(gl MODELVIEW);From this point, we work on M glloadidentity();setting M to Identity gltranslatef( t xoggetto,t yoggetto,t zoggetto ); Object Positioning A. Martinelli Transforms 16/10/ / 39
83 The SceneGraph and OpenGL Transforms SceneGraphs and OpenGL (1/3) A good way to desing the Projection Matrix (once before drawing anything) glmatrixmode(gl PROJECTION);From this point, we work on P glloadidentity();p is set to the Identity glscale( size/width, size/height, eps ); Terms correcting Viewport Transforms gluperspective( angle, rapport,z near,z far ); Basic Perspective Transform gltranslatef( t xmondo,t ymondo,t zmondo ); World Translation glrotatef( α Mondo,D xmondo,d ymondo,d zmondo ); World Rotation Setting ModelView on each Object ( Objects) glmatrixmode(gl MODELVIEW);From this point, we work on M glloadidentity();setting M to Identity gltranslatef( t xoggetto,t yoggetto,t zoggetto ); Object Positioning glrotatef( α Oggetto,D xoggetto,d yoggetto,d zoggetto ); Object Orientation A. Martinelli Transforms 16/10/ / 39
84 The SceneGraph and OpenGL Transforms SceneGraphs and OpenGL (1/3) A good way to desing the Projection Matrix (once before drawing anything) glmatrixmode(gl PROJECTION);From this point, we work on P glloadidentity();p is set to the Identity glscale( size/width, size/height, eps ); Terms correcting Viewport Transforms gluperspective( angle, rapport,z near,z far ); Basic Perspective Transform gltranslatef( t xmondo,t ymondo,t zmondo ); World Translation glrotatef( α Mondo,D xmondo,d ymondo,d zmondo ); World Rotation Setting ModelView on each Object ( Objects) glmatrixmode(gl MODELVIEW);From this point, we work on M glloadidentity();setting M to Identity gltranslatef( t xoggetto,t yoggetto,t zoggetto ); Object Positioning glrotatef( α Oggetto,D xoggetto,d yoggetto,d zoggetto ); Object Orientation glscalef( S Oggetto,S Oggetto,S Oggetto ); Object Resizing A. Martinelli Transforms 16/10/ / 39
85 The SceneGraph and OpenGL Transforms SceneGraphs and OpenGL (2/3) Open GL offers an important tool to build SceneGraphs: the Matrices Stack Usually, a Matrices Stack works on the glmatrixmode(gl MODELVIEW); Lo Stack delle Matrici glpushmatrix(); : create a copy of M push it on the stack glpopmatrix(); : retrieve (pop) the last matrix from the stack and use it to set M, overwriting it Nota P (GL PROJECTION) and M (GL MODELVIEW) can be both managed with push and pop and they have 2 separated stacks A. Martinelli Transforms 16/10/ / 39
86 The SceneGraph and OpenGL Transforms SceneGraphs and OpenGL (3/3) T1 House TPr T2 TRot Carousel Tv Coach Codice After Projection has been set up glmatrixmode(gl MODELVIEW); glloadidentity();m = I glpushmatrix();m = I gltranslatef(t2 x,t2 y,t2 z );M = IT 2 glrotatef(α rot,0,1,0);m = IT 2 T rot glpushmatrix();m = IT 2 T rot gltranslatef(tv x,tv x,tv x );M = IT 2 T rot T V drawcoach(); glpopmatrix();m = IT 2 T rot drawcarousel(); glpopmatrix();m = I gltranslatef(t1 x,t1 x,t1 x );M = IT 1 drawhouse(); A. Martinelli Transforms 16/10/ / 39
87 The SceneGraph and OpenGL Transforms Rendering Pipeline and Coordinates Transorms (1/2) A Coordinates Transforms Block is part of the Vertex Pipeline A. Martinelli Transforms 16/10/ / 39
88 The SceneGraph and OpenGL Transforms Rendering Pipeline and Coordinates Transorms (1/2) A Coordinates Transforms Block is part of the Vertex Pipeline It applies P and M as we have already seen A. Martinelli Transforms 16/10/ / 39
89 The SceneGraph and OpenGL Transforms Rendering Pipeline and Coordinates Transorms (1/2) A Coordinates Transforms Block is part of the Vertex Pipeline It applies P and M as we have already seen Note: About Transforming Normal Vectors The Normals we use in the Illumination Block should be transformed A. Martinelli Transforms 16/10/ / 39
90 The SceneGraph and OpenGL Transforms Rendering Pipeline and Coordinates Transorms (1/2) A Coordinates Transforms Block is part of the Vertex Pipeline It applies P and M as we have already seen Note: About Transforming Normal Vectors The Normals we use in the Illumination Block should be transformed For example: rotating a model should bring to rotated normals. A. Martinelli Transforms 16/10/ / 39
91 The SceneGraph and OpenGL Transforms Rendering Pipeline and Coordinates Transorms (1/2) A Coordinates Transforms Block is part of the Vertex Pipeline It applies P and M as we have already seen Note: About Transforming Normal Vectors The Normals we use in the Illumination Block should be transformed For example: rotating a model should bring to rotated normals. Normals should be transformed in the world, so only Modelview is applied. A. Martinelli Transforms 16/10/ / 39
92 The SceneGraph and OpenGL Transforms Rendering Pipeline and Coordinates Transorms (1/2) A Coordinates Transforms Block is part of the Vertex Pipeline It applies P and M as we have already seen Note: About Transforming Normal Vectors The Normals we use in the Illumination Block should be transformed For example: rotating a model should bring to rotated normals. Normals should be transformed in the world, so only Modelview is applied. But a direct application of the Modelview is wrong, because it would take into account scaling factors on each axes, so Normals are applied a modified version of the modelview. A. Martinelli Transforms 16/10/ / 39
93 The SceneGraph and OpenGL Transforms Rendering Pipeline and Coordinates Transorms (2/2) Vertex Stream Rastering Module ymax (x,c,z)min (x,c,z)max y ymin menti( (x,y),(c,z) ) Primitive Manager Z-Buffering read(z-test) Clipping, Viewport Transform write Color Buffer Depth Buffer A. Martinelli Transforms 16/10/ / 39
Computer Graphics Geometric Transformations
Computer Graphics 2016 6. Geometric Transformations Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2016-10-31 Contents Transformations Homogeneous Co-ordinates Matrix Representations of Transformations
More informationCS4202: Test. 1. Write the letter corresponding to the library name next to the statement or statements that describe library.
CS4202: Test Name: 1. Write the letter corresponding to the library name next to the statement or statements that describe library. (4 points) A. GLUT contains routines that use lower level OpenGL commands
More informationThe Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes
The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes What is it? The viewing pipeline is the procession of operations that are applied to the OpenGL matrices, in order to create a 2D representation
More informationOpenGL Transformations
OpenGL Transformations R. J. Renka Department of Computer Science & Engineering University of North Texas 02/18/2014 Introduction The most essential aspect of OpenGL is the vertex pipeline described in
More informationComputer Graphics. Chapter 7 2D Geometric Transformations
Computer Graphics Chapter 7 2D Geometric Transformations Chapter 7 Two-Dimensional Geometric Transformations Part III. OpenGL Functions for Two-Dimensional Geometric Transformations OpenGL Geometric Transformation
More information1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1
Transformations 1-1 Transformations are used within the entire viewing pipeline: Projection from world to view coordinate system View modifications: Panning Zooming Rotation 1-2 Transformations can also
More informationTransformations. CSCI 420 Computer Graphics Lecture 4
CSCI 420 Computer Graphics Lecture 4 Transformations Jernej Barbic University of Southern California Vector Spaces Euclidean Spaces Frames Homogeneous Coordinates Transformation Matrices [Angel, Ch. 4]
More informationCS 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 information3D Graphics Pipeline II Clipping. Instructor Stephen J. Guy
3D Graphics Pipeline II Clipping Instructor Stephen J. Guy 3D Rendering Pipeline (for direct illumination) 3D Geometric Primitives 3D Model Primitives Modeling Transformation 3D World Coordinates Lighting
More informationComputer Graphics Seminar
Computer Graphics Seminar MTAT.03.305 Spring 2018 Raimond Tunnel Computer Graphics Graphical illusion via the computer Displaying something meaningful (incl art) Math Computers are good at... computing.
More informationCS 4204 Computer Graphics
CS 424 Computer Graphics 2D Transformations Yong Cao Virginia Tech References: Introduction to Computer Graphics course notes by Doug Bowman Interactive Computer Graphics, Fourth Edition, Ed Angle Transformations
More informationCS 428: Fall Introduction to. Transformations in OpenGL + hierarchical modeling. Andrew Nealen, Rutgers, /21/2009 1
CS 428: Fall 2009 Introduction to Computer Graphics Transformations in OpenGL + hierarchical modeling 9/21/2009 1 Review of affine transformations Use projective geometry staple of CG Euclidean (x,z) (x,y,z)
More informationFall CSCI 420: Computer Graphics. 2.2 Transformations. Hao Li.
Fall 2017 CSCI 420: Computer Graphics 2.2 Transformations Hao Li http://cs420.hao-li.com 1 OpenGL Transformations Matrices Model-view matrix (4x4 matrix) Projection matrix (4x4 matrix) vertices in 3D Model-view
More informationThe 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
More informationCS 591B Lecture 9: The OpenGL Rendering Pipeline
CS 591B Lecture 9: The OpenGL Rendering Pipeline 3D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination Spring 2007 Rui Wang 3D Polygon Rendering Many applications
More informationOverview. By end of the week:
Overview By end of the week: - Know the basics of git - Make sure we can all compile and run a C++/ OpenGL program - Understand the OpenGL rendering pipeline - Understand how matrices are used for geometric
More informationMouse Ray Picking Explained
Mouse Ray Picking Explained Brian Hook http://www.bookofhook.com April 5, 2005 1 Introduction There comes a time in every 3D game where the user needs to click on something in the scene. Maybe he needs
More informationCSE452 Computer Graphics
CSE45 Computer Graphics Lecture 8: Computer Projection CSE45 Lecture 8: Computer Projection 1 Review In the last lecture We set up a Virtual Camera Position Orientation Clipping planes Viewing angles Orthographic/Perspective
More informationCOMS 4160: Problems on Transformations and OpenGL
COMS 410: Problems on Transformations and OpenGL Ravi Ramamoorthi 1. Write the homogeneous 4x4 matrices for the following transforms: Translate by +5 units in the X direction Rotate by 30 degrees about
More informationRasterization 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 informationNotes 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 informationTransforms 1 Christian Miller CS Fall 2011
Transforms 1 Christian Miller CS 354 - Fall 2011 Transformations What happens if you multiply a square matrix and a vector together? You get a different vector with the same number of coordinates These
More informationOverview. Viewing and perspectives. Planar Geometric Projections. Classical Viewing. Classical views Computer viewing Perspective normalization
Overview Viewing and perspectives Classical views Computer viewing Perspective normalization Classical Viewing Viewing requires three basic elements One or more objects A viewer with a projection surface
More informationModels and The Viewing Pipeline. Jian Huang CS456
Models and The Viewing Pipeline Jian Huang CS456 Vertex coordinates list, polygon table and (maybe) edge table Auxiliary: Per vertex normal Neighborhood information, arranged with regard to vertices and
More informationTransformations. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico
Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Angel: Interactive Computer Graphics 4E Addison-Wesley 25 1 Objectives
More informationCSC 470 Computer Graphics
CSC 470 Computer Graphics Transformations of Objects CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 1 Transformations of objects - 2D CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 2 Using
More informationOpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL
OpenGL: Open Graphics Library Introduction to OpenGL Part II CS 351-50 Graphics API ( Application Programming Interface) Software library Layer between programmer and graphics hardware (and other software
More informationComputer Graphics. Chapter 5 Geometric Transformations. Somsak Walairacht, Computer Engineering, KMITL
Chapter 5 Geometric Transformations Somsak Walairacht, Computer Engineering, KMITL 1 Outline Basic Two-Dimensional Geometric Transformations Matrix Representations and Homogeneous Coordinates Inverse Transformations
More informationToday. 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 informationReview of Thursday. xa + yb xc + yd
Review of Thursday Vectors and points are two/three-dimensional objects Operations on vectors (dot product, cross product, ) Matrices are linear transformations of vectors a c b x d y = xa + yb xc + yd
More informationLast week. Machiraju/Zhang/Möller/Fuhrmann
Last week Machiraju/Zhang/Möller/Fuhrmann 1 Geometry basics Scalar, point, and vector Vector space and affine space Basic point and vector operations Sided-ness test Lines, planes, and triangles Linear
More informationE.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 informationCS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.
CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions The Midterm Exam was given in class on Tuesday, October 16, 2012. 1. [7 pts] Synthetic-Camera Model. Describe the Synthetic-Camera Model : how
More informationLecture 5: Viewing. CSE Computer Graphics (Fall 2010)
Lecture 5: Viewing CSE 40166 Computer Graphics (Fall 2010) Review: from 3D world to 2D pixels 1. Transformations are represented by matrix multiplication. o Modeling o Viewing o Projection 2. Clipping
More information3D Transformation. In 3D, we have x, y, and z. We will continue use column vectors:. Homogenous systems:. x y z. x y z. glvertex3f(x, y,z);
3D Transformation In 3D, we have x, y, and z. We will continue use column vectors:. Homogenous systems:. 3D Transformation glvertex3f(x, y,z); x y z x y z A Right Handle Coordinate System x y z; y z x;
More informationGL_MODELVIEW transformation
lecture 3 view transformations model transformations GL_MODELVIEW transformation view transformations: How do we map from world coordinates to camera/view/eye coordinates? model transformations: How do
More informationChapter 3: Modeling Transformation
Chapter 3: Modeling Transformation Graphics Programming, 8th Sep. Graphics and Media Lab. Seoul National University 2011 Fall OpenGL Steps Every step in the graphics pipeline is related to the transformation.
More informationLecture 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 informationCOMP Computer Graphics and Image Processing. 5: Viewing 1: The camera. In part 1 of our study of Viewing, we ll look at ˆʹ U ˆ ʹ F ˆʹ S
COMP27112 Û ˆF Ŝ Computer Graphics and Image Processing ˆʹ U ˆ ʹ F C E 5: iewing 1: The camera ˆʹ S Toby.Howard@manchester.ac.uk 1 Introduction In part 1 of our study of iewing, we ll look at iewing in
More informationFor each question, indicate whether the statement is true or false by circling T or F, respectively.
True/False For each question, indicate whether the statement is true or false by circling T or F, respectively. 1. (T/F) Rasterization occurs before vertex transformation in the graphics pipeline. 2. (T/F)
More informationDescribe the Orthographic and Perspective projections. How do we combine together transform matrices?
Aims and objectives By the end of the lecture you will be able to Work with multiple transform matrices Describe the viewing process in OpenGL Design and build a camera control APIs Describe the Orthographic
More informationCSE328 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 informationCSE528 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 informationThree-Dimensional Viewing Hearn & Baker Chapter 7
Three-Dimensional Viewing Hearn & Baker Chapter 7 Overview 3D viewing involves some tasks that are not present in 2D viewing: Projection, Visibility checks, Lighting effects, etc. Overview First, set up
More informationAPI for creating a display window and using keyboard/mouse interations. See RayWindow.cpp to see how these are used for Assignment3
OpenGL Introduction Introduction OpenGL OpenGL is an API for computer graphics. Hardware-independent Windowing or getting input is not included in the API Low-level Only knows about triangles (kind of,
More information3D Viewing Episode 2
3D Viewing Episode 2 1 Positioning and Orienting the Camera Recall that our projection calculations, whether orthographic or frustum/perspective, were made with the camera at (0, 0, 0) looking down the
More informationSpring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013
Spring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013 PROJECT GOAL: Write a restricted OpenGL library. The goal of the project is to compute all the transformation matrices with your
More informationCS 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 informationThe Graphics Pipeline. Interactive Computer Graphics. The Graphics Pipeline. The Graphics Pipeline. The Graphics Pipeline: Clipping
Interactive Computer Graphics The Graphics Pipeline: The Graphics Pipeline Input: - geometric model - illumination model - camera model - viewport Some slides adopted from F. Durand and B. Cutler, MIT
More informationReading. Hierarchical Modeling. Symbols and instances. Required: Angel, sections , 9.8. Optional:
Reading Required: Angel, sections 9.1 9.6, 9.8 Optional: Hierarchical Modeling OpenGL rogramming Guide, the Red Book, chapter 3 cse457-07-hierarchical 1 cse457-07-hierarchical 2 Symbols and instances Most
More informationCSE Intro to Computer Graphics. ANSWER KEY: Midterm Examination. November 18, Instructor: Sam Buss, UC San Diego
CSE 167 - Intro to Computer Graphics ANSWER KEY: Midterm Examination November 18, 2003 Instructor: Sam Buss, UC San Diego Write your name or initials on every page before beginning the exam. You have 75
More informationGame 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 informationBasic Elements. Geometry is the study of the relationships among objects in an n-dimensional space
Basic Elements Geometry is the study of the relationships among objects in an n-dimensional space In computer graphics, we are interested in objects that exist in three dimensions We want a minimum set
More informationComputer Science 426 Midterm 3/11/04, 1:30PM-2:50PM
NAME: Login name: Computer Science 46 Midterm 3//4, :3PM-:5PM This test is 5 questions, of equal weight. Do all of your work on these pages (use the back for scratch space), giving the answer in the space
More informationCS230 : Computer Graphics Lecture 6: Viewing Transformations. Tamar Shinar Computer Science & Engineering UC Riverside
CS230 : Computer Graphics Lecture 6: Viewing Transformations Tamar Shinar Computer Science & Engineering UC Riverside Rendering approaches 1. image-oriented foreach pixel... 2. object-oriented foreach
More informationAffine Transformations in 3D
Affine Transformations in 3D 1 Affine Transformations in 3D 1 Affine Transformations in 3D General form 2 Translation Elementary 3D Affine Transformations 3 Scaling Around the Origin 4 Along x-axis Shear
More informationFundamental Types of Viewing
Viewings Fundamental Types of Viewing Perspective views finite COP (center of projection) Parallel views COP at infinity DOP (direction of projection) perspective view parallel view Classical Viewing Specific
More informationThree-Dimensional Graphics III. Guoying Zhao 1 / 67
Computer Graphics Three-Dimensional Graphics III Guoying Zhao 1 / 67 Classical Viewing Guoying Zhao 2 / 67 Objectives Introduce the classical views Compare and contrast image formation by computer with
More information蔡侑庭 (Yu-Ting Tsai) National Chiao Tung University, Taiwan. Prof. Wen-Chieh Lin s CG Slides OpenGL 2.1 Specification
蔡侑庭 (Yu-Ting Tsai) Department of Computer Science National Chiao Tung University, Taiwan Prof. Wen-Chieh Lin s CG Slides OpenGL 2.1 Specification OpenGL Programming Guide, Chap. 3 & Appendix F 2 OpenGL
More informationVisualisation Pipeline : The Virtual Camera
Visualisation Pipeline : The Virtual Camera The Graphics Pipeline 3D Pipeline The Virtual Camera The Camera is defined by using a parallelepiped as a view volume with two of the walls used as the near
More informationComputer Graphics Hands-on
Computer Graphics Hands-on Two-Dimensional OpenGL Transformations Objectives To get hands-on experience manipulating the OpenGL current transformation (MODELVIEW) matrix to achieve desired effects To gain
More informationTransformation Pipeline
Transformation Pipeline Local (Object) Space Modeling World Space Clip Space Projection Eye Space Viewing Perspective divide NDC space Normalized l d Device Coordinatesd Viewport mapping Screen space Coordinate
More information3D Mathematics. Co-ordinate systems, 3D primitives and affine transformations
3D Mathematics Co-ordinate systems, 3D primitives and affine transformations Coordinate Systems 2 3 Primitive Types and Topologies Primitives Primitive Types and Topologies 4 A primitive is the most basic
More informationCS452/552; EE465/505. Geometry Transformations
CS452/552; EE465/505 Geometry Transformations 1-26-15 Outline! Geometry: scalars, points & vectors! Transformations Read: Angel, Chapter 4 (study cube.html/cube.js example) Appendix B: Spaces (vector,
More informationEECE 478. Learning Objectives. Learning Objectives. Linear Algebra and 3D Geometry. Linear algebra in 3D. Coordinate systems
EECE 478 Linear Algebra and 3D Geometry Learning Objectives Linear algebra in 3D Define scalars, points, vectors, lines, planes Manipulate to test geometric properties Coordinate systems Use homogeneous
More informationComputer Viewing. Prof. George Wolberg Dept. of Computer Science City College of New York
Computer Viewing Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Introduce the mathematics of projection Introduce OpenGL viewing functions Look at alternate viewing
More informationPerspective Mappings. Contents
Perspective Mappings David Eberly, Geometric Tools, Redmond WA 98052 https://www.geometrictools.com/ This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy
More informationMidterm Exam Fundamentals of Computer Graphics (COMP 557) Thurs. Feb. 19, 2015 Professor Michael Langer
Midterm Exam Fundamentals of Computer Graphics (COMP 557) Thurs. Feb. 19, 2015 Professor Michael Langer The exam consists of 10 questions. There are 2 points per question for a total of 20 points. You
More informationViewing. Announcements. A Note About Transformations. Orthographic and Perspective Projection Implementation Vanishing Points
Viewing Announcements. A Note About Transformations. Orthographic and Perspective Projection Implementation Vanishing Points Viewing Announcements. A Note About Transformations. Orthographic and Perspective
More informationCOMP3421. Vector geometry, Clipping
COMP3421 Vector geometry, Clipping Transformations Object in model co-ordinates Transform into world co-ordinates Represent points in object as 1D Matrices Multiply by matrices to transform them Coordinate
More informationINTRODUCTION TO COMPUTER GRAPHICS. It looks like a matrix Sort of. Viewing III. Projection in Practice. Bin Sheng 10/11/ / 52
cs337 It looks like a matrix Sort of Viewing III Projection in Practice / 52 cs337 Arbitrary 3D views Now that we have familiarity with terms we can say that these view volumes/frusta can be specified
More informationModeling with Transformations
Modeling with Transformations Prerequisites This module requires some understanding of 3D geometry, particularly a sense of how objects can be moved around in 3-space. The student should also have some
More informationTwo possible ways to specify transformations. Each part of the object is transformed independently relative to the origin
Transformations Two possible ways to specify transformations Each part of the object is transformed independently relative to the origin - Not convenient! z y Translate the base by (5,0,0); Translate the
More informationTransformations. CSCI 420 Computer Graphics Lecture 5
CSCI 420 Computer Graphics Lecture 5 Transformations Jernej Barbic University of Southern California Vector Spaces Euclidean Spaces Frames Homogeneous Coordinates Transformation Matrices [Angel, Ch. 3]
More informationGraphics and Interaction Transformation geometry and homogeneous coordinates
433-324 Graphics and Interaction Transformation geometry and homogeneous coordinates Department of Computer Science and Software Engineering The Lecture outline Introduction Vectors and matrices Translation
More informationRendering. 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 informationTransformations. OpenGL Transformations. 4x4 Model-view Matrix (this lecture) OpenGL Transformation Matrices. 4x4 Projection Matrix (next lecture)
CSCI 420 Computer Graphics Lecture 5 OpenGL Transformations Transformations Vector Spaces Euclidean Spaces Frames Homogeneous Coordinates Transformation Matrices Jernej Barbic [Angel, Ch. 3] University
More informationCOMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates
COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates Department of Computer Science and Software Engineering The Lecture outline Introduction Vectors and matrices Translation
More informationComputer Graphics. Chapter 10 Three-Dimensional Viewing
Computer Graphics Chapter 10 Three-Dimensional Viewing Chapter 10 Three-Dimensional Viewing Part I. Overview of 3D Viewing Concept 3D Viewing Pipeline vs. OpenGL Pipeline 3D Viewing-Coordinate Parameters
More informationComputer Graphics 7: Viewing in 3-D
Computer Graphics 7: Viewing in 3-D In today s lecture we are going to have a look at: Transformations in 3-D How do transformations in 3-D work? Contents 3-D homogeneous coordinates and matrix based transformations
More informationINTRODUCTION TO COMPUTER GRAPHICS. cs123. It looks like a matrix Sort of. Viewing III. Projection in Practice 1 / 52
It looks like a matrix Sort of Viewing III Projection in Practice 1 / 52 Arbitrary 3D views } view volumes/frusta spec d by placement and shape } Placement: } Position (a point) } look and up vectors }
More informationCS602 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
More informationViewing. Reading: Angel Ch.5
Viewing Reading: Angel Ch.5 What is Viewing? Viewing transform projects the 3D model to a 2D image plane 3D Objects (world frame) Model-view (camera frame) View transform (projection frame) 2D image View
More informationUsing GLU/GLUT Objects
Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutwirecone glutwirecube glucylinder glutwireteapot GLU/GLUT Objects Each glu/glut object has its default size, position, and orientation
More informationPerspective matrix, OpenGL style
Perspective matrix, OpenGL style Stefan Gustavson May 7, 016 Gortler s book presents perspective transformation using a slightly different matrix than what is common in OpenGL applications. This document
More informationProjection 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
More informationSurface 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 informationCOMP3421. Introduction to 3D Graphics
COMP3421 Introduction to 3D Graphics 3D coodinates Moving to 3D is simply a matter of adding an extra dimension to our points and vectors: 3D coordinates 3D coordinate systems can be left or right handed.
More informationN-Views (1) Homographies and Projection
CS 4495 Computer Vision N-Views (1) Homographies and Projection Aaron Bobick School of Interactive Computing Administrivia PS 2: Get SDD and Normalized Correlation working for a given windows size say
More informationTransforms. COMP 575/770 Spring 2013
Transforms COMP 575/770 Spring 2013 Transforming Geometry Given any set of points S Could be a 2D shape, a 3D object A transform is a function T that modifies all points in S: T S S T v v S Different transforms
More informationIntroduction to 3D Graphics with OpenGL. Z-Buffer Hidden Surface Removal. Binghamton University. EngiNet. Thomas J. Watson
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
More informationAffine Transformations Computer Graphics Scott D. Anderson
Affine Transformations Computer Graphics Scott D. Anderson 1 Linear Combinations To understand the poer of an affine transformation, it s helpful to understand the idea of a linear combination. If e have
More informationCOMP3421. Week 2 - Transformations in 2D and Vector Geometry Revision
COMP3421 Week 2 - Transformations in 2D and Vector Geometry Revision Exercise 1. Write code to draw (an approximation) of the surface of a circle at centre 0,0 with radius 1 using triangle fans. Transformation
More informationComputer Viewing Computer Graphics I, Fall 2008
Computer Viewing 1 Objectives Introduce mathematics of projection Introduce OpenGL viewing functions Look at alternate viewing APIs 2 Computer Viewing Three aspects of viewing process All implemented in
More informationLecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009
Model s Lecture 3 Sections 2.2, 4.4 World s Eye s Clip s s s Window s Hampden-Sydney College Mon, Aug 31, 2009 Outline Model s World s Eye s Clip s s s Window s 1 2 3 Model s World s Eye s Clip s s s Window
More informationCSE 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
More informationBlue 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 informationRay Tracer I: Ray Casting Due date: 12:00pm December 3, 2001
Computer graphics Assignment 5 1 Overview Ray Tracer I: Ray Casting Due date: 12:00pm December 3, 2001 In this assignment you will implement the camera and several primitive objects for a ray tracer. We
More informationGraphics pipeline and transformations. Composition of transformations
Graphics pipeline and transformations Composition of transformations Order matters! ( rotation * translation translation * rotation) Composition of transformations = matrix multiplication: if T is a rotation
More informationComputer Graphics Shadow Algorithms
Computer Graphics Shadow Algorithms Computer Graphics Computer Science Department University of Freiburg WS 11 Outline introduction projection shadows shadow maps shadow volumes conclusion Motivation shadows
More information