Contact us Heritage collections Image license terms
HOME ACL ACD ICF SUS DCS G&A STARLINK Literature
Further reading □ OverviewContentsPrefaceNotation1. Introduction2. Structures3. Output primitives4. Attributes5. Networks6. 2D viewing7. 3D PHIGS8. Examples9. Input Classes10. Interaction11. Workstations12. Environment13. Further output14. Archives15. BindingsIndex
C&A INF CCD CISD Archives Contact us Heritage archives Image license terms

Search

   
ACDLiteratureBooksPHIGS
ACDLiteratureBooksPHIGS
ACL ACD C&A INF CCD CISD Archives
Further reading

OverviewContentsPrefaceNotation1. Introduction2. Structures3. Output primitives4. Attributes5. Networks6. 2D viewing7. 3D PHIGS8. Examples9. Input Classes10. Interaction11. Workstations12. Environment13. Further output14. Archives15. BindingsIndex

Chapter 8: Examples

8.1 PARALLEL PROJECTION EXAMPLES

8.1.1 Introduction

In this section, the facilities available to vary a view of an object are described. Parallel projections will be used in the examples. For most, the examples are equally applicable for perspective projections as well.

8.1.2 View orientation

In the simplest parallel projection, the projectors are perpendicular to the view plane and, therefore, parallel to the N-axis. This is obtained by having the projection reference point on the N-axis and the view window with its centre at the origin. For example:

      EVALVATE VIEW ORIENTATION MATRIX 3 
      (50, 50, 50, 0, 0, 1, 0, 1, 0, ER. VOM3) 
      WL(1)=-60 
      WL(2)=60 
      WL(3)=-40 
      WL(4)=40 
      PVL(1)=0 
      PVL(2)=1 
      PVL(3)=0.333 
      PVL(4)=1 
      PVL(5)=0 
      PVL(6)=1 
      EVALVATE VIEW MAPPING MATRIX 3 
       (WL, PVL, PARALLEL, 0, 0, 1000, -300, -900, 300, ER, VMM3)

The view orientation defines the view reference point in the centre of the object LEFT leaving the orientation of the axes the same. The view mapping keeps the projection reference point and planes well away from the object. The window is larger than the object and maps to the top of the NPC space keeping the aspect ratio the same.

      VCL(1)=0 
      VCL(2)=1 
      VCL(3)=0.333 
      VCL(4)=1 
      VCL(5)=0 
      VCL(6)=1 
      SET VIEW REPRESENTATION 3 
       (WS, 1, VOM3, VMM3, VCL, CLIP, CLIP, CLIP)

This will generate the picture in Figure 8.1, a head-on view.

Figure 8.1 : Head-on view of LEFT

As shown in Section 7.3, by changing the view orientation, an axis system for the VRC coordinates can be set up which is rotated relative to the directions of the world coordinate axes. By setting the view orientation to each of the principle axes of the object, three distinct views can be obtained. This technique is frequently used in CAD and architecture to view complex man-made objects such as buildings or mechanical parts.

The axes set up in Figure 7.6 would result in the picture shown in Figure 8.2. To get a good impression of a complex object, presentation of the object in real time with a continually changing orientation is a technique frequently used. A good example is drug design where it is necessary to examine the structure of complex molecules. The molecule is rotated in real time bringing the static picture to life. The way the orientation is changed will often be controlled by the operator. The best sequence of orientations to display will depend on the structure and shape of the object being viewed.

Figure 8.2: LEFT viewed from above

Figure 8.3: Rotated 0.2 7t about X and Y-axes

Rotating the UVN axes clockwise relative to the world axes by O.2π about both the X and Y-axes would give the picture in Figure 8.3. Note that rotating about the two axes ensures that all the faces of the letters are visible. Rotating by O.2π in the X and O.4π in the Y would give the picture in Figure 8.4. Rotating by O.2π in the X and O.7π in the Y would give the picture in Figure 8.5.

Figure 8.4: Rotating by O.21t in X and O.41t in Y

Figure 8.5: Rotating by O.21t in X and O.71t in Y

Orientating the view of an object from a variety of directions can give a much better idea of its overall form. It is possible in simple cases to achieve the same effect by a modelling transformation applied to the object on traversal. However, for complex objects made up of several posted structures this may not always be easy. Changing the view orientation is the natural way to obtain different views of an object.

8.1.3 Changing the window to viewport mapping

In Section 7.4, the definition of the window on the view plane and its mapping to the projection viewport were described. The example in the previous section mapped the window from -60 to 60 in the V-direction and -40 to 40 in the V-direction of VRC coordinate space on the view plane to the viewport from 0 to 1 in the X-direction and 0.333 to 1 in the Y-direction of NPC space. By preserving the aspect ratio in the mapping from window to viewport, the appearance in the two coordinate systems will be similar.

Making the window larger while retaining the same size of viewport will decrease the size of the object in the NPC picture. For example, changing the window to -90 to 90 in the U-direction and -60 to 60 in the V-direction will produce the picture in Figure 8.6 which is much smaller than the object in Figure 8.3.

