Presentation is loading. Please wait.

Presentation is loading. Please wait.

CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.

Similar presentations


Presentation on theme: "CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA."— Presentation transcript:

1 CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA

2 LEARNING OBJECTIVES In this chapter you will learn about: – –3D Cartesian coordinate systems – –The synthetic-camera model – –The viewing system – –The view volume – –Culling – –Clipping – –Changing coordinate systems – –Viewing transformations – –The modeling/world transformation – –The projection transformation – –The viewport transformation

3 LEARNING OBJECTIVES In this chapter you will learn about: – –Spatial transformations – –Translation – –Rotation – –Scaling – –Drawing a triangle without any transformations – –Drawing a triangle translated – –Drawing a triangle rotated – –Drawing a triangle scaled

4 3D CARTESIAN COORDINATE SYSTEMS The field of computer graphics relies heavily on vector calculations and matrix transformations. These calculations, along with the Cartesian coordinate system, are based on numbers indicating distances. The Cartesian coordinate system is consequently the most fundamental system for the unique identification of arbitrary points in space.

5 3D CARTESIAN COORDINATE SYSTEMS Two kinds of Cartesian coordinate systems: – –two-dimensional – –three-dimensional

6 3D CARTESIAN COORDINATE SYSTEMS A two-dimensional Cartesian coordinate system consists of an origin intersected by two axes perpendicular to each other. – –The vertical axis is known as the y-axis and the horizontal axis, the x-axis.

7 3D CARTESIAN COORDINATE SYSTEMS The three-dimensional Cartesian coordinate system provides an additional dimension for spatial measurement by means of a diagonal z- axis.

8 3D CARTESIAN COORDINATE SYSTEMS Vertex coordinates are written in the form (x, y, z), with xy-, xz-, and yz-planes dividing the coordinate space into eight areas.

9 3D CARTESIAN COORDINATE SYSTEMS Device independent coordinate systems function on the principle of translating between world and device or screen coordinates (the coordinate system used by the graphics display). Graphics systems are primarily based on either the left-handed or right-handed Cartesian coordinate system.

10 3D CARTESIAN COORDINATE SYSTEMS

11 THE SYNTHETIC-CAMERA MODEL The Synthetic-Camera Model is an optical imaging paradigm for three-dimensional computer graphics. This paradigm is based on the pinhole camera model where image formation is a simple process based on a film plane located at a distance, s, from an opening (the pinhole).

12 THE SYNTHETIC-CAMERA MODEL The synthetic camera model adds several principles to the pinhole camera model for the representation of artificial images.

13 THE SYNTHETIC-CAMERA MODEL The virtual image plane is also responsible for controlling the clipping of observed objects.

14 THE VIEWING SYSTEM The viewing system is a unified model for image visualization and consists of a view coordinate system and point of view. These two components establish the viewer’s position in terms of world coordinates. The coordinate system is specified with respect to this point of view.

15 THE VIEWING SYSTEM The point of view can either be the origin of the coordinate system, or the center of projection. The viewing system must also contain an image plane for the projection of scenes and a view frustum/volume for the specification of the field of view.

16 THE VIEWING SYSTEM

17 The View Volume – –a semi-infinite, truncated pyramid defined by an image plane window and a near and far clipping plane. Culling – –also known as back-face elimination, removes polygons hidden from the viewer. Clipping – –an optimization operation responsible for the display of only visible objects.

18 THE VIEWING SYSTEM

19 CHANGING COORDINATE SYSTEMS It’s often necessary to define geometry in terms of a coordinate system innately fitting the representation of a model. Such a coordinate system is referred to as the object or model frame (also known as model space) where vertices are defined relative to the modeling coordinate system’s origin.

20 CHANGING COORDINATE SYSTEMS This model frame must be converted to the world frame (all vertices are defined relative to a mutual origin) for proper model representation. Once we’ve converted the model frame to the world frame we still have no idea how these models would appear to the camera.

21 CHANGING COORDINATE SYSTEMS To accomplish this we need to change the coordinate system from the world frame to the camera or view frame with the viewer at the origin of the camera’s lens looking in the positive z-direction. This switch in coordinate systems is accomplished with the world and view matrices via the viewing transformation for Direct3D and the modelview matrix for OpenGL.

22 CHANGING COORDINATE SYSTEMS Viewing Transformation Modeling Transformation Projection Transformation Viewport Transformation

23 SPATIAL TRANSFORMATIONS Here Here we focus on three-dimensional transformations such as rotation, scaling, and translation. A transformation is an operation that moves a vertex or vector from one point in space to another. These transformations are denoted by a matrix with several matrices often combined for a custom transformation. Affine transformation is simply a term used to describe a sequence of linear transformations (rotation, scaling, etc.) followed by a translation operation. A linear transformation or linear map is a function that maps objects (vertices and vectors) from one vector space to another.

24 SPATIAL TRANSFORMATIONS Translation

25 SPATIAL TRANSFORMATIONS Rotation

26 SPATIAL TRANSFORMATIONS

27 Scaling

28 Examples Rendering a triangle without any transformations – –[see the textbook and source code “BasicTriangle (Direct3D)” on the book’s website for a detailed example].

29 Examples Rendering a triangle translated – –[see the textbook and source code “BasicTriangleTranslated (Direct3D)” on the book’s website for a detailed example].

30 Examples Rendering a triangle rotated – –[see the textbook and source code “BasicTriangleRotated (Direct3D)” on the book’s website for a detailed example].

31 Examples Rendering a scaled triangle – –[see the textbook and source code “BasicTriangleScaled (Direct3D)” on the book’s website for a detailed example].

32 Examples Working with OpenGL: Translation, Rotation and Scaling – –[see the textbook and source code “Translation, Rotation and Scaling (OpenGL)” on the book’s website for a detailed example].


Download ppt "CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA."

Similar presentations


Ads by Google