In my previous post I linked to an animation that a high school intern created using Inventor. A critical piece required to create the animation is the ability to control the camera within Inventor.
First, what is a camera within Inventor? You can consider Inventor cameras to be the equivalent of a real-world camera. If you’re holding a camera you can move to any location, point that camera in a certain direction, tilt the camera in any orientation, and take a picture. All of that is the same with an Inventor camera except it’s a virtual camera that only lives within an Inventor document. When you use Inventor interactively to zoom in/out, pan, and rotate the view you’re actually manipulating the camera and seeing the result of what the camera sees in the graphics view. The model always remains fixed in model space but as you rotate, pan, and zoom the view you’re just moving the camera around the model. The pictures below illustrate this. The picture on the left shows the model in model space and a camera. The picture on the right shows what the camera is seeing and what is displayed in the graphics window. By moving the camera around the model, the picture in the graphics window changes.
In the API, a View object represents a graphics window in the Inventor user-interface. The view can be sized, collapsed, maximized, and deleted. Additional views can also be created. The Camera API object is an API only concept that’s not directly seen in the user-interface since all of the user-interaction to manipulate the camera is done through the view. The camera controls what is displayed in the view.
There are two types of cameras; perspective and orthographic (parallel). I’ll begin by discussing perspective cameras because they’re easier to understand since they behave in much the same way as a real-world camera. In Inventor you can switch between an orthographic or perspective camera using the command in the View tab of the ribbon or the context menu of the view cube.
There are three basic properties that apply to all cameras (perspective and orthographic); eye point, target point, and up vector. The eye point is the position of the camera in model space. With just the eye point defined the camera is fixed at a specific location but can be pointed anywhere and rotated to any angle. The target point is the location in space that the camera is pointed. With the eye and target point defined the camera can still be rotated to get a landscape, portrait, or anything in between orientation. The up vector defines a direction in model space that defines the direction the top of camera is pointed. With these three properties defined the camera is fully positioned.
For a perspective camera the other property you can define is the perspective angle. A camera sees a certain area in front of it, which is referred to as its field of view. The field of view of a perspective camera is represented by a view pyramid and the angle of the pyramid that controls this field of view is called the perspective angle. Changing the perspective angle of a camera is the same as zooming with a real camera. By narrowing the field of view you see less of the model, effectively zooming in on a smaller area, as shown below where the perspective angle has been narrowed in the picture on the right.
With a perspective camera there’s also a second way to zoom in on the part. Just like with a real camera you can just move closer to the object, as illustrated below. As you zoom in and out in Inventor with a perspective camera, this is what Inventor is doing; moving the camera closer or further away from the model.
Another behavior of a perspective camera is objects that are further away from the camera appear smaller, just as they do in the real world. You can see why that is because something that is further away takes up less of the field of view, since the size of the field of view gets bigger the further away from the camera it is. Things closer fill more of the field of view and appear larger. In the picture below all of the boxes are the same physical size but because they’re different distances from the camera they appear as different sizes.
I said earlier that when you zoom in and out with a perspective view Inventor moves the eye point to position the camera closer or further away from the model. This is true but it’s also possible to leave the camera positioned at the same location and change the perspective angle. To do this, first make sure Inventor is using a perspective camera and then press and hold the Shift and Ctrl keys while rolling the mouse wheel (middle button). As the field of view narrows the view looks more like an orthographic view (the picture on the left) and as it widens you get more of a contrast between objects close and far away from the camera (the picture on the right).
Orthographic or parallel cameras don’t follow any of these natural behaviors that we’re used to. Instead of a view pyramid, parallel cameras have a rectangular box and the camera sees everything within the box. One of the effects of this is that everything appears the same size regardless of how close it is to the camera. This is because everything takes up the same area in the field of view regardless of how close it is to the camera. The second big difference is that moving the camera closer to the object doesn’t zoom in. This is illustrated below. The model still takes up the same amount of area in the field of view no matter how close the camera is to the object.
To zoom in with a parallel camera the size of the viewing box is changed, reducing the field of view.
In the next post we’ll start looking at how to use the API to control the camera.
See the next post in this series.
-Brian