CSC418 Computer Graphics Im not Professor Karan Singh Course web - - PowerPoint PPT Presentation

csc418 computer graphics i m not professor karan singh
SMART_READER_LITE
LIVE PREVIEW

CSC418 Computer Graphics Im not Professor Karan Singh Course web - - PowerPoint PPT Presentation

CSC418 Computer Graphics Im not Professor Karan Singh Course web site (includes course information sheet and discussion board): http://www.dgp.toronto.edu/~karan/courses/418/ Instructors: L0101, T 6-8pm L0201, W 3-5pm Karan Singh David


slide-1
SLIDE 1

CSC418 Computer Graphics

slide-2
SLIDE 2 Course web site (includes course information sheet and discussion board): http://www.dgp.toronto.edu/~karan/courses/418/ Instructors: L0101, T 6-8pm L0201, W 3-5pm Karan Singh David Levin BA 5258 BA 5266 978-7201 946-8630 karan@dgp.toronto.edu diwlevin@cs.toronto.edu
  • ffice hours: W 2-4pm
  • ffice hours: T 5-6pm
  • r by appointment.
  • r by appointment.
Textbooks: Fundamentals of Computer Graphics OpenGL Programming Guide & Reference

I’m not Professor Karan Singh

slide-3
SLIDE 3 3D Printable Structures Real-time Physics using ML
slide-4
SLIDE 4 https://s2018.siggraph.org/conference/conference-overview/student-volunteers/
slide-5
SLIDE 5

Showtime:

slide-6
SLIDE 6

Today’s Topics

  • 2. Review Implicit Curve Representation
  • 3. Transformations in 2D
  • 4. Coordinate-free geometry
  • 5. 3D Objects (curves & surfaces)
  • 6. Transformations in 3D
slide-7
SLIDE 7

Questions about the Midterm

If you have a valid, documented reason for missing the midterm exam, your final exam will be worth 50%
slide-8
SLIDE 8

Questions about the Assignment

Please contact the TAs via email at csc418tas@cs.toronto.edu
slide-9
SLIDE 9

Topic 2. 2D Curve Representations

  • Explicit representation
  • Parametric representation
  • Tangent & normal vectors
  • Implicit representation
slide-10
SLIDE 10

Implicit Curve Representation: Definition

slide-11
SLIDE 11

Implicit Curve Representation: Definition

slide-12
SLIDE 12

Implicit Curve Representation: Definition

slide-13
SLIDE 13

Normal Vectors from the Implicit Equation

slide-14
SLIDE 14

Topic 3: 2D Transformations

  • Simple Transformations
  • Homogeneous coordinates
  • Homogeneous 2D transformations
  • Affine transformations & restrictions
slide-15
SLIDE 15

Transformations are Fun

slide-16
SLIDE 16

Transformations

Transformation/Deformation in Graphics: A function f, mapping points to points. simple transformations are usually invertible. [x y] T [x’ y’] T Applications:
  • Placing objects in a scene.
  • Composing an object from parts.
  • Animating objects.
Processing Tree Demo! https://processing.org/examples/tree.html f f-1
slide-17
SLIDE 17

Lets start out simple…

Translate a point [x y]T by [tx ty]T : x’ = x + tx y’ = y + ty Rotate a point [x y]T by an angle t : x’ = x cost - y sint y’ = x sint + y cost Scale a point [x y]T by a factor [sx sy]T x’ = x sx y’ = y sy
slide-18
SLIDE 18

Representing 2D transforms as a 2x2 matrix

Rotate a point [x y]T by an angle t : x’ = cost -sint x y’ sint cost y Scale a point [x y]T by a factor [sx sy]T x’ = sx 0 x y’ 0 sy y
slide-19
SLIDE 19

Linear Transformations

slide-20
SLIDE 20

Finding matrices

slide-21
SLIDE 21

Finding matrices

=  T ✓1 ◆ T ✓0 1 ◆ x y

  • Transformation of a point is determined by a transformation of the basis vectors
slide-22
SLIDE 22

Finding matrices

slide-23
SLIDE 23

Representing 2D transforms as a 2x2 matrix

