Camera Viewing Program File
by Jim Ross, SDRC

The question often arises: "Can I make a picture of something in I-DEAS as it would appear in the real world?" There are two elements to answering this question. The first is the level of shaded image rendering that I-DEAS is or is not capable of achieving. Viewing is an important matter to answering the above highlighted question as well. Consider the question asked this way: "We've designed the passenger compartment of a automobile and would like to see how much the steering wheel might obstruct the instruments in the dashboard. Can I make a picture in I-DEAS which will show what the driver would see in the real world?" You can see that in this case viewing is everything; the shaded image aspect of the question is less important.

The answer to the above highlighted question is a qualified "yes". The qualification comes from the understanding that human vision is stereoscopic with a high level of visual acuity along the axis of vision, with a gradually decreasing visual acuity away from that axis. This kind of "like we see in the real world" is not possible. However, if the question could be restated: "Can I make a picture of something in I-DEAS like it would appear if a camera took a picture of it in the real world?", then we can say, from a viewing perspective, "Yes, that can be done in I-DEAS". Suffice it to say that in order to do this, some understanding of photography is required. Without that, the analog of making I-DEAS "act like a camera" is lost and doing things "camera-like" will have no meaning.

The analog chosen for this program file is based on the 35 mm camera. In that case, a normal lens is a 50 mm lens. "Normal" means that if the user were looking at something and then put the viewfinder of the camera to his/her eye, what he/she would see through the viewfinder would look the same as what he/she would see with the naked eye, except for the framing caused by the viewfinder. A telephoto lens is one in which the world as seen through the viewfinder would appear closer than it really is and a wide angle lens is one in which the world as seen through the viewfinder would look farther away than it really is. To pursue the example above, if you were to get behind the wheel of the car and look at the dashboard of the car through the viewfinder of a 35 mm camera, the normal 50 mm lens would not show enough of the dashboard. A wide angle lens would have to be used to really check the visibility of the dashboard. One more thing: seeing things "like in the real world" requires perspective viewing. The mathematics of perspective viewing are identical to the theoretical mathematics of an ideal cameras lens.

The purpose here is to document a program file that I have written to automate the process of trying to simulate a camera. It is a rather difficult thing to do interactively because of the way that I-DEAS handles viewing parameters with respect to its commands to change views. A fair amount of mathematics is involved in doing something as simple as "panning the camera" or "changing the lens on the camera". This program file automates all that.

The program file was designed and debugged using the I-DEAS Design application set, however, it should mostly work in any part of ideas where viewing and shading are possible. If you run the program file, you will be presented with a menu identifying what can be accomplished with the program file. The menu is as follows:

Filmplane Viewport Layout

Position Camera

Rotate Camera
Translate Camera
Change Camera Lens
List Current Lens

Store Current View

Set Display Mode

Exit Program File

Pause to Change Something

Display
Filmplane Viewport Layout
In the 35 mm photography analog, to really duplicate the 35 mm photograph, the film plane must have a two-thirds aspect ratio, because the 35 mm film is 24 mm by 36 mm. The purpose of this menu pick is to create a graphics viewport that has a two-thirds aspect ratio. This may not appear to be correct when you actually use it because a pixel, with today's local controls on the monitor, may not be a "square", i.e., the aspect ratio of a pixel may not be one to one. This is probably the least important function of the program file, but if the user were to desire to recreate the whole 35 mm photographic experience, the viewport must have a two-thirds aspect ratio.
 
Filmplane Viewport Layout
Viewport layout with 2/3 aspect ratio in horizontal format. Original viewing position and viewport layout. Viewport layout with 2/3 aspect ratio in vertical format.

Position Camera
This allows the absolute location of the camera to be set and to "point it at" some other location. These are 3-D points which must be typed in; they cannot be graphically selected. Unlike the "Locate Target and Eye" command in the View menu, this doesn't change the perspective because the location at which the camera is aimed is used to define a vector and not a perspective distance.
 

Position Camera
   
  Original viewing position.  
Position camera at location 120, 96, 72 looking at location 12, -42, 36. This is essentially a six foot tall person standing a couple of feet away from the front-right corner of the bench looking at the back-left corner of the bench. This still has the same lens on it that the original view had. The "up" direction is not what is desired, so it is necessary to "pause" the program file, issue a viewing command that rotates the view about the screen z-axis an amount of -90 degrees, and then resume execution of the program file. Position of camera after the rotation during the pause. This is after changing the lens to a 16 mm wide angle lens.

