3-D Viewport


Last updated 06-Jan-2009

This treatise describes how a "close-to-ideal" dynamic viewport of a 3D-modelling software works. The focus is on the "mechanical" behaviour of the viewport.

What is presented here, is based on several years of experience on using a few high-end professional 3D-software (and some not so high end ;) ) and finding some things more handy, intuititive or robust to use than some others. Most of these ideas already exist somewhere, but some of them are development steps, that I'd find logical to take in future.


1 Viewport

1.1 On screen

What we call a viewport, is usually undertood as a window on your computer screen. A window to the virtual world, where you work on your three dimensional model. A viewport shares many same functions with for example the "cameras" used on game software but sometimes it can also act like a drawing board of an artist. However, to define a viewport for modelling, it's better to push the ideas of a cameras and drawingboards aside and start from scratch.

1.2 Inside

Things start to get more interesting, when we have a look at the vieport in relation to the modelling space. A viewport should be thought of as a transparent tray, that is used used to navigate in the modelling space. The viewport always moves to, where the user is working.


Viewport is like a transparent tray in the modelling space

A viewport is defined around a viewport origin. Viewport origing is a user defined point somewhere in the modelling space. Usually the definition happens as a "by product" of view manipulation so, that the user is not necessarily concious about the definition.

All the view manipulation actions happen in some relation to the viewport origin. To be able to work furter more definitions are needed. The viewing point is the point, where your "eye" is calculated to be in the modelling space. The viewing point is sometimes referred to as "camera", though I'd like to reserve the word camera to be used only in the context of a rendering camera.

Viewport definitions

The viewport axis is the line or the vector from the viewport origin to the viewing point. The viewport plane is coincident with the viewpot origin an is normal to the viewport axis. You could think that the image you see on the computer screen is projected onto the the viewport plane, which is then sent to the computer screen.

Sometimes we may talk about the view cone, that presents the limits of the part of the modelling space, that is projected for the user. The view cone of course extends to infinity, but the presentation above seems easier to handle.

2 Basic Functions

2.1 Parallel and Perspective modes

2.1.1 The Modes

A viewport provides two basic presentation modes: Parallel and perspective. In parallel mode you could think, that the viewing point is at infinity along the viewport axis. The viewport becomes a tube with parallel walls, that cuts through the modelling space. In parallel mode the model dimensions appear always in the same proportions. However sometimes the parallel mode seems unnatural as we usually see thing with a perspective in the real world.

The perspective mode means, that the viewing point is somewhere relatively close to the viewport origin. The distance is defined by the view angle. Typically that is the vertical angle of the view cone.

Viewport modes and view angle

So, basically the parallel to perspective switch and the angle adjust, all result the viewing point distance from the viewpoint origin to change so, that the on-screen size of the objects that are on the viewport plane does not change.

2.1.2 Settings

It might be tempting to have the mode and angle settings happen by a simple slider, but in practice this approach would not be very usable. As a user you'd more likely want to switch between your favorite settings fast and with precision. What I recommend, would be a toggle between parallel and perspective, and a easy-to-use angle setting.

Here the use case is that usually I like to use a relatively narrow viewing angle -- around 10° for modelling. That helps to see the 3D-form of the model better than plain parallel mode. A larger angle (maybe 30° to 45°) is useful if you need to work inside a model and the viewing point needs to be close to your working area.

Alternatively there could be a three-way toggle for parallel, perspective_narrow and perspective_wide. Though, the narrow - wide switch is propaply obsolete to most users. It's more usefulto have the angle setting easily available. The setting will be used more as the using does not include browsing throug a complex pile of menus.

2.2 Panning and rotating

As the viewport origin defines the movements of the viewport, panning and rotating the viewport become very understansdandable. When you use your mouse to pan the view (= move left right up or down) you simply grab the world by the mouse cursor and move the world along the viewport plane. -- In reality it's the viewport that moves to the opposide direction.