Rotate a point [x y]T by an angle t : x’ = cost -sint x y’ sint cost y Scale a point [x y]T by a factor [sx sy]T x’ = sx 0 x y’ 0 sy y Translation ?
slide-24
SLIDE 24

Representing 2D transforms as a 2x2 matrix

Rotate a point [x y]T by an angle t : x’ = cost -sint x y’ sint cost y Scale a point [x y]T by a factor [sx sy]T x’ = sx 0 x y’ 0 sy y Translate a point [x y]T by [tx ty]T : x’ = x + tx y’ = y + ty
slide-25
SLIDE 25

Intuition via Shearing

slide-26
SLIDE 26

Translation via Shearing

slide-27
SLIDE 27

Homogeneous coordinates

slide-28
SLIDE 28

Points as Homogeneous 2D Point Coords

[1 0]T [0 1]T p=[x y 1]T p= x[1 0 0]T + y[0 1 0]T +[0 0 1]T basis vectors
slide-29
SLIDE 29

Homogeneous coordinates in 2D: basic idea

slide-30
SLIDE 30

Homogeneous coordinates in 2D: points

slide-31
SLIDE 31

Representing 2D transforms as a 3x3 matrix

Translate a point [x y]T by [tx ty]T : x’ = 1 0 tx x y’ 0 1 ty y 1 0 0 1 1 Rotate a point [x y]T by an angle t : x’ = cost -sint 0 x y’ sint cost 0 y 1 0 0 1 1 Scale a point [x y]T by a factor [sx sy]T x’ = sx 0 0 x y’ 0 sy 0 y 1 0 0 1 1
slide-32
SLIDE 32

Cartesian ó Homogeneous 2D Points

Cartesian [x y]T => Homogeneous [x y 1]T Homogeneous [x y w]T => Cartesian [x/w y/w 1]T Homogeneous points are equal if they represent the same Cartesian point. For eg. [4 -6 2] T = [-6 9 -3] T.
slide-33
SLIDE 33

Geometric Intuition

w x y w = 1 (x’,y’,1) (0*x’,0*y’,0) (w*x’,w*y’,w) (x’,y’,0)
slide-34
SLIDE 34

Points at ∞ in Homogeneous Coordinates

[x y w] T with w=0 represent points at infinity, though with direction [x y] T and thus provide a natural representation for vectors, distinct from points in Homogeneous coordinates.
slide-35
SLIDE 35

Line Equations in Homogeneous Coordinates

A line given by the equation ax+by+c=0 can be represented in Homogeneous coordinates as: l=[a b c] , making the line equation l.p= [a b c][x y 1] T =0.
slide-36
SLIDE 36

The Line Passing Through 2 Points

For a line l that passes through two points p0, p1 we have l.p0 = l.p1 = 0. In other words we can write l using a cross product as: l= p0 X p1 p0 p1
slide-37
SLIDE 37

Point of intersection of 2 lines

For a point that is the intersection of two lines l0, l1 we have p.l0 = p.l1 = 0. In other words we can write p using a cross product as: p= l0 X l1 l1 l0 p What happens when the lines are parallel?
slide-38
SLIDE 38

A Line through 2 Points

For a line going through two points we have p0, p1 we have p0.l = p1.l = 0. p0 p1
slide-39
SLIDE 39

Properties of 2D transforms

…these 3x3 transforms have a variety of properties. most generally they map lines to lines. Such invertible Linear transforms are also called Homographies. …a more restricted set of transformations also preserve parallelism in lines. These are called Affine transforms. …transforms that further preserve the angle between lines are called Conformal. …transforms that additionally preserve the lengths of line segments are called Rigid. Where do translate, rotate and scale fit into these?
slide-40
SLIDE 40

Properties of 2D transforms

Homography, Linear (preserve lines) Affine (preserve parallelism) shear, scale Conformal (preserve angles) uniform scale Rigid (preserve lengths) rotate, translate
slide-41
SLIDE 41

Homography: mapping four points

How does the mapping of 4 points uniquely define the 3x3 Homography matrix?
slide-42
SLIDE 42

Homography: preserving lines

Show that if points p lie on some line l, then their transformed points p’ also lie on some line l’.
slide-43
SLIDE 43

Homography: preserving lines

