Computer Graphics Lecture 20

Slides:



Advertisements
Similar presentations
Defining the Viewing Coordinate System
Advertisements

Computer Graphics Lecture 8 Arbitrary Viewing II: More Projection, Clipping and Mathematics of 3D Viewing.
Viewing and Projections
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 5: Viewing
4.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 4 Projection Clipping Viewport Transformation.
Congruence and Similarity
Scalar and Vector Fields
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
12.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 12 – 3D Graphics Transformation Pipeline: Projection and Clipping.
Isometric projection Projection on a plane such that mutually perpendicular edges appear at 120o to each other. Iso (same) angle between the axes. Example.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
CS 376 Introduction to Computer Graphics 02 / 12 / 2007 Instructor: Michael Eckmann.
02/26/02 (c) 2002 University of Wisconsin, CS 559 Last Time Canonical view pipeline Orthographic projection –There was an error in the matrix for taking.
Week 2 - Wednesday CS361.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
2 COEN Computer Graphics I Evening’s Goals n Discuss the mathematical transformations that are utilized for computer graphics projection viewing.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
Games Development 1 Camera Projection / Picking CO3301 Week 8.
CS 4731: Computer Graphics Lecture 13: Projection Emmanuel Agu.
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Computer Graphics Camera Projection / Picking CO2409 Week 8 - Optional Advanced Material Not on Exam.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Three-Dimensional Viewing Hearn & Baker Chapter 7
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 5: Viewing
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
A Photograph of two papers
Computer Graphics Matrices
Viewing and Projection
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
Computer Graphics Lecture 17 3-D Transformations-I Taqdees A. Siddiqi
Computer Graphics Lecture 19 PROJECTIONS I Taqdees A. Siddiqi
Outline 3D Viewing Required readings: HB 10-1 to 10-10
A Photograph of two papers The Model: 2 papers – 8cm x 8cm and 5cm x 5cm The Camera – Simple pinhole – No focusing capability The Scene – Arrangements.
Computer Graphics Lecture 06 Circle Drawing Techniques Taqdees A. Siddiqi
Visible Surface Detection
Perspective projection
Computer Graphics Lecture 14 CLIPPING I Taqdees A. Siddiqi
Rendering Pipeline Fall, 2015.
Computer Graphics Lecture 21 Triangles and Planes Taqdees A
Geometric Transformations
CSE 167 [Win 17], Lecture 5: Viewing Ravi Ramamoorthi
Computer Graphics Lecture 28 REVIEW III Taqdees A. Siddiqi
Transformations contd.
Intro to 3D Graphics.
Translations and Reflections
CSCE 441 Computer Graphics 3-D Viewing
CSC461: Lecture 20 Parallel Projections in OpenGL
CENG 477 Introduction to Computer Graphics
Projections and Normalization
Introduction to Computer Graphics with WebGL
A Photograph of two papers
WINDOWING AND CLIPPING
Vectors for Calculus-Based Physics
WINDOWING AND CLIPPING
Lecture 13 Clipping & Scan Conversion
Computer Graphics Lecture 36 CURVES II Taqdees A. Siddiqi
Last Time Canonical view pipeline Projection Local Coordinate Space
Drill: Monday, 9/28 Find the coordinates of the image of ∆ABC with vertices A(3, 4), B(–1, 4), and C(5, –2), after each reflection. 1. across the x-axis.
Introduction to Computer Graphics with WebGL
Transformation Geometry
Viewing (Projections)
The View Frustum Lecture 10 Fri, Sep 14, 2007.
Viewing (Projections)
컴퓨터 그래픽스를 위한 기하학적 기초 (Line Geometry for Computer Graphics)
Viewing Transformations II
Using Matrices to Perform Geometric Transformations
Presentation transcript:

Computer Graphics Lecture 20

Computer Graphics Lecture 20 PROJECTIONS II Taqdees A. Siddiqi cs602@vu.edu.pk

Prospective Projection How do you calculate the corresponding screen pixel?

This is a mathematical task as pictured This is a mathematical task as pictured. However , we can make it much simpler if we impose the following requirements:

The point of View(POV) must lie on the Z axis, The screen plane must be prallel to the X,Y plane, with the left and right edges of the screen parallel to the Y-axis, And the top and bottom edges of the screen parallel to the X-axis

For our view to come out correctly, we will also want the Z axis to pass through the middle of the screen. Why ?

Two common apporaches are used with this: 1. The first is where the POV is at same point (0,0,-z) and the screen lies on the X-Y plane, graphically, this looks like figure:

1. The second is where the POV lies at the origin, and the screen lies on a plane at some +Z coordinate, as shown in figure given below:

Calculating the screen pixel that correlates to a 3D point is now a matter of simple geometry. From a viewpoint above the screen and POV (looking at the X-Z plane), the geometry appears like the one shown in this figure:

In geometric terms, we say that the triangle from A to B to S is similar to the triangle from A to C to P because the three angles that make up the triangles are the same; the angle from AB to AS is the same as the angle from AC to AP.

The two rithg angles i.e. 90 , and therefore the remaining two angles are the same (the sum of the angles in a triangle is always 180 degrees).

What also holds true from similar triangles is that the ratio of two sides also holds between the similar triangles; this means that the ratio of BS to AB is the same as the ratio of CP to AC.

But we know what AB is –it is Screen.z! and

But we know what AB is –it is Screen.z! and we know what AC is – it is point.z! and

But we know what AB is –it is Screen.z! and we know what AC is – it is point.z! and we know what CP is – it is point.x! Therefore:

|BS| / |AB| = |CP| / |AC| |BS| = |AB| * |CP| / |AC| |BS| = Screen.z * point.x / point.z

Note that : Screen.z is the distance d from the point of view at origin or the scaling factor.

There is a final transformation that the points must go through in this transformation process.

This transformation maps 3D points defined with respect to the view origin (in view space) and turns them into 2D points that can be drawn on the display

After transforming and clipping the polygons that make up the scene such that they are visible on the screen, the final step is to move them into 2D coordinates

Since in order to actually draw things on the screen we need to have absolute x,y coordinates

The way this used to be done was without matrices, just as an explicit projection calculation. The point (x,y,z) would be mapped to (x`,y`) using the following equations:

The perspective Projection Matrix The aspect ratio of screen (in terms of width and height), is calculated as:

With these parameters, the following projection matrix can be made:

Just for a sanity check, check out the result of this matrix multiplication:

Since, after the multiplication, ‘w’ is set to z (which can be any value) All four components need to be divided by z to get normalized. This gives the following Cartesian coordinates:

As you can see, this is exactly what was wanted As you can see, this is exactly what was wanted. The width and height are still scaled by values as in the above equation and they are still divided by z

We then multiply the world, view, and projection matrices together (in that order) to get a total matrix that transforms point from object space to screen space

Vworld = VlocalMworld Vview =VworldMview Vscreen = VviewMprojecton Vscreen = Vlocal (MworldMviewMprojection)

The Viewing Frustm The volume within the pyramid between the frotn and back clipping planes is the viewing frustum. Objects are visible only when they are in this volume.

The viewing frustum is defined by fov (field of view) front and back clipping planes, specified in z-coordinates.