Figure 8.6: Increasing window size makes picture smaller

The position of the object in NPC space can be changed by redefining the viewport. For example, changing the viewport to 0 to 1 in the X-direction and 0.233 to 0.9 in the Y-direction would give the picture in Figure 8.7. If the aspect ratio of the window and viewport are different, a non-uniform mapping will result. For example, if -90 to 90 in the U-direction and -40 to 40 in the V-direction is mapped onto 0 to 1 in the X-direction and 0.333 to 1 in the Y-direction, the resulting picture will be as in Figure 8.8. This can be a useful facility if the major requirement is to fill the space available and there is no obvious metric relation between the X and Y -directions.

Figure 8.7: Changing viewport can change position

Figure 8.8: Changing aspect ratio

Changing the window limits to -60 to 60 in the U-direction and -60 to 60 in the V-direction and mapping onto the same viewport will produce the picture in Figure 8.9.

As can be seen, changing the window to viewport mapping is useful for positioning the picture in the NPC space and defining its overall shape and size. Changing position can clearly be done by changing either the window or the viewport. It should be remembered that the window limits also define the direction of the projectors in a parallel projection. Consequently it is usual to make the positional changes by changing the viewport.

Figure 8.9: Changing aspect ratio

8.2 PARALLEL PROJECTION CATEGORIES

8.2.1 Introduction

Parallel projections can be sub-divided into a set of categories depending on the orientation of the viewing axis compared with the principal axes of the object and the position of the projection reference point relative to the N-axis. If the projection reference point is not on the N-axis, it is called an oblique projection, otherwise it is called an orthographic projection.

8.2.2 Orthographic projections

Attempting to represent a 3D object in a 2D drawing is a compromise between showing the general shape of the object and showing more precise information about some aspect of the object. Figure 8.1 is an example of an orthographic projection which has the N-axis coinciding with one of the major axes of the object. To get a good impression of an object, it is necessary to take 3 separate views with the N-axis coinciding with each of the 3 major axes of the object. Such projections give an exact view of one face of the object and little information of the other two.

The alternative type of orthographic projection is one where the N-axis is chosen so that 3 adjacent faces of an object are visible. Figure 8.3 is an example of such a projection called axonometric. Such a projection has parallel lines in the object equally foreshortened.

8.2.3 Oblique projections

Oblique projections are where the projection reference point is not on the N-axis. For example, if the program defining Figure 8.1 in Section 8.1.2 was changed as follows:

      EVALUATE VIEW MAPPING MATRIX 3 
      (WL, PVL, PARALLEL, 700, 500, 500, -300, -900, 100, ER, VMM3)

Figure 8.10: Oblique view

This would produce the view in Figure 8.10. This is a distorted view of the object. The front face of the object which is parallel to the view plane is not distorted while the planes in the other two principal directions are.

8.3 PERSPECTIVE PROJECTIONS

Perspective projections are typified by all projectors passing through the projection reference point (PRP). Five values determine the form of the perspective projection. These need to be chosen carefully to ensure the required emphasis is established in the resulting view:

  1. Orientation of object: the orientation of the object relative to the view plane;
  2. PRP height: the height of the PRP relative to the view reference point;
  3. Distance: the distance of the PRP from the view reference point;
  4. View plane position: the distance of the view plane from the view reference point;
  5. Displacement: the horizontal displacement of the PRP from the N-axis.

8.3.1 Orientation

Keeping the projection reference point on the N-axis, the view of the object is significantly different depending on whether the view plane is parallel to a face of the object (one-point perspective), parallel to an axis of the object but not a face (two-point perspective), or not parallel to any axis (three-point perspective).

To emphasize the perspective in the examples, the object to be viewed has been reduced to just the E and F and the Z-dimension increased from 47 to 53 to now being from 41 to 59. For example, the following program will produce the picture in Figure 8.11.

      EVALVATE VIEW ORIENTATION MATRIX 3 
       (50, 50, 50, 0, 0, 1, 0, 1, 0, ER, VOM3) 
      WL(1)=-80.
      WL(2)=130. 
      WL(3)=-90. 
      WL(4)=50.
      PVL(1)=0 
      PVL(2)=1 
      PVL(3)=0.333 
      PVL(4)=1 
      PVL(5)=0 
      PVL(6)=1 
      EVALVATE VIEW MAPPING MATRIX 3 
       (WL, PVL, PERSPECTIVE, 0, 0, 70, -70, -900, 50, ER, VMM3)
      VCL(1)=0 
      VCL(2)=1 
      VCL(3)=0.3333 
      VCL(4)=1 
      VCL(5)=0 
      VCL(6)=1 
      SET VIEW REPRESENTATION 3 
       (WS, 1, VOM3, VNN3, VCL, CLIP, CLIP, CLIP) 

Figure 8.11: Perspective projection