Show that if points p lie on some line l, then their transformed points p’ also lie on some line l’. Proof: We are given that l.p = 0 and p’=Hp. Since H is invertible, p=H-1p’. Thus l.(H-1p’)=0 => (lH-1).p’=0, or p’ lies on a line l’= lH-1. QED
slide-44
SLIDE 44

Affine: preserving parallel lines

What restriction does the Affine property impose on H? If two lines are parallel their intersection point at infinity, is of the form [x y 0]T. If these lines map to lines that are still parallel, then [x y 0]T transformed must continue to map to a point at infinity or [x’ y’ 0]T i.e. [x’ y’ 0]T = * * * [x y 0]T * * * ? ? ?
slide-45
SLIDE 45

Affine: preserving parallel lines

What restriction does the Affine property impose on H? If two lines are parallel their intersection point at infinity, is of the form [x y 0]T. If these lines map to lines that are still parallel, then [x y 0]T transformed must continue to map to a point at infinity or [x’ y’ 0]T i.e. [x’ y’ 0]T = A t [x y 0]T 0 0 1 In Cartesian co-ordinates Affine transforms can be written as: p’ = Ap + t
slide-46
SLIDE 46

Affine Transformations: Composition

slide-47
SLIDE 47

Affine properties: inverse

The inverse of an Affine transform is Affine.
  • Prove it!
slide-48
SLIDE 48

Affine Transformations: Inverse

slide-49
SLIDE 49

Recall: Finding matrices

=  T ✓1 ◆ T ✓0 1 ◆ x y

  • Transformation of a point is determined by a transformation of the basis vectors
slide-50
SLIDE 50

Affine transform: geometric interpretation

A change of basis vectors and translation of the origin t A a1 a2 a1 a2 t p 0 0 1 p point p in the local coordinates of a reference frame defined by <a1,a2,t> is
  • 1
slide-51
SLIDE 51

Composing Transformations

Any sequence of linear transforms can be collapsed into a single 3x3 matrix by concatenating the transforms in the sequence. In general transforms DO NOT commute, however certain combinations
  • f transformations are commutative…
try out various combinations of translate, rotate, scale.
slide-52
SLIDE 52

Rotation about a fixed point

The typical rotation matrix, rotates points about the origin. How do you rotate about specific point q Tq R T-q
slide-53
SLIDE 53

Topic 4: Coordinate-Free Geometry (CFG)

  • A brief introduction & basic ideas
slide-54
SLIDE 54

Doing Geometry Without Coordinates

slide-55
SLIDE 55

CFG: Key Objects & their Homogeneous Repr.

slide-56
SLIDE 56

CFG: Basic Geometric Operations

slide-57
SLIDE 57

More CFG Ops: Linear Vector Combination

slide-58
SLIDE 58

More CFG Ops: Affine Point Combination

slide-59
SLIDE 59

More CFG Ops: Operations w/ Scalar Result

slide-60
SLIDE 60

Lecture 3 Starts Here

slide-61
SLIDE 61

Showtime

slide-62
SLIDE 62

SIGGRAPH Submissions

slide-63
SLIDE 63

SIGGRAPH Submissions

slide-64
SLIDE 64
slide-65
SLIDE 65 https://s2018.siggraph.org/conference/conference-overview/student-volunteers/
slide-66
SLIDE 66

Questions about the Midterm

If you have a valid, documented reason for missing the midterm exam, your final exam will be worth 50% Midterm will be in tutorials so if you are in my tutorial that means Monday, February 12
slide-67
SLIDE 67

Questions about the Assignment

Please contact the TAs via email at csc418tas@cs.toronto.edu Assignment 2 is not due during reading week. It will be due the Monday after reading week February 26th.
slide-68
SLIDE 68

Topic 5: 3D Objects

  • General curves & surfaces in 3D
  • Normal vectors, surface curves & tangent planes
  • Implicit surface representations
  • Example surfaces:
surfaces of revolution, bilinear patches, quadrics
slide-69
SLIDE 69

Reminder: Curves in 2D

slide-70
SLIDE 70

Curves in 3D

slide-71
SLIDE 71

Surfaces in 3D

slide-72
SLIDE 72

Surface Example: Planes in 3D

slide-73
SLIDE 73

