Unformatted text preview:

Last Time Transformations Homogeneous coordinates Directions Rotation Geometry 101 Points edges triangles polygons Homework 3 due Oct 12 in class 10 7 04 University of Wisconsin CS559 Fall 2004 Today Viewing Transformations Describing Cameras and Views 10 7 04 University of Wisconsin CS559 Fall 2004 Graphics Pipeline Graphics hardware employs a sequence of coordinate systems The location of the geometry is expressed in each coordinate system in turn and modified along the way The movement of geometry through these spaces is considered a pipeline Local Coordinate Space 10 7 04 World Coordinate Space View Space Canonical View Volume University of Wisconsin CS559 Fall 2004 Display Space Local Coordinate Space It is easiest to define individual objects in a local coordinate system For instance a cube is easiest to define with faces parallel to the coordinate axes Key idea Object instantiation Define an object in a local coordinate system Use it multiple times by copying it and transforming it into the global system This is the only effective way to have libraries of 3D objects 10 7 04 University of Wisconsin CS559 Fall 2004 World Coordinate System Everything in the world is transformed into one coordinate system the world coordinate system It has an origin and three coordinate directions x y and z Lighting is defined in this space The locations brightness and types of lights The camera is defined with respect to this space Some higher level operations such as advanced visibility computations can be done here 10 7 04 University of Wisconsin CS559 Fall 2004 View Space Define a coordinate system based on the eye and image plane the camera The eye is the center of projection like the aperture in a camera The image plane is the orientation of the plane on which the image should appear like the film plane of a camera Some camera parameters are easiest to define in this space Focal length image size Relative depth is captured by a single number in this space The normal to image plane coordinate 10 7 04 University of Wisconsin CS559 Fall 2004 Canonical View Volume Canonical View Space A cube with the origin at the center the viewer looking down z x to the right and y up Canonical View Volume is the cube 1 1 1 1 1 1 Variants later with viewer looking down z and z from 0 1 Only things that end up inside the canonical volume can appear in the window Tasks Parallel sides and unit dimensions make many operations easier 10 7 04 Clipping decide what is in the window Rasterization decide which pixels are covered Hidden surface removal decide what is in front Shading decide what color things are University of Wisconsin CS559 Fall 2004 Window Space Window Space Origin in one corner of the window on the screen x and y match screen x and y Windows appear somewhere on the screen Typically you want the thing you are drawing to appear in your window But you may have no control over where the window appears You want to be able to work in a standard coordinate system your code should not depend on where the window is You target Window Space and the windowing system takes care of putting it on the screen 10 7 04 University of Wisconsin CS559 Fall 2004 Canonical Window Transform Problem Transform the Canonical View Volume into Window Space real screen coordinates Drop the depth coordinate and translate The graphics hardware and windowing system typically take care of this but we ll do the math to get you warmed up The windowing system adds one final transformation to get your window on the screen in the right place 10 7 04 University of Wisconsin CS559 Fall 2004 Canonical Window Transform Typically windows are specified by a corner width and height Corner expressed in terms of screen location This representation can be converted to xmin ymin and xmax ymax We want to map points in Canonical View Space into the window Canonical View Space goes from 1 1 1 to 1 1 1 Lets say we want to leave z unchanged What basic transformations will be involved in the total transformation from 3D screen to window coordinates 10 7 04 University of Wisconsin CS559 Fall 2004 Canonical Window Transform 1 1 xmax ymax xmin ymin 1 1 10 7 04 University of Wisconsin CS559 Fall 2004 Canonical Window Transform 1 1 xmax ymax xmin ymin 1 1 x pixel xmax xmin 2 y 0 pixel z pixel 0 0 1 10 7 04 0 ymax 0 ymin 2 0 0 0 xmax xmin ymax ymin 1 0 University of Wisconsin CS559 Fall 2004 0 1 2 xcanonical 2 ycanonical zcanonical 1 Canonical Window Transform You almost never have to worry about the canonical to window transform In OpenGL you tell it which part of your window to draw in relative to the window s coordinates That is you tell it where to put the canonical view volume You must do this whenever the window changes size Window not the screen has origin at bottom left glViewport minx miny maxx maxy Typically glViewport 0 0 width height fills the entire window with the image Why might you not fill the entire window The textbook derives a different transform but the same idea 10 7 04 University of Wisconsin CS559 Fall 2004 View Volumes Only stuff inside the Canonical View Volume gets drawn The window is of finite size and we can only store a finite number of pixels We can only store a discrete finite range of depths Like color only have a fixed number of bits at each pixel Points too close or too far away will not be drawn But it is inconvenient to model the world as a unit box A view volume is the region of space we wish to transform into the Canonical View Volume for drawing Only stuff inside the view volume gets drawn Describing the view volume is a major part of defining the view 10 7 04 University of Wisconsin CS559 Fall 2004 Orthographic Projection Orthographic projection projects all the points in the world along parallel lines onto the image plane Projection lines are perpendicular to the image plane Like a camera with infinite focal length The result is that parallel lines in the world project to parallel lines in the image and ratios of lengths are preserved This is important in some applications like medical imaging and some computer aided design tasks 10 7 04 University of Wisconsin CS559 Fall 2004 Orthographic View Space View Space a coordinate system with the viewer looking in the z direction with x horizontal to the right and y up A right handed coordinate system All ours will be The view volume is a rectilinear box for orthographic projection The view volume has a near plane at z n y l t f 10 7 04 a far plane at z f f n a left plane


View Full Document

UW-Madison CS 559 - CS 559 Lecture Notes

Documents in this Course
Filters

Filters

14 pages

Lecture 2

Lecture 2

24 pages

Clipping

Clipping

22 pages

Modeling

Modeling

33 pages

Filters

Filters

26 pages

Dithering

Dithering

33 pages

Lecture 4

Lecture 4

20 pages

Load more
Loading Unlocking...
Login

Join to view CS 559 Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CS 559 Lecture Notes and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?