Graphics Lecture 1: Slide 1 Interactive Computer Graphics Lecturers:Duncan Gillies Daniel Rueckert Tutors:Paul Aljabar.

Slides:



Advertisements
Similar presentations
Numbers Treasure Hunt Following each question, click on the answer. If correct, the next page will load with a graphic first – these can be used to check.
Advertisements

Computer Graphics: 2D Transformations
Adders Used to perform addition, subtraction, multiplication, and division (sometimes) Half-adder adds rightmost (least significant) bit Full-adder.
Angstrom Care 培苗社 Quadratic Equation II
AP STUDY SESSION 2.
1
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
1 Special Angle Values. 2 Directions A slide will appear showing a trig function with a special angle. Say the value aloud before the computer can answer.
David Burdett May 11, 2004 Package Binding for WS CDL.
Conversion Problems 3.3.
Properties of Real Numbers CommutativeAssociativeDistributive Identity + × Inverse + ×
CALENDAR.
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt BlendsDigraphsShort.
Points, Vectors, Lines, Spheres and Matrices
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 9 Adding Realism Through Texture.
GR2 Advanced Computer Graphics AGR
GR2 Advanced Computer Graphics AGR
SI23 Introduction to Computer Graphics
16.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 16 – Some Special Rendering Effects.
9.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 9 Adding Realism Through Texture.
1 Click here to End Presentation Software: Installation and Updates Internet Download CD release NACIS Updates.
The 5S numbers game..
Break Time Remaining 10:00.
Turing Machines.
Table 12.1: Cash Flows to a Cash and Carry Trading Strategy.
PP Test Review Sections 6-1 to 6-6
EIS Bridge Tool and Staging Tables September 1, 2009 Instructor: Way Poteat Slide: 1.
Slide 6-1 COMPLEX NUMBERS AND POLAR COORDINATES 8.1 Complex Numbers 8.2 Trigonometric Form for Complex Numbers Chapter 8.
MAT 205 F08 Chapter 12 Complex Numbers.
LIAL HORNSBY SCHNEIDER
Bellwork Do the following problem on a ½ sheet of paper and turn in.
14 Vectors in Three-dimensional Space Case Study
CS 6143 COMPUTER ARCHITECTURE II SPRING 2014 ACM Principles and Practice of Parallel Programming, PPoPP, 2006 Panel Presentations Parallel Processing is.
Exarte Bezoek aan de Mediacampus Bachelor in de grafische en digitale media April 2014.
Computer vision: models, learning and inference
Copyright © 2013, 2009, 2006 Pearson Education, Inc. 1 Section 5.5 Dividing Polynomials Copyright © 2013, 2009, 2006 Pearson Education, Inc. 1.
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
Functions, Graphs, and Limits
1..
Computer Graphics An Introduction. What’s this course all about? 05/10/2014 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
CONTROL VISION Set-up. Step 1 Step 2 Step 3 Step 5 Step 4.
Adding Up In Chunks.
1Computer Graphics Homogeneous Coordinates & Transformations Lecture 11/12 John Shearer Culture Lab – space 2
MaK_Full ahead loaded 1 Alarm Page Directory (F11)
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt Synthetic.
6.4 Best Approximation; Least Squares
Subtraction: Adding UP
1 hi at no doifpi me be go we of at be do go hi if me no of pi we Inorder Traversal Inorder traversal. n Visit the left subtree. n Visit the node. n Visit.
Essential Cell Biology
12 System of Linear Equations Case Study
Converting a Fraction to %
Clock will move after 1 minute
PSSA Preparation.
Immunobiology: The Immune System in Health & Disease Sixth Edition
Physics for Scientists & Engineers, 3rd Edition
Transformations Ed Angel Professor Emeritus of Computer Science
Select a time to count down from the clock above
Completing the Square Topic
Copyright Tim Morris/St Stephen's School
1.step PMIT start + initial project data input Concept Concept.
9. Two Functions of Two Random Variables
How to create Magic Squares
Copyright © Cengage Learning. All rights reserved.
Chapter 4 FUGACITY.
Technische Universität München Fakultät für Informatik Computer Graphics SS 2014 Transformations Rüdiger Westermann Lehrstuhl für Computer Graphik und.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Graphics Lecture 2: Slide 1 Lecture 2 Transformations for animation.
Presentation transcript:

Graphics Lecture 1: Slide 1 Interactive Computer Graphics Lecturers:Duncan Gillies Daniel Rueckert Tutors:Paul Aljabar Vu Luong Peng He Robin Wolz Webpage:

Graphics Lecture 1: Slide 2 Non-DOC Students In order to do this course for credit you need register with the department of computing. Information on enrolment can be found on the department of computing web page: Follow: Internal-> Student Centered Teaching -> External Student Registration

Graphics Lecture 1: Slide 3 Interactive Computer Graphics Lecture 1: Three Dimensional Graphical Scenes, Projection and Transformation

