Three-Dimensional Viewing Hearn & Baker Chapter 7

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

Three Dimensional Viewing
1 Computer Graphics Chapter 8 3D Transformations.
Projection.
Three-Dimensional Viewing Sang Il Park Sejong University Lots of slides are stolen from Jehee Lee’s.
CMPE 466 COMPUTER GRAPHICS Chapter 8 2D Viewing Instructor: D. Arifler Material based on - Computer Graphics with OpenGL ®, Fourth Edition by Donald Hearn,
Course Website: Computer Graphics 9: Clipping In 3D.
CS 376 Introduction to Computer Graphics 02 / 26 / 2007 Instructor: Michael Eckmann.
4.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 4 Projection Clipping Viewport Transformation.
3D Concepts UNIT 3. 3-D Coordinate Spaces Remember what we mean by a 3-D coordinate space x axis y axis z axis P y z x Right-Hand Reference System.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.
12.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 12 – 3D Graphics Transformation Pipeline: Projection and Clipping.
Viewing and Projections
Computer Graphics (fall 2009)
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.
UBI 516 Advanced Computer Graphics Three Dimensional Viewing
Advanced Computer Graphics Three Dimensional Viewing
Transformation & Projection Feng Yu Proseminar Computer Graphics :
3D Viewing.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
Computer Graphics 2 – Dimensional Viewing.
Camera. Content Coordinate systems and transformations Viewing coordinates Coordinate transformation matrix Projections Window and viewport Acknowledgments:
Graphics Graphics Korea University cgvr.korea.ac.kr 3D Viewing 고려대학교 컴퓨터 그래픽스 연구실.
Computer Graphics Bing-Yu Chen National Taiwan University.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
10/3/02 (c) 2002 University of Wisconsin, CS 559 Last Time 2D Coordinate systems and transformations.
Three-Dimensional Viewing Jehee Lee Seoul National University.
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.
University of North Carolina at Greensboro
2003CS Hons RW778 Graphics1 Chapter 7: Three-Dimensional Viewing Chapter 5: Camera with parallel projection Chapter 5: Camera with parallel projection.
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)
Jinxiang Chai CSCE 441 Computer Graphics 3-D Viewing 0.
Three-Dimensional Viewing
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
A Photograph of two papers
CS552: Computer Graphics Lecture 11: Orthographic Projection.
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
CS 376 Introduction to Computer Graphics 02 / 14 / 2007 Instructor: Michael Eckmann.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Perspective View Volume View Volume Far Near Window Far Near Window Center of Projection Center of Projection (a) Original Orientation (b) After Transformation.
Three-Dimensional Viewing Clipping Computer Graphics C Version (456p - 462p)
Chapter: Viewing.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
Chun-Yuan Lin Coordinate Reference Frames 2016/6/22 1 CG.
Outline 3D Viewing Required readings: HB 10-1 to 10-10
Viewing in 3D Lecture 11. Viewing in 3D2 u The 3D viewing process is inherently more complex than is the 2D viewing process. F In 2D, we simply specify.
PROJECTIONS PROJECTIONS 1. Transform 3D objects on to a 2D plane using projections 2 types of projections Perspective Parallel In parallel projection,
3D Viewing and Clipping Ming Ouhyoung 歐陽明 Professor Dept. of CSIE and GINM NTU.
Three Dimensional Viewing
Rendering Pipeline Fall, 2015.
University of North Carolina at Greensboro
Projection Our 3-D scenes are all specified in 3-D world coordinates
3D Viewing cgvr.korea.ac.kr.
Computer Graphics Viewing
CSCE 441 Computer Graphics 3-D Viewing
2D Viewing Pipeline.
Viewing in 3D Chapter 6.
Unit 4 3D Viewing Pipeline Part - 2
3D Clipping.
Three Dimensional Viewing
OpenGL 2D Viewing Pipeline
Viewing (Projections)
Viewing (Projections)
3D Viewing.
THREE-DIMENSIONAL VIEWING II
THREE-DIMENSIONAL VIEWING
Presentation transcript:

Three-Dimensional Viewing Hearn & Baker Chapter 7 COMPUTER GRAPHICS Three-Dimensional Viewing Hearn & Baker Chapter 7

Overview 3D viewing involves some tasks that are not present in 2D viewing: Projection, Visibility checks, Lighting effects, etc.

Overview First, set up viewing (or camera) coordinate reference The position and orientation for a view plane (or projection plane) that corresponds to a camera film plane Figure 10-1 Coordinate reference for obtaining a selected view of a three-dimensional scene.

