www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

UNIT - 6

Viewing

§  Relationship between classical viewing techniques and computer viewing.

§  Approach has three parts:

1.  What types/modes of views can be created and why more than one type of view is needed?

2.  How an application viewer can create a particular view within OpenGL?

Two parts of viewing process:

1.  Use of model-view matrix to switch from the world frame in which the objects are define to their representation in a frame in which the camera is at the origin. This representation of the geometry will allow the use of canonical viewing procedures.

2.  Selection of type of projection (parallel or perspective), and specifying the part of the world to be imaged (the clipping or view volume). These specifications form a projection matrix that is concatenated with the model-view matrix. An example program is used to demonstrate how the OpenGL API handles viewing.

3.  The projection matrices describing the most important parallel and perspective views are derived.

Classical and Computer Viewing

Reasons for examining classical viewing:

1.  Many of the jobs that were formerly done by hand drawing-such as animation in movies, architectural rendering, drafting, and mechanical-parts design-are now done routinely with the aid of computer graphics. Practitioners of these fields need to be able to produce classical views-such as isometrics, elevations, and various perspectives-and thus must be able to use the computer system to produce such renderings.

2.  The relationships between classical and computer viewing show many advantages of, and a few difficulties with, the approach used by most APIs. .

Similarities between classical and computer viewing: Similarities can be specified with the synthetic-camera model.

ü  Basic elements in both cases are the same: Objects, a viewer, projectors, and a projection plane.

ü  The projectors meet at the center of projection (COP).

ü  The COP corresponds to the center of the lens in the camera or in the eye, and, in computer-graphics systems, is the origin of the camera frame.

ü  The projection surface is a plane, and the projectors are straight lines.

ü  Both classical and computer graphics allow the viewer to be an infinite distance from the objects. As the COP is moved to infinity, the projectors become parallel and the COP can be replaced by a direction of projection, (DOP).

ü  As the COP moves to infinity, the size of the image remains about the same, even though the viewer is infinitely far from the objects.

ü  Views with a finite COP are called perspective views; views with a COP at infinity are called parallel views.

ü  The class of projections produced by these systems is known as planar geometric projections, because the projection surface is a plane, and the projectors are lines. Both perspective and parallel projections preserve lines; they do not, in general, preserve angles.

ü  Although the parallel views are the limiting case of perspective viewing, both classical and computer viewing usually treat them as separate cases. For classical views, the technique used to construct parallel is different from the perspective view. Similarly, from the computer perspective, specifying parallel view is different from specifying the perspective view. In addition, parallel views are considerably easier to implement, if, rather than considering them as the limit of the perspective view, the limiting equations are derived and used those equations directly.

Differences between classical and computer viewing:

1.  Computer graphics systems have two fundamental types of viewing (parallel and perspective). Classical graphics appears to permit a host of different views, ranging from multi-view orthographic (parallel) projections to one, two, and three-point perspectives.

2.  Wide range of views in classical viewing is due to different relationships among an object, the viewer, and the projection plane but in computer graphics/viewing, all specifications are completely independent and hence types of views are limited to two.

Classical Viewing

§  Classical view is determined by a specific relationship between the objects and the viewer. It uses notion of a principal face.

Principle face: Each planar face of real-world objects viewed is called principle face. E.g. For a rectangular object, such as a building, there are natural notions of the front, back, top, bottom, right, and left faces.

§  In addition, many real-world objects have faces that meet at right angles; thus such objects often have three orthogonal directions associated with them.

§  Two types of classical views are

1.  Parallel

2.  Perspective

Both types can be further classified depending on level of some restrictions.

1.  Orthographic (Parallel)(Orthogonal) Projections

§  Projectors are perpendicular to the projection plane.

§  In orthographic projection, an object can be drawn with multi-views say at least front view, top view, and right view, - to visualize what an object looks like.

§  In every view, the projection plane is parallel to one of the principal faces of the object. Object can be displayed at least in three views -such as the.

§  Visualization from these images with different views can take skill on the part of the viewer.

§  This view preserves (means no distortion) both distances and angles (shapes). Hence multi-view orthographic projections are well suited for working drawings.

Types of Orthographic projections:

Axonometric Projections

§  By removing one of the restrictions of orthographic projection, more principal faces of an object can be seen in a single view.

§  Ability to see more than one principal face makes axonometric projections preserve only parallel lines but not angles in the image. This causes a distortion in the image. E.g. A circle is projected into an ellipse.

§  Axonometric views are used extensively in architectural and mechanical design.

§  In axonometric views, the projectors are still orthogonal to the projection plane. But the projection plane can have any orientation with respect to the object.

Types of axonometric projections:

1.  Isometric: Projection plane is placed symmetrically with respect to the three principal faces that meet at a corner of the rectangular object. In this view, a line segment's length in the image space is shorter than its length measured in the object space. This foreshortening of distances is the same in the three principal directions, so distances can still be measurements.

2.  Dimetric: Projection plane is placed symmetrically with respect to two of the principal faces. In this view, there are two different foreshortening ratios.

3.  Trimetric: It is the most generally used view. In this view, there are three different foreshortening ratios.

Oblique Projections

§  The oblique views are the most general parallel views. Projectors can make an arbitrary angle with the projection plane.

§  Angles in planes parallel to the projection plane are preserved. A circle in a plane parallel to the projection plane is projected into a circle, yet more than one principal face of the object can be seen.