Graphics Lecture 1: Slide 4 Two Dimensional Graphics The lowest level of graphics processing operates directly on the pixels in a window provided by the operating system. Typical Primitives are: SetPixel(int x, int y, int colour); DrawLine(int xs, int ys, int xf, int yf); etc.

Graphics Lecture 1: Slide 5 World Coordinate Systems To achieve device independence when drawing objects we can define a world coordinate system. This will define our drawing area in units that are suited to the application: meters light years microns etc

Graphics Lecture 1: Slide 6 Example SetWindow(30,10,70,50)‏ DrawLine (50,30,80,50)‏ DrawLine (50,5,80,50)‏ World Coordinates Visible parts of lines Clipped parts of lines Drawing Area

Graphics Lecture 1: Slide 7 Normalisation To map device independent graphics commands to the drawing commands using the screen pixels we need a process of normalisation. First we must call the API to find out from the operating system the pixel addresses of the corners of the area we are using. Then we translate the world coordinates to pixel coordinates.

Graphics Lecture 1: Slide 8 Normalisation [Xd,Yd] [Xw,Yw] WxminWxmax Dxmin Dxmax World Coordinate Window Screen Viewport (Pixel Coordinates)‏

Graphics Lecture 1: Slide 9 Normalisation Having defined our world coordinates, and obtained our device coordinates we relate the two by simple ratios: rearranging we get:

Graphics Lecture 1: Slide 10 Normalisation A similar equation allows us to calculate the Y pixel coordinate. The two form a simple pair of linear equations: Xd := Xw * A + B; Yd := Yw * C + D; Where A, B, C and D are constants defining the normalisation

Graphics Lecture 1: Slide 11 Input for Graphics Systems An input event occurs when something changes, ie a mouse is moved or a button is pressed. The operating system informs the application program of events that are relevant to it. The application program must receive this information in what is sometimes called a callback procedure (or event loop).

Graphics Lecture 1: Slide 12 Simple Callback procedure while (executing) do { if (menu event) ProcessMenuRequest(); if (mouse event) {GetMouseCoordinates(); GetMouseButtons(); PerformMouseProcess(); } if (window resize event) RedrawGraphics(); }

Graphics Lecture 1: Slide 13 Polygon Rendering Many graphics applications use scenes built out of planar polyhedra. These are three dimensional objects whose faces are all planar polygons often called facets.

Graphics Lecture 1: Slide 14 Representing Planar Polygons In order to represent planar polygons in the computer we will require a mixture of numerical and topological data. Numerical Data Actual 3D coordinates of vertices, etc. Topological Data Details of what is connected to what

Graphics Lecture 1: Slide 15 Projections of Wire Frame Models Wire frame models simply include points and lines. In order to draw a 3D wire frame model we must first convert the points to a 2D representation. Then we can use simple drawing primitives to draw them. The conversion from 3D into 2D is a projection.

Graphics Lecture 1: Slide 16 Projection Projection of Vi Projection Surface 3D Object Vi Viewpoint Projector

Graphics Lecture 1: Slide 17 Non Linear Projections In general it is possible to project onto any surface: Sphere Cone etc or to use curved projectors, for example to produce lens effects. However we will only consider planar linear projections.

Graphics Lecture 1: Slide 18 Normal Orthographic Projection This is the simplest form of projection, and effective in many cases. The viewpoint is at z = -  The plane of projection is z=0 so All projectors have direction d = [0,0,-1]