Projections Parallel projection Perspective projection As used in engineering and architectural drawings Shows accurate dimensions Perspective projection Objects far away are shown smaller than nearby same size objects Figure 10-2 Three parallel-projection views of an object, showing relative proportions from different viewing positions.

Depth Cueing Depth info is important to identify viewing direction Depth cueing: Vary the brightness of lines according to distance

3D Viewing Pipeline Choose a viewing position (place the camera) Decide on camera orientation Direction and rotation (up direction) Figure 10-5 Photographing a scene involves selection of the camera position and orientation.

Some viewing operations in 3D are same as in 2D 3D Viewing Pipeline Some viewing operations in 3D are same as in 2D 2D viewport, 2D clipping window, etc. Some are different Even though clipping window is 2D on the view plane, the scene is clipped against a volume (view volume)

3D Viewing Pipeline Figure 10-6 General three-dimensional transformation pipeline, from modeling coordinates (MC) to world coordinates (WC) to viewing coordinates (VC) to projection coordinates (PC) to normalized coordinates (NC) and, ultimately, to device coordinates (DC).

3D Viewing-Coordinate Parameters Select View point (or viewing position, eye position, camera position) P0=(x0,y0,z0) View-up vector V to define yview Direction to define zview Figure 10-7 A right-handed viewing-coordinate system, with axes x view, y view, and z view, relative to a right-handed world-coordinate frame.

The View-Plane Normal Vector Viewing direction is along zview axis So, view plane (or projection plane) is normally perpendicular to this axis Orientation of the view plane (and direction of positive zview axis) can be defined by a view-plane normal vector N Figure 10-8 Orientation of the view plane and view-plane normal vector N.

The View-Plane Normal Vector Then, a scalar parameter is used to set the position of the view plane at coordinate zvp along zview axis Figure 10-9 Three possible positions for the view plane along the z view axis.

The View-Up Vector After view plane normal N, we choose a direction for view-up vector V (used to determine positive yview) V should be perpendicular to N Viewing routines typically adjust user-defined V Often, V=(0,1,0) is a convenient choice Figure 10-11 Adjusting the input direction of the view-up vector V to an orientation perpendicular to the view-plane normal vector N.

The uvn Viewing-Coordinate Reference Frame Right-handed viewing systems are more common, but sometimes left-handed viewing systems are used In left-handed viewing systems viewing direction is towards the positive zview direction Left-handed coordinate references are often used to represent screen coordinates and for the normalization transformation

The uvn Viewing-Coordinate Reference Frame View-plane normal N defines zview axis direction View-up vector V is used to obtain yview axis direction We need to determine xview axis direction cross product of N and V gives U in xview axis direction cross product of N and U gives adjusted V u, v, n are unit vectors in directions U, V, N Figure 10-12 A right-handed viewing system defined with unit vectors u, v, and n.

Generating 3D Viewing Effects By varying viewing parameters, different viewing effects can be achieved

Transformation from World to Viewing Coordinates Translate viewing coordinate origin (P0) to the world coordinate origin Align xview, yview, zview with xw, yw, zw

Transformation from World to Viewing Coordinates The transformation matrix is the product of these translation and rotation matrices

Projection Transformations In parallel projection, coordinate positions are transferred to view plane along parallel lines orthogonal/orthographic oblique For perspective projection, coordinates are transferred to view plane along lines that converge at a point

Orthogonal Projections Projection along lines parallel to the view-plane normal N Front, side, rear orthogonal projections are often called elevations The top one is called plan view Figure 10-17 Orthogonal projections of an object, displaying plan and elevation views.

Axonometric and Isometric Orthogonal Projections . Orthogonal projections which show more than one face of an object are called axonometric orthogonal projections Isometric: Most common axonometric o.p.s that are generated by aligning projection plane so that it intersects principal axes at the same distance from origin

Orthogonal Projection Coordinates If projection direction is parallel to zview xp=x, yp=y z coordinate is kept for visibility detection procedures Figure 10-19 An orthogonal projection of a spatial position onto a view plane.

Clipping Window and Orthogonal Projection View Volume Edges of the clipping window specify the x and y limits These are used to form the top, bottom, and two sides of a clipping region called the orthogonal-projection view volume Limit the volume in zview direction by near-far (or front-back) clipping planes

Figure 10-22 A finite orthogonal view volume with the view plane “in front” of the near plane.

Normalization Transformation for an Orthogonal Projection mapping coordinates into a normalized view volume with coordinates in the range -1 to 1

Oblique Parallel Projections Projection path is not perpendicular to view plane It can be defined with a vector direction The effect is same as z-axis shearing transformation Figure 10-25 An oblique parallel projection of a cube, shown in a top view (a), produces a view (b) containing multiple surfaces of the cube.

