Next: , Previous: ntransform, Up: Non-geometric objects

4.3.5 cameras

A camera object specifies the following properties of a camera:

position and orientation
specified by either a camera-to-world or world-to-camera transformation; this transformation does not include the projection, so it's typically just a combination of translation and rotation. Specified as a transform object, typically a 4x4 matrix.
"focus" distance
Intended to suggest a typical distance from the camera to the object of interest; used for default camera positioning (the camera is placed at (X,Y,Z) = (0,0,focus) when reset) and for adjusting field-of-view when switching between perspective and orthographic views.
window aspect ratio
True aspect ratio in the sense <Xsize>/<Ysize>. This normally should agree with the aspect ratio of the camera's window. Geomview normally adjusts the aspect ratio of its cameras to match their associated windows.
near and far clipping plane distances
Note that both must be strictly greater than zero. Very large <far>/<near> distance ratios cause Z-buffering to behave badly; part of an object may be visible even if somewhat more distant than another.
field of view
Specified in either of two forms.
is the field of view – in degrees if perspective, or linear distance if orthographic – in the shorter direction.
is half the projected Y-axis field, in world coordinates (not angle!), at unit distance from the camera. For a perspective camera, halfyfield is related to angular field:
halfyfield = tan( Y_axis_angular_field / 2 )

while for an orthographic one it's simply:

halfyfield = Y_axis_linear_field / 2

This odd-seeming definition is (a) easy to calculate with and (b) well-defined in both orthographic and perspective views.

background color
Arguably not a property of a camera, but of the scene. Nevertheless, as there is no "background" OOGL object, and the background color should not be a property of the drawing device, it can be specified here. At the time of this writing, however, the GUI always overrides the background color with its own settings.
background image
Same reasoning as above, only that the GUI does not override this setting. The image is centered at NDC co-ordinates (0,0,-1); it is not resized, just painted behind everything else as is. See Image objects.

The syntax for a camera is:

     <camera> ::=
        [ "camera" ]                 (optional keyword)
         [ "{" ]                    (opening brace, generally required)
             [ "define" <name> ]
             "<" <filename>
             ":" <name>
                                     (or any number of the following,
                                      in any order...)
             "perspective"  {"0" | "1"}            (default 1)
                                             (otherwise orthographic)
             "stereo"       {"0" | "1"}            (default 0)
                                             (otherwise mono)
             "worldtocam" <transform>        (see transform syntax above)
             "camtoworld" <transform>
                                     (no point in specifying both
                                      camtoworld and worldtocam; one is
                                      constrained to be the inverse of                                                the other)
             "halfyfield" <half-linear-Y-field-at-unit-distance>
                                     (default tan 40/2 degrees)
             "fov"           (angular field-of-view if perspective,
                              linear field-of-view otherwise.
                              Measured in whichever direction is smaller,
                              given the aspect ratio.  When aspect ratio
                              changes -- e.g. when a window is reshaped --
                              "fov" is preserved.)
             "frameaspect" <aspect-ratio>    (X/Y) (default 1.333)
             "near"  <near-clipping-distance>        (default 0.1)
             "far"   <far-clipping-distance>         (default 10.0)
             "focus" <focus-distance>                (default 3.0)
             "bgcolor" <float RGB(A) color>          (default 1/3 1/3 1/3 1)
             "bgimage" { <image specification> }     (default no background image)
          [ "}" ]                           (matching closebrace)

Next: , Previous: bbox-draw, Up: GCL Reference

7.2.15 camera

(camera CAM-ID [CAMERA])
Specify data for CAM-ID; CAMERA is a string giving an OOGL camera specification. If no camera CAM-ID exists, it is created; in this case, the second argument is optional, and if omitted, a default camera is used. See (new-camera ...).