Topic 5: 3D Objects

  • General curves & surfaces in 3D
  • Normal vectors, surface curves & tangent planes
  • Implicit surface representations
  • Example surfaces:
surfaces of revolution, bilinear patches, quadrics
slide-74
SLIDE 74

Tangent / Normal vectors of 2D curves

Explicit: y=f(x). Tangent is dy/dx. Parametric: x=fx(t) Tangent is (dx/dt, dy/dt) y=fy(t) Implicit: f(x,y) = 0 Normal is gradient(f). direction of max. change Given a tangent or normal vector in 2D how do we compute the other? What about in 3D?
slide-75
SLIDE 75

Normal vector of a plane

q a b p(s,t)= q + as +tb
slide-76
SLIDE 76

Normal vector of a plane

q a b n n=aXb
slide-77
SLIDE 77

Normal vector of a parametric surface

[f(u0,v0)] f(u0,v) f(u,v0)
slide-78
SLIDE 78

Tangent vectors of a parametric surface

[f(u0,v0)] f(u0,v) f(u,v0)
slide-79
SLIDE 79 v
  • U
Icu ,v)=[Fx( air ) ,Fy( a ,v ) ,fz(and

\

.

e. DX Z
slide-80
SLIDE 80 v

f-

ITT 's
  • U
Ecu ,v)=[Fx( air ) ,Fy( a ,v ) ,fz(AND C '

1

.

Fit

2D Curve

e DX Z
slide-81
SLIDE 81

Now some more math

C

(5)

= [ u( s ) , vcs ) ]

cyst

E ( ucs ) , vcs ) )

ckstos

)=C'ct+3I¥os+¥¥sos

else

'H=[EaEIEEl

  • 0,5
T I tangent Vector tangential Gradient
  • f
3D
  • f
C to surface Parametric Surface Independent
  • f
C !
slide-82
SLIDE 82 v

UF

III 's
  • oh
U a ,v)=[fx( air ) ,Fy( a ,v ) ,fz(and

I

.

Ehr

1 I '?aFr¥

the

DX Z
slide-83
SLIDE 83 C

(5)

= [ u( s ) , vcs ) ]

cyst

E ( ucs ) , vcs ) )

ckstos

)=C'ct+3I¥os+¥¥sos

else

'H=[EaEIEEl

  • 0,5
T I tangent Vector tangential Gradient
  • f
3D
  • f
C to surface Parametric Surface Independent
  • f
C !
slide-84
SLIDE 84

Normal vector of a parametric surface

[f(u0,v0)] f(u0,v) f(u,v0) n=f’(u0,v) X f’(u,v0) n
slide-85
SLIDE 85

Topic 5: 3D Objects

  • General curves & surfaces in 3D
  • Normal vectors, surface curves & tangent planes
  • Implicit surface representations
  • Example surfaces:
surfaces of revolution, bilinear patches, quadrics
slide-86
SLIDE 86

Implicit function of a plane

q a b n f(p) = (p-q).n=0
slide-87
SLIDE 87

Implicit function: level sets

slide-88
SLIDE 88

Representing Surfaces by an Implicit Function

slide-89
SLIDE 89

Example: The Implicit Function of a Plane

slide-90
SLIDE 90

Surface Normals from the Implicit Function

slide-91
SLIDE 91

Surface Normals from the Implicit Function

slide-92
SLIDE 92

Topic 5: 3D Objects

  • General curves & surfaces in 3D
  • Normal vectors, surface curves & tangent planes
  • Implicit surface representations
  • Example surfaces:
surfaces of revolution, bilinear patches, quadrics
slide-93
SLIDE 93

3D parametric surfaces

  • Extrude
  • Revolve
  • Loft
  • Square
slide-94
SLIDE 94

Surfaces of Revolution: Basic Construction

slide-95
SLIDE 95

Example: The Cylinder

slide-96
SLIDE 96

Example: Implicit Function of the Cylinder

slide-97
SLIDE 97

Example: The Torus as a Surface of Revolution

slide-98
SLIDE 98

3D parametric surfaces: Coons interpolation

b0 b3 b2 b1 interpolate(b0,b2) interpolate(b1,b3) bilinear interpolation