Figure 10-32 Top view of an oblique parallel-projection transformation Figure 10-32 Top view of an oblique parallel-projection transformation. The oblique view volume is converted into a rectangular parallelepiped, and objects in the view volume, such as the green block, are mapped to orthogonal-projection coordinates.

Perspective Projections Project objects to view plane along converging paths to projection reference point (or center of projection) Figure 10-33 A perspective projection of two equal-length line segments at different distances from the view plane.

Perspective Projections If it is at origin On the viewplane, z’=zvp. Solve this for u Substitute this u into x’ and y’ equations If projection reference point is on zview Figure 10-34 A perspective projection of a point P with coordinates (x, y, z) to a selected projection reference point. The intersection position on the view plane is (xp, yp, zvp ).

Figure 10-35 A perspective-projection view of an object is upside down when the projection reference point is between the object and the view plane. Q. What if the scene is between the projection reference point and the view plane?

Figure 10-36 Changing perspective effects by moving the projection reference point away from the view plane.

Vanishing Points Lines parallel to view plane are still parallel But, other lines parallel to each other are now converging The point such lines converge at are vanishing points Vanishing points for lines parallel to principal axes are principal vanishing points How many principal v.p.s can be seen depends on projection plane orientation 1-point, 2-point, or 3-point projections

Perspective Projection View Volume An infinite pyramid of vision is chopped off by near and far clipping planes and we get a truncated pyramid (or frustum)

Perspective-Projection Transformation Matrix Cannot directly apply a matrix and get the result 2 steps are required First, calculate the homogeneous coordinates using perspective projection matrix Ph=Mpers P Then, after normalization and clipping, divide by h (homogeneous parameter, h=zprp-z) sz (scaling) and tz (translation) factors for normalizing projected z coordinate values (they depend on the selected normalization range

Symmetric Perspective Projection Frustum If the line from perspective reference point through clipping window center (centerline) is perpendicular to view plane, we have a symmetric frustum Clipping window can be specified by width and height, or field-of-view angle and aspect ratio With a symmetric frustum, perspective transformation is a mapping to orthogonal coordinates (figure on next slide)

Figure 10-44 A symmetric frustum view volume is mapped to an orthogonal parallelepiped by a perspective-projection transformation.

Oblique Perspective-Projection Frustum Centerline not perpendicular to view plane First, transform this into a symmetric frustum (z-axis shearing) Then proceed as before

Viewport Transformation and 3D Screen Coordinates Once we have normalized projection coordinates, clipping can be done on the symmetric cube (or unit cube) After clipping, cube contents can be transferred to screen coordinates For x and y, same as in 2D Depth info (z coordinates) must be retained for visibility testing and surface rendering

3D Clipping Algorithms No matter what the projection details were, we now have a normalized cube, so we clip against planes parallel to Cartesian planes (either at coordinates 0 and 1, or -1 and 1) The task is to identify object sections within the cube (save parts inside and eliminate parts outside) Algorithms are extensions of the 2D algorithms

3D Region Codes The idea is the same as in 2D (we added 2 more bits for near and far planes) A point is now P=(xh,yh,zh,h) h can be a value other than 1 (in perspective projection), so, the inequalities to be satisfied are -1<=xh/h<=1 -1<= yh/h<=1 -1<= zh/h<=1

3D Region Codes And bit values can be decided by h values should be nonzero and often positive (these can be easily checked) So, our inequalities become -h <= xh <= h, -h <= yh <= h, and -h <= zh <= h And bit values can be decided by bit 1 = 1 if h + xh < 0 (left) bit 2 = 1 if h - xh < 0 (right) bit 3 = 1 if h + yh < 0 (bottom) bit 4 = 1 if h - yh < 0 (top) bit 5 = 1 if h + zh < 0 (near) bit 6 = 1 if h - zh < 0 (far)

Figure 10-50 Values for the three-dimensional, six-bit region code that identifies spatial positions relative to the boundaries of a view volume.

__ Figure 10-51 Three-dimensional region codes for two line segments. Line P1P2 intersects the right and top clipping boundaries of the view volume, while line P3P4 is completely below the bottom clipping plane. __

Figure 10-52 Three-dimensional object clipping Figure 10-52 Three-dimensional object clipping. Surface sections that are outside the view-volume clipping planes are eliminated from the object description, and new surface facets may need to be constructed.

Figure 10-53 Clipping a line segment against a plane with normal vector N.

Figure 10-54 Clipping the surfaces of a pyramid against a plane with normal vector N. The surfaces in front of the plane are saved, and the surfaces of the pyramid behind the plane are eliminated.