 Download Download Presentation CS 497: Computer Graphics

# CS 497: Computer Graphics

Download Presentation ## CS 497: Computer Graphics

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. CS 497: Computer Graphics James Money

2. Overview Things to discuss: • Contracts with Dr. Fairfield. • Tests, Quizzes, and Projects. • Attendance and Lectures • Course Contents • Grading

3. Contract w/ Dr. Fairfield • You must complete a contract with Dr. Fairfield within two weeks of the start of the semester or when you sign up for the class. • It must include arrangements on grading, attendance, etc. • I must also receive a copy of the contract.

4. Tests, Quizzes, and Projects • Tests: There will be no tests as I can foresee it. However, I might schedule one. • Quizzes: I reserve the right to give unannounced quizzes on material I have covered in lectures. • Projects: They are assigned in advance and must be turned in by the due date at 4:30PM in Dr. Fairfield’s office or Dr. Sochacki’s office.

5. Attendance: You are expected to attend class everyday and 10% of grade is based on that. Lectures: I will give lectures almost everyday. Come prepared to learn and respond to ideas in class. Attendance & Lectures

6. Matrices, Vectors, and operations on them. 3D Modeling 3D Clipping Visible Surface Determination Lighting and Lighting techniques. Shading Texture Mapping Graphics Databases Object Collision Course Contents Luigi’s

7. Grading • Attendance: 10% • Projects I, II, and III: 50% • Broken into 10%, 20% and 20% • Final Project: 40%

8. The Problem: We want to view a 3D World on a 2D surface such as a computer monitor given an arbitrary view point and view angles in that world. We want this world to be as accurate as possible for us, such that we can not distinguish it from reality.

9. The Solution: The answer lies in a mathematical approach called Projections. Projections transform 3D objects onto a 2D plane, from which we are viewing. Before we can discuss projections, we must discuss the mathematical backgrounds that form the basis of projections, which is where we will begin next time!

10. Homework • Read Chapter 1 • Read section 3.6,3.14 • Read Chapter 4 if needed. • Read Chapter 5. • Read Chapter 6.

11. Topics • Vectors, Matrices, and Planes. • Mathematics we perform on them.

12. Vectors • A Vector is a column of numbers as such: 1 2 3 4

13. Vectors • We can add them, but not multiply them: 1 5 6 2 6 8 3 7 10 4 8 12 + =

14. Vectors • Instead of multiplying vector we can do two things with them: • Dot Product • Cross Product

15. Vectors and Dot Products The Dot Product of V and W is defined as: V•W = V1 W1 V2 W2 … … Vn Wn =V1*W1 + V2*W2 + … + Vn*Wn Length of (V)=SQRT(V •V)=||V|| •

16. Vector and Dot Products The dot product is not order dependent: V •W = W •V And this also equals: V •W = ||V||*||W||Cos(θ) Remember:||V||=

17. Matrices • Matrices are n-columns of vectors:

18. Matrices • You can Add matrices directly: = +

19. Multiplying Vectors • You can multiply a vector times a matrix: Note: The number of columns in the matrix must equal the number of rows in the vector.

20. Multiplying Matrices • Multiplying a matrix is a series of Matrix*Vector multiplications performed on each column of the second matrix.

21. Multiplying Matrices • If A and B are mxp and pxn sized matrices then AB is a mxn matrix. • ABBA in general! • If I is the identity matrix then AI=IA=A. I is:

22. Matrices, Inverses, & Determinants • The inverse of A is A-1 and AA-1=I=A-1A • The determinant of a matrix tells us if it is invertible. If Det A = 0, A is NOT invertible.(There are also a slew of other laws that apply if this is true.) The Det(A) if it is 3x3 is:

23. Vectors and Cross Products • Cross Products allow you to find a vector that if perpendicular to the given two vectors if they are in 3D: V x W = Det( ) = i(V2W3 - W2V3) - j(V1W3 - W1V3) + k(V1W2 - W1V2)

24. Planes • A Plane is the 3D space equivalent to the line in 2D space. It is defined by: Ax + By +Cz + D = 0. • A,B,C are the coefficients of the normal vector of the plane.

25. Planes and Normals • The normal vector of a plane is perpendicular to the plane and defines it. Given 3 points we can define a plane:

26. Planes • Given the Normal to a plane we can find D and the equation by plugging a point on the plane in the equation: Plot of (A,B,C,D) as (1,0,0,0) for X=0 plane.

27. Homework Continuation of Last Time! • Read Chapter 1 • Read section 3.6,3.14 • Read Chapter 4 if needed. • Read Chapter 5. • Read Chapter 6.

28. Points and Homogeneous Form Given a Point in the form: we can represent them as a homogeneous point in 4D space:

29. Homogenous Form and Matrices We represent a 3D coordinate in homogenous form to allow easy manipulation with matrices. We use 4x4 matrices to act on these points. I for these matrices is:

30. From XYZ to Homogeneous and Back • To make a point into homogeneous form: • To make a homogeneous vector into XYZ form again:

31. Translation To move a point from its current position to (x+a,y+b,z+c) use the matrix:

32. Scaling To scale a point by (a,b,c):

33. Rotating in X To rotate a point around the x axis:

34. Rotating in Y To rotate a point around the Y axis:

35. Rotating in Z To rotate a point around the Z axis:

36. Combining Matrices • You can combine matrices to simplify the processing of the points. However you must remember, order is important!(ABBA) • If you translate then scale, that is not necessarily the same as scaling then translating. • Also, rotations must be done around (0,0,0) in most cases. In this case, you must translate to the origin, rotate, and then translate back.

37. Homework Continuation of Last Time! • Read Chapter 1 • Read section 3.6,3.14 • Read Chapter 4 if needed. • Read Chapter 5. • Read Chapter 6.

38. Projections The mismatch between a 3D world and 2D drawing surface is solved via projections. Let’s first examine how we specify our 3D world we want to view.

39. 3D Viewing Process We specify a view volume in the world, a projection onto the projection plane, and viewport on the viewing surface. The points are first clipped against the view volume, then projected, and finally mapped to the display. Clip against view volume Project onto projection plane Transform into viewport in 2D device coordinates for display 3D world coordinates Clipped world coordinates

40. Projections Projections transform points of n-dimension to that of less than n-dimension. In our case, we are transforming a n dimensional point to a n-1 dimensional point. We will limit ourselves to 2D from 3D. A projection of a 3D object is defined by projectors from a center of projection, through the projection plane, and through the endpoints of an object. The projection of a line in 3D is a line in 2D, so we only need to consider endpoints of objects.

41. Perspective Projections Here is an example of perspective projection: A Projection plane B A` Projectors B` Center of Projection(COP) - Note also the vanishing point

42. Specifying a View To specify a view, you will need: • The projection plane, also called the view plane. The view plane is defined by: • View Reference Point(VRP) • View Plane Normal(VPN) • View Up Vector(VUP) V View Plane VUP VRP U VPN N

43. Specifying a View • Window on the view plane(in VRP coordinates): • Min U value • Min V value • Max U value • Max V value (Umax,Vmax) V View Plane VRP CW U N (Umin,Vmin) VPN

44. Specifying a View • The center of projection and direction defined by: • Projection Reference Point(PRP) V View Plane CW U N Center of Projection(PRP)

45. Specifying a View • Front and Back Clipping planes, at a distance F and B from the view plane. Back Clipping Plane View Plane VRP B(+) VPN F(-) Front Clipping Plane

46. From View Volume to display • The view volume is scaled to that of a unit pyramid from 0..1. • Points then can be clipped to this view volume, or eliminated entirely. • The clipped points are projected and then scaled by the viewport specifications of xmin, xmax, ymin, ymax, zmin, zmax(The monitor dimensions).

47. Perspective Projection To perform the perspective projection: • Translate VRP to the origin. • Rotate such that N becomes the Z axis, U the X axis, and V the Y axis. • Translate so that COP is at the origin. • Shear so that the center of the view volume becomes the Z axis. • Scale so that the view volume becomes the canonical perspective view volume.

48. Translate VRP to origin This is simple: Translate by (-VRP).

49. Rotating the Axes • VPN becomes the Z axis so: • The U axis is perpendicular to the VUP and VPN so: • The V axis is perpendicular to Rz and Rx so:

50. Rotating the Axes • The Rotation matrix is: Where R1x is the first component of Rx, etc.