As described in the preceding sections of this manual, OVITO can be used to visualize simulation sequences, play them back within the program, or produce simulation movies. On top of this basic functionality, the program provides powerful animation capabilities, which let you animate the virtual camera or other parameters. The following sections explain the underlying animation system of OVITO in more detail.
Figure 1. The animation panel of the External File Source.
Animation frames vs. simulation frames
After loading a simulation sequence into OVITO, the timeline below the viewport windows indicates the length of the current animation interval. Animation frame numbers start at zero in OVITO. Thus, an animation starting at frame 0 and ending at frame 100, for example, consists of 101 video frames.
It is important to point out that there is a semantic difference between simulation frames (i.e. the simulation snapshots imported into OVITO) and animation frames, which are the time units used by OVITO's internal timeline. By default there is a one to one mapping between the two, i.e., the number of animation frames in OVITO's timeline is automatically adjusted to match the number of loaded simulation snapshots. This default behavior is controlled by the Adjust animation length to time series option in the Animation panel of the selected external file source, which is highlighted in the screenshot.
It is possible to decouple the animation length from the length of the loaded simulation sequence by turning off this option. Then you will be in control of the animation length, since OVITO no longer adjusts the internal animation length to accommodate all frames of the loaded simulation. You can manually change the length of the current animation in the Animation settings dialog. If you make the animation interval longer than the number of imported simulation frames, you will get additional still images at the end of the animation.
The Animation panel provides two additional options, which control how the imported simulation frames are mapped to animation frames. The Playback rate setting allows you to specify a mapping that is not one to one. For example, a playback rate of 1:2 would stretch the simulation sequence to extend over twice as many animation frames. Each snapshot of the simulation would then be visible for two consecutive video frames. A playback rate of 2:1, in contrast, would compress the playback of the simulation sequence to half of the animation frames. Then, every other simulation snapshot is skipped in the rendered animation. The Start at animation frame setting controls when the playback of the simulation sequence begins on OVITO's animation timeline. By default it starts immediately at animation frame 0, but you can change this number, e.g. to insert still frames at the beginning of a movie.
Note that OVITO provides the possibility to load multiple simulation datasets simultaneously into one scene to display them next to or on top of each other. Attention must be paid if not all imported simulation sequences contain the same numbers of snapshots. To avoid possible conflicts, OVITO activates the Adjust animation length to time series option only for the first simulation sequence that you import, and not for those subsequently added to the same scene. Of course you can modify these settings later on, or disable the automatic adjustment for all external file sources in the scene and then specify an animation length by hand in the Animation settings dialog.
In addition to the animation length, the Animation settings dialog also lets you change the playback speed (frames per second) of the current animation. This number determines the frame rate of video files produced by OVITO (e.g. AVI or MPEG). It also affects the playback within OVITO, which, however, typically happens at a lower effective rate because loading the next simulation snapshot from disk takes too long to reach the realtime frame rate.
Animation via time-dependent functions
Simple animation effects can readily be achieved using the Expression selection and Compute property modifiers. These modifiers allow you to enter arbitrary mathematical formulas and Boolean expressions to select subsets of particles or to manipulate certain particle properties (e.g. position, color, transparency, etc.).
Within such a math expression, you can incorporate the special variable
Frame, which evaluates
to the current animation frame number. Thus, if you reference this variable in an expression, the formula becomes
time-dependent and OVITO will recompute the results on every animation frame.
Animation via key frames
OVITO also provides a key-based animation framework. It lets you specify the value of an animatable parameter at certain animation times (for example at the beginning and at the end of the animation). In between these key frames, the value of the parameter is then determined using smooth interpolation (typically linear).
The screenshot on the right shows the parameter panel of the Slice modifier as an example. Animatable parameters are indicated by an button next to the input field. This button opens the animation key dialog for that parameter, which allows you to define new animation keys. Animation keys are time-value pairs.
In the next screenshot on the right, two animation keys have been defined for the Distance parameter of the slicing plane, one at frame 0 and the other at frame 50. Thus, the parameter will have a value of 20.0 at the beginning of the animation and reach 80.0 at the second animation key frame.
Note that an animatable parameter always has at least one animation key. As long as there is only that single key, it defines the constant value of the parameter. Once you add another key OVITO will interpolate between the key values and the parameter actually becomes animated.
The animation toolbar at the bottom of the main window contains a button with a key icon, which activates the so-called Auto-key mode:
While this mode is active, the time slider background is highlighted red and any change made to an animatable parameter in the program will automatically generate a new animation key at the current animation time. For example, after activating Auto-key mode, you can jump to animation frame 0 using the time slider and set the Distance parameter of the Slice modifier to a value 20. You then go to the last frame of the animation and change the parameter value to 80. Each of the two parameter changes results in the creation of a new animation key at the corresponding animation time.
Don't forget to deactivate Auto-key mode after you are done creating the desired animation keys. Otherwise you might inadvertently define more keys for other parameters which you don't want to animate. The Auto-key mode provides a convenient alternative for creating new animation keys, which can be faster than using the animation key dialog introduced in the previous section.
Editing keys using the animation track bar
The track bar is located right below the time slider and displays the created animation keys for the currently selected scene object and its parameters:
Each key is represented by a small marker at the corresponding position of the timeline. Positioning the mouse cursor over a marker will show the key's information in a small tool tip window. You can use the mouse to drag animation keys to a different position on the timeline. Right-clicking on a key opens a context menu which allows you delete the key.
Note that the track bar will only display the animation keys of parameters that are actually animated, i.e., which have at least two keys defined. Thus, as soon as only one key is left, it will automatically disappear from the track bar.
Animating the camera
To animate the camera, you first have to create a camera object. This is done from a viewport's context menu as shown in screenshot on the right. The new camera object will be placed in the three-dimensional scene at the current viewpoint. Furthermore, the active viewport will be linked to the new camera object so that when the camera is moved, the viewport will be updated to show the scene as seen through the new camera position. Conversely, if you use the zoom, pan, or orbit functions to adjust the viewport's view, the camera object in the scene will be moved accordingly.
The newly created camera object is visible in the other three viewports. You might have to zoom out to see it. Click on the camera object in the viewports to select it and show its parameters in the command panel. Alternatively, you can select the camera object using the object selector box located in the top right corner of the main window, which lists all objects in the current scene:
The camera object can be moved around in space using the Move tool and the Rotate tool in the main toolbar:
While one of these modes is active, you can drag the camera object with the mouse; or use the numeric input fields that appear in the status bar area, which let you enter the position coordinates and Euler orientation angles of the selected object:
Similar to other parameters, the position and the orientation of the camera object can be animated using the keyframing approach. To create animation keys for the camera position or rotation, you first have to activate the Auto-key mode as described above. If you now change the camera's position at different animation times, animation keys will automatically be created and the camera will move on an interpolated path between the keyframe positions. The created animation keys are also shown in the track bar while the camera is selected.
By the way, instead of animating the camera's position, you can also animate the simulation box and let it rotate, for example. This is done in an analogous way by selecting the simulation box and using the Rotate tool while Auto-key mode is active.