Note that the lines of the EF object in the Z-direction all meet in a single point while the lines of the object parallel to the X and Y-axes remain parallel (thus the name one-point perspective).

Figure 8.12: Two-point perspective

If the projection reference point and view plane are orientated by O.2π about the Y-axis of EF, the picture produced would be as in Figure 8.12. Here, lines of the object parallel to the Y-axis remain parallel while the lines parallel to the X and Z-axes meet in separate points (thus the name two-point perspective).

If the projection reference point and view plane are rotated from the original position by O.1π about the X -axis and 0.3π about the Y-axis of the object, the picture produced is as in Figure 8.13.

Figure 8.13: Three-point perspective

Here, each set of lines parallel to an axis of the object meets at a different point (thus the name three-point perspective). In general, this gives the most visual impression of 3-dimensions but sacrifices the ability to make measurements in any of the directions. All are foreshortened by the perspective view mapping.

8.3.2 Changing the projection reference point

By moving the projection reference point off the N-axis, a distorted view of the object can be obtained. For example, if the projection reference point is changed to (-40, 20, 70) so that it no longer lies on the N-axis, and the object is rotated by O.1π about the X and Y-axes, the picture generated is as in Figure 8.14.

One problem with perspective projections when the projection reference point is moved off the N-axis is that the projection of the object onto the view plane moves. Consequently, there is a continuing need to adjust the position of the window on the view plane. The application may need to build some tools on top of PHIGS if the aim is to keep the object being viewed in the centre of the display.

Figure 8.14: Projection reference point off N-axis

If the projection reference point is moved nearer to the object, the view of the object distorts, accentuating the perspective. Moving the projection reference point to (-20, 15, 50) produces the view in Figure 8.15.

Figure 8.15: Near projection reference point

The size of the object itself on the view plane depends on the position of the view plane. Bringing the view plane nearer the object decreases the size of the picture of the object. Moving the projection reference point away from the object also decreases the size of the picture of the object but the two effects are different.

8.4 MULTIPLE VIEWS

The PHIGS viewing system is sufficiently general to produce all the parallel and perspective projections in common use. The ability to define multiple views of an object and position them independently in the view plane by defining different projection viewports allows a composite image to be generated showing several different views of the same object. This type of display is frequently used in Computer-Aided Design to give a good overall view of the detail of an object.

For example, if the object LEFT is defined as a structure in four different orientations with different view indices set for each, by defining the projection viewport to be (0.1, 0.4, 0.35, 0.65) for the first, (0.1, 0.4, 0.65, 1.0) for the second and so on, four different positions on the view plane can be established for the views as shown in Figure 8.16.

Figure 8.16: Multiple views

The clipping rectangle for each of these views can be distinct from the projection viewport. The viewport is defined by the view mapping while the clipping is specified as part of the definition of the view itself.

For example, all four could have the clipping set to the volume with limits (0.2, 0.8, 0.4, 0.9, 0.0, 1.0) in which case the picture generated would be as in Figure 8.17.

Figure 8.17: Multiple views with the same clip volume

By defining the limits as (0.0, 1.0, 0.0, 1.0, 0.48, 0.52), clipping can be achieved in the Z-direction (see Figure 8.18). The values 0.48 and 0.52 depend on where the front and back plane are, as these map to 1.0 and 0.0 respectively. In the example, they were set to 300.0 and -300.0.

Figure 8.18: Clipping in the Z-direction

8.5 VIEW CULLING

So far, the complete object to be viewed has had the bounds of the VRC coordinate volume to be mapped to NPC coordinates sufficiently large that it includes the complete object. To remove part of the complete scene, clipping has been applied to the projected picture.

To limit the part of the scene that is projected, it is possible to define the front and back planes such that some part of the object is not in between them. In this case, only that part of the scene between the front and back planes is projected.

For example, if the object LEFT is enhanced by an additional letter F placed at the position 15 in the N-direction, and another letter L placed at position -30 in the N-direction, the overall scene would be as in Figure 8.19 assuming the front plane was at N=30, the view plane at N=10 and the back plane at N=-90 and the projection is parallel. Both additional letters are well within the area between the front and back planes.

Figure 8.19: Scene with letters at front and back

Now, if the front plane is moved to N=10, the front F will not be part of the scene projected as it is now in front of the front plane. This results in the picture in Figure 8.20.

This allows the computation of complex scenes to be limited to the current points of interest and removes from the computation irrelevant detail. How this is handled by the implementation will vary. The aim is to give the implementation the ability to optimize the viewing function while giving the application the ability to localize the computation to the areas of interest. It can also be used to ensure that parts of the scene of particular importance are not obscured.

Figure 8.20: Moving front plane nearer view plane

Figure 8.21 : Moving back plane nearer view plane

By moving the back plane to N=-15, the picture produced would be as in Figure 8.21. Both the front F and back L have been culled.

⇑ Top of page
© Chilton Computing and UKRI Science and Technology Facilities Council webmaster@chilton-computing.org.uk
Our thanks to UKRI Science and Technology Facilities Council for hosting this site