3D Viewing Strategy #1:

Viewer Outside Scene

It will be useful to imagine an "enclosing sphere" for our scene geometry; e.g., one which circumscribes the MC region of interest. The radius, r, of such a circumscribing sphere would be half the diagonal length of the MC region of interest.

Since we really just need a rough size estimate, a perfectly acceptable alternative to a circumscribing sphere is to set r = max(Δx/2, Δy/2, Δz/2), where the Δs are the corresponding "max - min" values of the MC region of interest.

We will simply use r below without worrying about how it was computed.

Here is an interactive tool for understanding view orientations and projections, as well as how they relate to one another: metaview: (If you have problems running this application, see the browser and platform-specific instructions on this page.)

  1. View Orientation: Specifying the MC→EC Transformation
    OUTPUT: eye, center, up measured in MC
    1. Compute center as the midpoint of the MC region of interest.
    2. Decide where the eye should be in relation to the center:
      1. Pick a distance, d, the eye should be from the center. A reasonable starting point might be α*r, where α is somewhere between 3 and 4.
      2. Pick a direction from the center to the eye:
        • Simplest approach is to pick a direction parallel to an MC axis; e.g., dir = (0, 0, 1), dir = (1, 0, 0), etc. This is most common if we are able to dynamically rotate, zoom, and pan the image.
        • Pick some off-axis direction: dir = normalize(dirx, diry, dirz). This is common if we are restricted to one static view of our 3D scene.
    3. Compute eye = center + d*dir. (Declare eye and center as instances of cryph::AffPoint; declare dir and (next) up as instances of cryph::AffVector.)
    4. Select the up direction (cannot be parallel to dir).

    The "primary line of sight" is defined as the direction from the eye point to the center point, and it will become the negative z-axis of the eye coordinate (EC) system.

    IMPORTANT OBSERVATION: Establishing the primary line of sight (and hence the eye coordinate z-axis) in this way means the z-axis passes through the center of the scene. The generation of the projection transformation described next relies on this assumption!

  2. View Projection: Specifying the EC→LDS Transformation
    OUTPUT: projection type, ecZpp, ecXmin, ecXmax, ecYmin, ecYmax, ecZmin, ecZmax, ecProjDir (all measured in EC)
    1. Select a projection type (orthogonal, oblique, or perspective)
    2. RECALL: At this stage, we no longer are working in MC; rather we are operating in EC. The units of MC and EC are the same (hence the value we computed for the radius of the enclosing sphere is still valid), but the MC and EC axes generally have different positions and orientations.

      The center of our circumscribing sphere as measured in EC is (0, 0, -d). WHY?

      Set ecXmin = ecYmin = -r; ecXmax = ecYmax = r, and make sure ecZmin and ecZmax are set so as to avoid unwanted depth clipping. For example, "ecZmin = -d - r" and "ecZmax = -d + r" are not unreasonable starting points. (WHY?) A reasonable value for ecZpp might be ecZmax. (WHY?)

      Finally:

      • If the projection is perspective, ecZmax must be negative. Hence be careful if d < radius.
      • You will probably want to set ecZmin to be considerably less than the "maximum minimum value" indicated above so that you don't get unwanted depth clipping during dynamic rotations. (Although if you make it a ridiculously large negative number, it may compromise the quality of hidden surface removal.)
      • The resulting ecXmin, ecXmax, ecYmin, and ecYmax values should be adjusted to match the viewport aspect ratio.