3D Viewing Strategy #2:

Viewer Inside Scene

If the viewer is inside the scene (e.g., you are inside a room that you have modeled, and you will only see that part of the room that is in front you), a slightly different scheme will be required.

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. Instead of placing the eye at some distance from the center in some direction as we did in strategy #1, simply place it precisely where you want it to be in the scene. Any place is OK as long as it is different from the center. And unless you want the view to correspond to a viewer lying flat on the ground, don't forget to put the eye 5 or 6 feet above the floor!
    3. Specify the up direction.

    The "primary line of sight" (the negative z-axis of the eye coordinate (EC) system) will still pass through the center of the scene as we observed in strategy #1. This is important because our generation of the projection transformation described next continues to rely 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 as in strategy #1. (It is difficult to imagine why you would want anything other than perspective in this case.)
    2. For the projection parameters, we don't want to use, for example, (ecXmin, ecYmin) = (-r, r) (where r = the radius of the circumscribing sphere) because that will give us an unrealistically wide field of view. In fact, we will not use the bounding sphere radius here at all.

      Look at the room in front of you and consider what you see and how you see it. For example, at the limits of our peripheral vision, images are somewhat defocused and lower resolution, due in part to the fact that only one of our eyes is viewing those extreme areas. No such peripheral defocusing is generated in images created by OpenGL, so the results are unrealistic and unsatisfactory if our field of view is too wide. Because the primary line of sight passes through the middle of the scene, we will still have symmetric limits – i.e., ecXmin = -ecXmax and ecYmin = -ecYmax – but the values need to be computed based on the amount of our field of view that is reasonably well-focused.

      As a guideline, humans see sharply (with both eyes) across an approximately 115 degree horizontal field of view. Basic trigonometry tells us that xmin = ecZpp*tan(δ), where δ is the field of view half-angle. For example, δ=57.5 for a 115 degree field of view. For the y direction, you can either let aspect ratio considerations take care of it by using a very small ecYmax, or you can make a similar assumption about a vertical field of view and use the aspect ratio matching method afterwards.

      For the z direction, recall that all of ecZmin, ecZmax, and ecZpp must be negative for perspective projections. But in our current situation, the eye is in the scene, hence you probably want ecZmax to be as close to 0.0 as reasonable. The actual value depends on the dimensions of your scene; but suppose the bounding sphere radius is 10, setting ecZMax to -0.05, for example, would probably not be unreasonable. Setting ecZmin is less problematic. Just make it a sufficiently small number that nothing will be clipped at that plane. (Although if you make it a ridiculously large negative number, it may compromise the quality of hidden surface removal.) Finally, setting ecZpp is pretty arbitrary (provided it is negative, of course). So select a value, then – since the xy limits of the field of view are defined on that plane – set them using the "tan(δ)" equation above.