Graphics Lecture 1: Slide 19 Orthographic Projection onto z=0 z x y V Projector V +  d (d=[0,0,-1)‏ V'

Graphics Lecture 1: Slide 20 Calculating an Orthographic Projection Projector Equation: P = V +  d (from vertex V)‏ Substitute d = [0,0,-1] Yields cartesian form Px = Vx + 0 Py = Vy + 0 Pz = Vz -  The projection plane is z=0 so the projected coordinate is [Vx,Vy,0] ie we simply take the 3D x and y components of the vertex

Graphics Lecture 1: Slide 21 Orthographic Projection of a Cube Looking at a Face Looking at a vertex General View

Graphics Lecture 1: Slide 22 Perspective Projection Orthographic projection is fine in cases where we are not worried about depth (ie most objects are at the same distance from the viewer). However for close work (particularly computer games) it will not do. Instead we use perspective projection

Graphics Lecture 1: Slide 23 Canonical Form for Perspective Projection Y Z X Plane of Projection (z=f)‏ Viewpoint Scene Projector f Projected point

Graphics Lecture 1: Slide 24 Calculating Perspective Projection Projector Equation (from vertex V): P =  V (all projectors go through the origin)‏ At the projected point Pz=f  p = Pz/Vz = f/Vz Px =  p Vx and Py =  p Vy Thus Px = f Vx/Vz and Py = f Vy/Vz The constant  p is sometimes called the fore- shortening factor

Graphics Lecture 1: Slide 25 Perspective Projection of a Cube Looking at a vertex General View Looking at a Face

Graphics Lecture 1: Slide 26 Problem Break Given that the viewpoint is at the origin, and the viewing plane is at z=5: What point on the viewplane corresponds to the 3D vertex {10,10,10} in a. Perspective projection b. Orthographic projection

Graphics Lecture 1: Slide 27 Problem Break Given that the viewpoint is at the origin, and the viewing plane is at z=5: What point on the viewplane corresponds to the 3D vertex {10,10,10} in a. Perspective projection b. Orthographic projection Perspective x'= f x/z = 5 and y' = f y/z = 5 Orthographic x' = 10 and y' =10

Graphics Lecture 1: Slide 28 The Need for Transformations Graphics scenes are defined in a particular co- ordinate system, however we want to be able to draw a graphics scene from any angle To draw a graphics scene we need the viewpoint to be the origin and the z axis to be the direction of view. Hence we need to be able to transform the coordinates of a graphics scene.

Graphics Lecture 1: Slide 29 Transformation of viewpoint Y X Z Y X Z Coordinate System for definition Coordinate System for viewing Required Viewpoint

Graphics Lecture 1: Slide 30 Other Transformations We also need transformations for other purposes: Animating Objects eg flying titles rotating shrinking etc. Multiple Instances the same object may appear at different places or different sizes Reflections and other special effects

Graphics Lecture 1: Slide 31 Matrix transformations of points To transform points we use matrix multiplications, for example to make an object at the origin twice as big we could use: which multiplied out gives:

Graphics Lecture 1: Slide 32 Translation by Matrix multiplication Many of our transformations will require translation of the points. For example if we want to move all the points two units along the x axis we would require: x’ = x + 2 y’ = y z’ = z But how can we do this with a matrix?

Graphics Lecture 1: Slide 33 Honogenous Coordinates The answer is to use 4D homogenous coordinates. The use of the fourth ordinate allows us to place a translation in the bottom row of the matrix. multiplying out gives: x' = x + 2, y' = y, z' = z

Graphics Lecture 1: Slide 34 General Homogenous Coordinates In most cases the last ordinate will be 1, but in general it is a scale factor. Thus, in the projection from 4D to 3D: [x, y, z, s] is equivalent to [x/s, y/s, z/s] Homogenous Cartesian

Graphics Lecture 1: Slide 35 Affine Transformations Affine transformations are those that preserve parallel lines. Most transformations we require are affine, the most important being: Scaling Translating Rotating Other more complex transforms will be built from these three.

Graphics Lecture 1: Slide 36 Translation We can apply a general translation by (tx, ty, tz) to the points of a scene by using the following matrix multiplication.

Graphics Lecture 1: Slide 37 Inverting a translation Since we know what transformation matrices do, we can write down their inversions directly For example:

Graphics Lecture 1: Slide 38 Scaling Scaling simply multiplies each ordinate by a scaling factor. It can be done with the following homogenous matrix:

Graphics Lecture 1: Slide 39 Inverting scaling To invert a scaling we simply divide the individual ordinates by the scale factor.

Graphics Lecture 1: Slide 40 Combining transformations Suppose we want to make an object at the origin twice as big and then move it to a point [5, 5, 20]. The transformation is a scaling followed by a translation:

Graphics Lecture 1: Slide 41 Combined transformations We multiply out the transformation matrices first, then transform the points

Graphics Lecture 1: Slide 42 Transformations are not commutative The order in which transformations are applied matters: In general TSST T * S is not the same as S * T

Graphics Lecture 1: Slide 43 The order of transformations is significant Graphics Scene (Square at origin)‏ Translate x:=x+1 Scale x:=2x Translate x:=x+1 Scale x:=2x Y X Y X Y X Y X Y X

Graphics Lecture 1: Slide 44 Rotation To define a rotation we need an axis. The simplest rotations are about the Cartesian axes eg Rx Rx - Rotate about the X axis Ry Ry - Rotate about the Y axis Rz - Rotate about the Z axis

Graphics Lecture 1: Slide 45 Rotation Matrices

Graphics Lecture 1: Slide 46 Deriving Rz Rotate by  r r   [x,y] [x t, y t ] Y X

Graphics Lecture 1: Slide 47 Signs of Rotations Rotations have a direction. The following rule applies to the matrix formulations given in the notes: Rotation is clockwise when viewed from the positive side of the axis

Graphics Lecture 1: Slide 48 Inverting Rotation Inverting a rotation by an angle  is equivalent to rotating through an angle of - , now Cos(-  ) = Cos(  )‏ and Sin(-  ) = -Sin(  )‏

Graphics Lecture 1: Slide 49 Inverting Rz To invert a rotation matrix simply change the sign of the sin terms.