Rotate Camera
This will offer the choice to either "pan" (rotate side to side) or "tilt" (rotate up and down) the camera. A positive "pan" angle is to the left and a positive "tilt" angle is up.
 

Rotate Camera
Pan 15 degrees (left). Original viewing position. Pan -15 degrees (right).
Tilt 30 degrees (up). Original viewing position. Tilt -20 degrees (down).

Translate Camera
This allows the movement of the camera in three dimensions. It also allows the choice of movement relative to the screen coordinate system or relative to the model coordinate system.
 
 

Translate Camera
Translate, Screen, 0, 0, -60 (moving toward the screen) Original viewing position. The lower right edge between the floor and the wall is the model x direction, the lower left edge between the floor and the wall is the model y direction and the vertical edge between the walls is the model z direction. Screen x is to the right, screen y is up, and screen z is straight out of the screen. Translate, Screen, 0, 0, 60 (moving away from the screen)
 Translate, Model, 0, 0, -60 (moving down in model space) Original viewing position.  Translate, Model, 0, 0, 60 (moving up in model space which puts us above the room)
Translate, Screen, -30, 0, 0 (moving left across the screen) Original viewing position. Translate, Screen, 30, 0, 0 (moving right across the screen)
Translate, Model, -30, 0, 0 (moving toward the left wall along the right wall) Original viewing position. Translate, Model, 30, 0, 0 (moving away from the left wall along the right wall)
Translate, Screen, 0, -20, 0 (moving down the screen) Original viewing position. Translate, Screen, 0, 20, 0 (moving up the screen)
Translate, Model, 0, -20, 0 (moving away from the right wall along the left wall) Original viewing position. Translate, Model, 0, 20, 0 (moving toward the right wall along the left wall)

Change Camera Lens
This sets the appropriate viewing parameters to achieve a result in which the camera remains in the same location looking in the same direction, but with a different perspective which results in a view that looks like a new lens was put on the camera.
 
 

Change Camera Lens
   
  Original viewing position equivalent to a 44.7846 mm lens.  
Equivalent to a 35 mm lens. Equivalent to a 24 mm lens. Equivalent to a 20 mm lens.
Equivalent to a 75 mm lens. Equivalent to a 90 mm lens. Equivalent to a 135 mm lens.

List Current Lens
This lists all the pertinent viewing information and uses that information to calculate the equivalent 35 mm lens.
 
 

List Current Lens

   TARGET POINT = -202.2772, 153.3355, -72.57257

   EYE    POINT = 162.0788, -131.0703, 82.45434

   EYE   VECTOR = 0.747367, -0.5833732, 0.3179912

   PERSPECTIVE DISTANCE         = 487.5195
   PERSPECTIVE FIELD-OF-VIEW    = 15
   VIEW DIAMETER                = 261.261

   EQUIVALENT LENS FOCAL LENGTH = 44.7846 MM

The current lens is the default focal length that you will get with I-DEAS if you do not change perspective parameters.

Store Current View
Once the camera is positioned as desired with the correct lens "installed", the view can be stored to be used later.

Set Display Mode
This sets the current display mode to any of the design display modes available, including line, software hidden line, hardware hidden line, hardware shaded image, software shaded image, and ray trace shaded image. This allows the user to search for the right view quickly using wireframe mode and then create a shaded display without exiting the program file.

Exit Program File
Just what it says; this is the way to gracefully exit the program  file. At any time, entering a "$" or selecting "abort" from the menu will cause the user to exit the program file. Entering a "!" or selecting "backup" will cause the user to return to a previous question or to a higher menu level of the program file.

Pause to Change Something
The program file couldn't be structured to think of everything, so an ability to pause the program file temporarily to perform some other activity is possible. Execution of the program file is then resumed by typing an "@".

Display
Sometimes I-DEAS leaves ghost images or some other graphical artifact on the screen and this command is simply the program file equivalent of REDIsplay to get a fresh display.

Download camera.prg (original from Jim Ross) or newcam.prg (updated from Mike Morse)