Pan and rotate

To rotate the view, you again turn the world as if there was a large sphere attached into the center of the viewport. Now the viewport is turning around it's own origin. This rule natuarlly applies to tilting the viewport as well.

2.3 Zoom

In the basic use the zoom only changes the size of the viewport. That natuarlly changes the distance of the viewing point accordinly. Remember that in this case the viewport origin is starionary. This way the user does not loose the viewport's focus to the work, when rotating the view next time.

Zoom center is the viewport origin

This is the best and most natural way of the viewport to work that I have found, though as the world is not prefect, this approach has it's downside, which I call "blocked zoom". I'll describe the problem on the "Know Issues" section.

2.4 Centering the Viewport

2.4.1 User Actions

The centering command is really the heart of a dynamic viewport. Centering could also be called focusing. Centering the wiewport simply means moving the viewport origin to a new location, defined by the user. -- It is easier than it sounds: The centering command is frequently used and therefore it is placed somewhere that it's easy to access.

Possible implementations:

  • Center click (by mouse)
  • Right click
  • Two-button click (eg. hold the right mouse button down, point the place and click with left**)
  • The first menu item

  • The sequence of using the command is typically, that you point something on the scene and hit the command. Additonally or alternatively there are possibilities to center the viewport to a selection, the entire model or the coordinate origin.

    ** This should be in line to the panning function: If you pan with the right button, you start centering with the right button

    2.4.2 Viewport Behaviour

    In parallel mode the actual functionality of the centering command is easy: The viewport moves to the new location. However there are issues to consider about the perspective mode. In perspective mode it would be confusing to have the viewport jump to a new location as it is, especially if the new location is very far from the current one. Instead there are implementations that are be more comfortable to use.

    My definite favorite is this:

  • The viewing point stays where it is.
  • The viewpoint origing moves to the new location.
  • The viewport does not tilt during this operation.
  • The rest of the viewport is redefined by the above.

  • Centering/focusing the viewport to a new target

    Why so? The use case that I'm thinking is, that you are working on a small object close to your viewing point. Then you decide, that you need to go working on something big relatively far away from you current position. You definitely do not want a closeup of the new location and you'd probably want to keep track of your orientation and the feel of location in your working space. The method above provides all that.

    You may notice, that from the mathematical point of view the definition in perspective mode actually applies to parallel mode as well. In the parallel mode the viewing point just is very far, though in the programming the zero angle and the infinity distance probably need to be handled as a separate case.

    2.5 Adding Objects "Free Hand"

    In the introduction I mentioned, that a viewport has functions of a drawingboard. Those comes to effect, when you have defined your viewport plane somewhere else than the model origin. Added curves and other manually (by mouse) added objects will be located to the modelling space by the viewport plane, unless you have a method and a reason to place them into a different depth in the space.

    This has a great meaning, when you are working on the edge of a large scene or a large model. You don't need to go collecting your new pieces from he zero-coordinate planes afterwards.

    2.6 Viewport Commands

    I decided to list here the commands that are used to navigate the basic viewport.
  • Pan (or Move along the viewport plane)
  • Rotate (around viewport origin)
  • Tilt (around viewport axis)
  • Select viewing direction (Front, Back..... As defined by Rotate and Tilt)
  • Center (to pointed object, surface or point)
  • Center to selection
  • Center to scene
  • Center to origin
  • Zoom in/out
  • Zoom to selection (also centers)
  • Zoom to scene (also centers)
  • Toggle mode (parallel, perspective)
  • Set viewing angle (for perspective mode)
  • The ones marked with bold font are built-in in the userinterface. The rest of them probably need to become menu items. I strongly recommend that all the viewport commans are collected under a "View" menu. They are frequently used and easy acces to them is crucial to the usability. Also, in addition to the list above, there are quite a few viewport properties, that would have their settings under the view menu, like color- and lighting settings for the modelling space.

    2.7 Known Issues

    2.7.1 Blocked Zoom

    In a "blocked zoom" situation your viewing point is stuck behind the object, that you last were working on. Typically you come across this situation when you are using the viewport in perspective mode.You'll notice, that also panning is blocked and only rotate and tilt are working.

    This happens, when you have the viewpoint origin on an object and you try to zoom through the viewport plane to a new location. As you keep trying to zoom in, the viewport just becomes smaller and your attempts to zoom and pan get less and less effective. Eventually the viewport dimesions are reduced to zero and then you can not even zoom back.

    To release the block you just need to center/focus the viewport to a new location. Some software also seem to recognize a zoom block and release it after a few vain attempts to use the zoom. I'll try to cast some more light into this issue in the "Assisted Functions" section.

    2.7.2 Arbitrary Center of Rotation

    The definition above assumes, that the viewport is always rotated around it's origin. However many 3D-applications produce situations, where the center of rotation does not follow the viewport origin. There may be various reasons to this, but generally speaking this is a situation, that should be avoided like plague. Eventually the center of rotation drifts away from the user's view and the rotating functions start to behave in a most inpredictable manner -- the part of the model, that you wish to work on, disappears from the view for a minor turn and so on...

    If it becomes inavoidable in the programming, that the center of rotaton is separated from tne viewport origin, then some "intelligence" should be added to the programming, so that the preferred behaviour is resumed as a result of normal view manipulation. Some suggestions, that might help may be found in the "Assisted Functions".


    3 Aligning to Main Orientations

    3.1 The Align Function

    Usually a 3D software provides a standard set of named, predefined viewing directions; Front, Back, Right, Left, Top, Bottom. Instead of the traditional approach a method that supports the work-flow better would be a function that I'd call "Align to the Closest Main Orientation".

    How does it vork then? Simply it calculates, which is the closest 1/4 of circle for each of the x-, y-, z-rotations and turns the viewport to that orientation. To clear any doubts, this also covers the tilt angle around the viewport axis, so if I have a reason to view the model on it side or up side down that happens by a key-click. (And believe me, 3D-modellers just love the lack of gravity in their modelling space.)

    For the alignment fuction to work, no predefined names/numbers for the possible orientations are required. However, this does not make the standars viewing directions completely obsolete and for the user's comfort, if the standard viewing directions are already defined, it would be nice if the named orientations would be recognized and displayed if such a filed or an icon is available on the userinterface.

    3.2 Browsing Between Alignments

    Naturally the user wishes to browse between the alignments. The best tool for navigation through alignments would be a 9-way navigation key, but as those do not widely exist (Well, I have seen an 8-way key on a Tektronix-keyboard instead of the more commonly used arrow-keys) Therefore I'd recommend the browsing to be assigned to the numberpad keys. I assume the number 1,2 and 3 are on the lower row:
  • Center-key (5): Align to closest
  • "Arrow" keys (4,6,2,8): Switch to the next alignment in that direction
  • Low left key (1): Tilt left
  • Low right key (3): Tilt right
  • 7 and 9 could the be assigned for other purposes or used as doubles for 1 and 3

  • If the numberpad is already taken, the Home-, Arrow-, PgUp- and PgDn-keys could be used instead. These would also be a better choise for a lap-top computer, that does not have a separate number-pad.

    Also, it should be noted that, the rotate and tilt functions are accessable directly, without first having to use the Align to closest-function. The function of each key should simply be "Align to the Closest Main Orientation in that Direction".

    For the alignment and the browsing animated transition instead of a "snap" would be highly appreciated. The duration of the turn should be relatively fast though. About 0.25 - 0.50 seconds does not seem to slow the work down, but the visualization allows you to follow, what is happening on the screen.

    One more issue to avoid misusnderstandings: The align functions should work in the inverted way in comparison to rotating the view by mouse or a 3D-navigator device. Whereas by mouse you think, that you rotate your model, the arrow-kwys should rotate the viewport. So eg. if your viewing direction is "Front" and you press "Arrow Up" then the viewing direction is changed to "Top".


    4 Assisted Functions

    4.1 Center to Selection

    At first it seems like a self evident thought, that the viewport should be focused, where you work, but as you start to design the function to the viewport there will be questions, that need to be answered first. Questions like, "Should the viewport be automatically centered to your selected element?" A short answer would be "no". The viewport becomes very restless, if it moves everytime you select a new object or element in the modelling space. However the first step of intelligence can be built upon this idea.

    The center of the active selecton should be defined the "pending point of focus". Then, when you start to navigate your viewport, the viewport gradually centers it to the pending point of focus. The viewport actions that could contain the assisted centering are Zoom In, Rotate and Tilt. Zoomin by 50% in or turning the view 90° should result centering.

    The sequence of Centering actually consist of three steps:

    1) Defining the pending point of focus

    2) Moving the viewport plane to match the depth where the new poitn is located.

    3) Moving the viewport towards the point of focus as defined by the current fraction of zoom to turn.

    It seems, that to get this operation performed correctly, another step needs to be added between 1 and 2: To record the viewport location, size and orientation in the beginning of the operation.

    The question still remanis, how the viewport should behave in the case of zoom in. As this is a centering operation it probably should not just move along the viewport-plane, but at least to some extent, turn around the viewing point as described in the Basic Functions, Centering.

    4.2 Follow Selection

    A natural furter step of development follows the assisted centering. As it can not be recommended, that the viewport would be centered to every new selection, why not meet somewhere in the middle? The viewport could start to follow the selection as the newly selected elements are too close to the edge of the viewport (view cone). This function would enable the user to keep adding elements to the selection on a large, but detailed work, without havin to manually move the viewport.

    The the basic functionality is simply, that when the newly picked element is outside a predefined center area of te viewport, the viewport responds by moving into that direction only so much, that the recently picked element is right on the border of the center area. The center area could be defined as about 65%-80% of the width and height. -- Whether the center area should be a rectangle or something else, is another discussion, but I'd start with something "rectangleish".

    As this function obviously is related to the centering function, it also might be worth of consideration if the viewport should again turn around the viewing point rather than just travel linearly. My recommendation, that is a kind of a combination of those both would be:

  • Calulate the the new axis direction so that the latest selection is just inside the centerarea
  • Calculate the movement in viewport axis direction (after the turn) as the same fraction of the total difference in depth as the turn was in relation to the width and/or height of the view cone.
  • Double check the turn and correct if needed.
  • Perform the move.
  • This behaviour shoud turn out to be quite robust, if the view angle is relatively narrow, as I would anticipate in modelling use. The purpose is that the viewport moves like car being parked, without changing it's size or view angle. This behaivour would not mess up the users zoom settings as the use of zoom or centering commands could in the case that the selected objects are on very different distances in "viewpot depth" direction. Also the viewport origin would in most cases find a seemingly logical new "average" location in the space.

    Animated transitions are pretty much obligatory in this case. A jumpy view would easily be very disturbing to the user.

    Below is embedded a video that illustrates the function in action.

    Follow Selection in action

    The transition time in the video is set to 0.4 seconds with accelerated/decelerated action. -- In robot kinematics that was known as parabolic smoothing. The center area (that btw. should not be displayed to the user as it is on the demo) in there is defined as 2/3 of the screen in x-direction and 3/4 in y-.

    4.3 Release Blocked Zoom

    The blocked zoom situation was described above. The logic to automatically release the block may be a tricky thing to generate, but it could very well be worth the trouble. Some of the obvious triggers for the logic would be:
  • The viewport has become awfully small (But how small?)
  • There is nothing on the viewport plane to zoom to
  • The user still keeps zooming....
  • Not to forget the complexity of the problem, the user may as well be trying to travel through a hole of an object that the viewport was centered to just a moment ago. Though this situation may be tricky to recognize, the information already is there: It is projected on the screen. So again there should be a predefined center area -- probably an oval or ellipse this time -- and when there is nothing to zoom to on this area, the logic picks a new object, that appears in the center of the viewport to be the new point of focus.

    Now the only problem left is, that the user might be zooming towards "nothig". In that cas the simplest solution would be to let the viewportplane move forward instead of scaling it. It should also be possible enlarge the "scanning angle" and measure the distance to the first object that is found to be the new lenght of the viewport axis. Or if that turns out to be impossible and no other obvious plan comes up, notify the user to take appropriate actions to reset the viewport size.

    There of course are cases, where no logic really applies. How about if the user goes zooming in empty space? It's of course possible to use some kind of defaults to to take over in the the extreme cases, but generally speaking I would not worry about surviving intentional abuse as long as it does not damage the model file.


    5 Rendering Cameras

    A rendering camera can in some ways be defined an extensiont to the editing viewport, but it relies more on the viewing point where the camera is located. As the user is used to handling the viewport its is only natural that finding desired camera locations happens by navigationg the the camera just as an editing viewport.

    There are, however, some details in the behaviour of a camera, that make it different from a viewport. First, the view angle setting does not move the camera, but just changes the perspective angle of the camera. Also the user can turn the a camera around itself, where the viewport can only be turned around the viewport origin.

    If the software provides a "physical" presentation of a camera (i.e. the camera is treated as an object in the modelling space) activating the camera specific behaviour is easy. Just select the camera or launch it for editing it's properties. If the software does not present cameras in the space, the job gets a bit trickier and the camera settings are found somewhere in the view menu. Which approach is taken, depends on the purpose of the software. Both are used.


    6 Using 3D-Navigators

    I'm not going to go too deep into the possibilities, that 3D navigators provide. There are plenty of different modes and functions available, but I'll just focus on some issues on the very basic use case.

    Generally speaking the normal navigation of the viewport should follow the same rules as the navigation without a 3D-device. Center the wiewport, rotate always around the viewport origin etc... To avoid blocking the zoom I'd recommend a logic that, when there is nothing to zoom to, the viewport is not getting any smaller by zooming in, but rather just starts to move forward.

    Anyhow, according to my own experiences, you are less likely to run into a zoom block by using a 3D-device than you would be when zooming by mouse. I'm not sure if that is due to smart UI-design or just, that the dynamic viewmanipulation keeps you better aware of the behaviour of the viewport than navigating by mouse does.


    7 Conclusion

    Above I have concetrated on the most basic functionalities of a 3D-viewport and to some possible implementations. There are still several issues, that have not been discussed above, like the use of colours and illumination on the modelling viewport, different visualization modes and so on.

    What I wish the readers to make note of, is that the user wants to keep the viewport focused on the thing that is under the work. Change of focus should be easy, but strictly under the user's control. Users tend to do stupid things, but as a user I'm willing to learn my lessons in exchange of control over my working.

    Also the 3D-navigation tools, that are nowadays available and affordable to an increasing number of users, provide many new possibilities. Being able to work with both hands however, seems to raise up several issues, that did not exist while working just with a mouse. To start with, a left handed user would most likely prefer to use the tools with a somewhat different set of functions than an right-handed one. And there is more to come: There are already available some devices (finger pads ...) that are capable of gesture recognition. Currently the industry is already discussing optical gesture recognition, which should eventually enable working in 3D just with your bare hands!

    Still, what ever the development will be in the future, the basic definitions of the viewport will always be the key to building a successful 3D-editing software. The approach certainly is different from 2D applications and equally different from entertainment use. I'm hoping that this story on it's part will help future software developers to understand the a modellers point of view on the matter.



    -Petri-


    Contact Information
    Created, 01-Jan-2009
    Published, 03-Jan-2009
    Updated, 04-Jan-2009