AnimateCamera

DESCRIPTION

This module outputs cameras as geometry that can be used to update view transformations in rendering modules, such as Render. Key cameras are input, either from a file or as geometry input, and the output cameras are interpolated using the key cameras as control points.

Camera control points are entered in Learn Mode. A widget allows switching between Learn Mode and Run Mode. When in Learn Mode, the Time widget specifies the time of a particular control point. This time is a virtual time for the animation, and need not be the playback time.

A control point camera is entered by setting the time, putting the camera on the input port (by wiring in from the Camera output port of Render, for example), and pressing the Set button. A control point camera may be deleted by setting the appropriate time and pressing the Clear button. The current list of control point cameras may be printed to the log window with the Print button.

Cameras may be saved and restored from the control panel menu bar. The Inventor specification is used for the file:

 #Inventor V2.0 ascii
 

Group { Info { string "0.000000" } PerspectiveCamera { position 1.27391 1.67389 1.18477 orientation -0.754115 0.648784 0.101932 1.06397 nearDistance 0.0241421 farDistance 7.41421 focalDistance 2.41421 } } Group { Info { string "15.000000" } PerspectiveCamera { position 2.39209 -0.109063 -0.30729 orientation 0.245015 0.953196 0.17716 1.73535 nearDistance 0.0241421 farDistance 7.41421 focalDistance 2.41421 } } ...

An Info node is used to contain the time. Only perspective cameras should be used with this module. Other types of cameras will not be recognized.

In Run Mode, setting the time causes an interpolated camera to be output. The Output Camera port should be wired to a module that understands cameras, such as to the Camera input port of Render. Wiring to the regular geometry port will not work. The data on the Output Geometry port can be seen in a geometry viewer, however, as an iconic representation of the camera.

Pressing the Go button in Run Mode will cause several cameras to be sent out. The animation will start at the minimum bound of the Time widget and continue to the maximum bound. The time step, in virtual time, will be the value contained in the Step widget. The actual delay between units of Time will be the value in the Delay widget, interpreted as seconds. An animation will be aborted by any firing of the AnimateCamera module, for example by touching any widget.

The Sync input parameter or the module's Fire port may be used to externally trigger the output of a new camera. When new data arrives on either of these ports, the Step value is added to Time, and a new camera is sent out.

INPUTS

Port: Camera
Type: Geometry
Optional: This port is optional
This optional port takes in camera geometry to be used for control points.

Port: Sync
Type: Generic
Optional: This port is optional
This optional port allows output of successive cameras to be synced to an external data item. Each time new data arrives on this port, the next camera will be sent out.

WIDGETS

Port: Time
Type: Slider
This parameter specifies a time during the animation. In Learn Mode, it is used to designate the time for a control point. In Run Mode, it is used to designate the current time in the animation. The minimum and maximum bounds on the widget are used to control the start and end times of the animation.

Port: Mode
Type: Option Menu
Menu Item: Learn
Menu Item: Run
This widget switches between Learn Mode, which is used to edit control points, and Run Mode, which output cameras.

Port: Set
Type: Button
When pressed, this button sets a control point at the current time with the current input camera. If a control point already exists at that time, it is replaced. If no camera is present on the port, an error is generated. This button is only accessible in Learn Mode.

Port: Clear
Type: Button
When pressed, this button removes the control point at the current time. This button is only accessible in Learn Mode.

Port: Print
Type: Button
When pressed, this button prints out the times and a partial description of the cameras on the current set of control points. This button is available in both Learn and Run modes.

Port: Go
Type: Button
When pressed, this button starts an animation from the minimum bound of Time to the maximum bound of Time. The step size is taken from the Step widget and the delay between successive cameras is taken from the Delay widget. The animation will be aborted by any firing of the module. This button is only accessible in Run Mode.

Port: File In
Type: Text
This port takes a file name to read in control point cameras from a file. There is no visible widget associated with this parameter; this function is normally accessed from the control panel menu bar.

Port: File Out
Type: Text
This port takes a file name to write out the current set of control point cameras to a file. There is no visible widget associated with this parameter; this function is normally accessed from the control panel menu bar.

Port: Step
Type: Text
This parameter specifies a numeric step value for the time between successive animation frames. This time is a virtual time associated with the animation, not the delay between frames. This widget is only available in Run Mode.

Port: Delay
Type: Text
This parameter specifies the delay in seconds between successive animation frames when the Go button is pressed. This widget is only available in Run Mode.

Port: Planes
Type: Option Menu
Menu Item: Use
Menu Item: Ignore
This widget controls the interpolation of the near and far clipping planes in the camera. When the camera uses the clipping planes it interpolates near and far distances from the control points. When the camera ignores the clipping planes it sends Inventor's 'isIgnored' flag in place of data, which allows the downstream module to compute a suitable plane distance. In most cases the clipping planes should be used, unless the clipping planes of the control points do not bound the geometry at all time steps. In the latter case the interpolated camera may truncate the viewed geometry. Set the Ignore flag to solve this problem.

OUTPUTS

Port: Output Camera
Type: Geometry
This port is used to output the interpolated cameras as geometry. It should only be wired into ports that understand that the incoming geometry contains a camera, such as the Camera port of Render.

Port: Output Geometry
Type: Geometry
This port is used to output an iconic representation of the camera, so a separate renderer can be used to view the camera positioning and motion.

PROBLEMS

The module uses a Catmull-Rom spline to interpolate some camera values. It assumes equispacing of key cameras. If the input cameras are not spaced equally in time, the output camera may have interpolation artifacts that cause first derivatives of camera values not to be continuous across key camera locations. A more uniform sampling of key cameras will reduce this problem.

Also, the Catmull-Rom spline has local basis, which means that second derivatives will not be continuous.

The interpolated cameras may truncate the geometry in cases where near and far clipping planes at the control points do not bound the geometry at all interpolated points. See the "Planes" widget above.

SEE ALSO

Render
[ Documentation Home ]
© The Numerical Algorithms Group Ltd, Oxford UK. 1996