§  Oblique views are the most difficult to construct by hand. They are also somewhat unnatural.

2.  Perspective Viewing

§  All perspective views are characterized by diminution of size. When objects are moved farther from the viewer, their images become smaller. This size change gives perspective views their natural appearance; however, because the amount by which a line is foreshortened depends on how far the line is from the viewer, measurements can’t be done from a perspective view.

§  Hence, the major use of perspective views is in applications such as architecture and animation, where it is important to achieve real-looking images.

§  Viewer is located symmetrically with respect to the projection plane, as shown below.

Thus, the pyramid determined by the window in the projection plane and the center of projection is a symmetric or right pyramid. This symmetry is caused by the fixed relationship between the back and lens of the eye for human viewing, or between the back and lens of a camera for standard cameras, and by similar fixed relationships in most physical situations. Some cameras, such as the bellows camera, have movable film backs and can produce general perspective views. The model used in computer graphics includes this general case.

Three types of perspective projections: The differences among the three cases are based on how many of the three principal directions in the object are parallel to the projection plane.

Consider the three perspective projections of the building shown below.

3-point 2-point 1-point

Three-point perspective: Any corner of the building includes the three principal directions. In the most general case-the three-point perspective-parallel lines in all three principal directions converge at three vanishing points (figure a).

Two-point perspective: If one of the principal directions is allowed to become parallel to the projection plane, it is two-point projection (figure b), in which lines in only two of the principal directions converge.

One-point perspective: In this, two of the principal directions are parallel to the projection plane, and there is single vanishing point.

These three situations are merely special cases of general perspective viewing.

Positioning of the Camera:

In OpenGL, the model-view and projection matrices are concatenated together to form the matrix that applies to geometric entities such as vertices.

Model-view matrix can be used

1.  to position objects in space.

2.  to convert from the reference frame used for modeling to the frame of the camera.

Positioning of the Camera frame

Vertices can be specified in any units. To reposition these vertices a model-view matrix can be defined by a sequence of affine transformations. This operation can also be viewed as “the model view matrix gives the locations of the vertices in a different frame.

In other words, objects are defined in a reference frame, and the modeling part of the model-view matrix converts from the modeling frame to the world/ user frame.

Objects can be modeled independently from the viewing or the location of the camera. OpenGL places a camera at the origin of the world frame pointing in the negative z direction.

Hence, if the model-view matrix is an identity matrix, then the camera frame and the world frame are identical.

In most applications, objects are modeled being located around the origin, so a camera located at the default position with the default orientation does not see all the objects in the scene. Thus, either the camera must be moved away from the objects or the objects must be moved in front of the camera. These are equivalent operations, as either can be looked at as positioning the frame of the camera with respect to the frame of the objects.

Any vertex defined after the change of model-view matrix (through some transformations) will be having the camera frame unchanged where as the object frame changed. Hence great care must be taken regarding - where in the program the primitives are specified relative to changes in the model-view matrix. At any given time, the state of the model-view matrix encapsulates the relation between the camera frame and the world frame.

Combining modeling and viewing transformations into a single model-matrix regards the camera as an object with geometric properties. Hence the transformations applicable to the objects can also be used to affect the position and orientation of the camera relative to these objects.

Three approaches to Camera positioning to have different views: There are three approaches to move the default camera relative to the world frame: Any of these approaches can be used to obtain different types of views, depending on the API.

I.  Using a sequence of rotations and translations to the model-view matrix to specify the camera position (can be adopted in OpenGL with transformations): This approach is a direct application of the instance transformation. Depending on the type of view needed, this approach requires computation of individual angles for the construction of the model-view matrix. While using this approach care must be taken for two reasons.

1.  Usually camera is defined before positioning any objects in the scene.

2.  Transformations on the camera may appear to be backward from what one might expect.

E.g.1. Consider an object centered at the origin. The camera is in its initial position, also at the origin, pointing down the negative z axis. Suppose the image of the faces of the object that point in the positive x direction is needed.

Steps needed are:

1.  Camera must be moved away from the origin/object. If the camera is allowed to remain pointing in the negative z direction, then camera must be moved backward along the positive z axis, and the proper transformation is glTrans1atef(0.0, 0.0, -d); where d is a positive number.

It can be interpreted as moving the camera frame relative to the world frame.

[ This point of view has a basis in classical viewing. In computer graphics, objects are considered positioned in a fixed frame and it is the viewer who must move to the right position to achieve the desired view. In classical viewing, the viewer dominates. Conceptually, viewing is done by picking up the object, orienting it as desired, and bringing it to the desired location. One consequence of the classical approach is that distances are measured from the viewer to the object, rather than-as in most physically based systems-from the object to the viewer. Classical viewing thus results in a left-handed camera frame. Many graphics systems, including OpenGL, follow this view by having modeling in right-handed coordinates and viewing in left-handed coordinates-a decision that, although technically correct, can cause confusion among users. In OpenGL, clipping distances - such as in Ortho - are measured from the camera, a choice equivalent to using a left-handed camera frame.]

2.  To see the object from the positive x axis, the camera must be rotated about the y axis, after the camera is moved away from the object in step1. Translation must be done after rotating the camera by 90 degrees about the y axis. In the program, the calls must be in the reverse order as follows:

glMatrixMode(GL_MODELVIEW);