In this tutorial, we will explore animations. We will load and play animations, and will also look at how to create and save these animations.
Animations rely on the use of the Animation View window and the VCR Controls toolbar. You could also use the Animation Inspector, but we will not look at it here.
- Open the Animation View by selecting it from the View menu; by default it will appear below the View Manager.
- This window is used to create and modify animations.
- Make sure the VCR Controls toolbar is visible, otherwise open the View menu and show the toolbar.
- This toolbar is used to navigate through an animation.
- There are are eight buttons, with six showing initially; First Frame, Previous Frame, Play, Pause, Stop, Next Frame, Last Frame and Loop.
Datasets that change over time
Some datasets contain properties that change over time; when these are loaded, the Time section on the Information tab shows that time values exist in the data.
- Load the StopesAnimationGeometry.pvd file from the sample data.
- Click the Apply button, then switch to the Information tab and look at the time section; Index and Value entries exist for this dataset.
- In the Animation View, note that this type of file will always default to the Snap To Time Steps mode
- Although the dataset was applied, nothing appears in the render view.
- The first frame of this animated dataset shows no image, so the camera has nothing to focus on.
- Click on the Last Frame button, then on the Reset button on the Camera Controls toolbar; the dataset will appear in the render view.
- Change the viewpoint to look along the negative Y axis, then rotate the camera a bit so you're looking slightly down onto the drifts and stopes.
- Since the dataset defaulted to gray coloring, change the Color By to risklevels.
- Click on the First Frame button; the view will disappear, but the camera is still in the correct location.
- Click on the Play button to start the animation
- The Pause button will pause the animation at its current frame, and pressing Play again will continue from that frame.
- Pressing the Stop button will stop the animation and pressing Play again will re-start it from the beginning.
- Try out the different playback modes to see how the playback of the same animation varies depending on the mode that is used.
- Snap To Time Steps was the default, and this mode uses the number of time values in the dataset to determine the number of frames in the animation.
- The Sequence mode has a field where the number of frames can be set, and will play one frame after the next, as quickly as the frames can be rendered, until the set number is reached. The default is 10 frames, but this number can be changed; for this animation, 10 frames were selected from those available in the dataset, creating a more choppy animation that jumps from one frame to the next.
- The Real Time mode runs over a specified duration in seconds.
- Note that we are watching an animation of the drifts and stopes that are part of the demo data supplied with every ParaViewGeo install. Although the actual datasets do not have timesteps, it was possible to create an animation (using property values) that somewhat represents how the mine may have been developed, and this animation was saved in a single dataset that includes both of the original datasets.
- Click on the Disconnect icon and Discard to clear the pipeline.
File Series Animations
Datasets that are set up as sequentially numbered file series are treated as animations in ParaViewGeo. These animations require that the root file is loaded, and will default to the Snap To Time Steps mode. A file series animation cannot be created from sequential image files; only the first image will be loaded into the render view for all time steps.
- Open the Series folder in the sample data and load the Sphere..vtp file.
- The root file must be selected to load the data; a root file will always have at least two periods in front of the file extension.
- Clicking on the Plus beside the root file shows all twelve files that exist within.
- Click the Apply button to finish loading the data; a somewhat elongated triangle appears, but only one entry exists in the pipeline.
- Change the viewpoint to look along the positive Y axis; the image now looks like a sliver of the moon.
- Press the Next Frame button repeatedly to slowly cycle through the animation.
- Although there is only one entry in the pipeline, each frame shows a different file from the series.
- Try out all the playback modes to see how the animation plays with each one; note that the Snap To Time Steps mode was selected by default.
- Disconnect and Discard to clear the pipeline.
In a Property Animation, almost any property for any of the pipeline objects can be animated, although we sometimes have to get a bit creative when setting it up. Property animations usually work best with the Sequence or Real Time modes.
- Click on Sources > Sphere and apply the default settings.
- We now have a sphere in the render view; you can color it if you wish.
- There are two drop-downs at the bottom of the Animation View window.
- The first is an Object drop-down and the second is a Property drop-down.
- Since the sphere is our only object in the pipeline, the Object drop-down already defaults to the sphere; if you look in the drop-down, the only other option is Camera, which we will look at shortly.
- Looking at the Property drop-down, we have several options, most of which were available on the Properties tab when we created the sphere.
- Select the End Theta property, then click on the blue Plus icon; this well add a Track to the Animation View called "Sphere1 - End Theta" (a combination of the object name and property name).
- Double-click the white section of the track we just created; this opens the Animation Keyframes window.
- With the Animation Keyframes we set the values that will be used for the animation.
- Because we chose the End Theta property, the values default to 0 and 360, which is the whole End Theta range.
- Double-click on the 0 to highlight it and change the value to 30, then click OK to close the window.
- Click on the Play button to run the animation.
- Rotate the view and play the animation again to see it from a different angle.
- We can add additional properties that we want animated.
- Select the End Phi property and add the Track by clicking the plus icon.
- Open the Animation Keyframes window and change the range to 30 - 180.
- Play the animation; you may have to change the viewpoint to see the whole effect.
- Step through the animation one frame at a time to see it in detail, until you reach the last frame.
- If a Track is no longer required, we can delete it by clicking the red X beside the track name.
- Delete the Sphere1 - End Phi track.
- Note that if a property was animated, the object will keep the settings that were visible in the view when the track is deleted; for this animation, if the End Phi value is not at 180 when the track is deleted, the sphere will continue to have part of the bottom cut off until the value is changed in the Object Inspector.
- Animations can also make use of several objects visible in the render view.
- From the Sources menu, select another Sphere and change the radius to 0.2 before applying it.
- We can't see the sphere because it is inside the other sphere (depending on which timestep of the animation is currently displayed)
- Play the animation; the larger sphere is created around the smaller one.
- We are not limited to animations that start at one value and end at another; we can decide precisely what image we want to see at which point of the animation.
- Open the End Theta track.
- The right side has three buttons; New, Delete and Delete All.
- Press the New button; a new keyframe is added between the existing frames, with a time value half-way between.
- Change the values of the frames to 320, 345 and 360.
- Add a track for Sphere1 - Start Theta, add a keyframe and set the values to 45, 20 and 0.
- Select Sphere2 in the Object drop-down and add a track for Center (0) and set the first value to 0.5.
- Play the animation; the bigger sphere now appears to eat the smaller sphere (you may have to change the viewing angle).
- Press the Loop button and play the animation again; the looping will continue until you press either Pause or Stop.
- Disconnect to clear the pipeline.
Animating by Scalar Properties
It is also possible to create animations that are based on the scalar properties of a dataset.
- Load the Drifts.vtp dataset from the ParaViewGeo demo data and apply it to the pipeline.
- Let's animate the drifts dataset based on the risklevels.
- Looking in the Property drop-down only shows four options, and risklevels doesn't exist.
- This is where we need to get a bit creative; although we can't simply animate by risklevels here, let's instead apply a Threshold filter to the dataset (found under Filters > Common > Threshold).
- In the Scalars drop-down, select risklevels and then apply the filter.
- With the filter selected, switch to the Display tab and color by risklevels.
- Since the Threshold filter is now an object in the pipeline, it is available in the Object drop-down in the Animation View; select the Threshold object and the Threshold Range (1) property, then add the track.
- Double-click on the track and note that the risklevel values are already entered.
- To exclude part of the range you can change the values.
- Change the mode to Sequence and play the animation; also try the Real Time mode.
- Click in the Sources menu and select Annotate Time to add a text field that shows the time of the current view (you may have to change the Opacity to 1 to clear up the text).
- Even though the property wasn't readily available, by adding a filter we were still able to create the animation.
- Disconnect to clear the pipeline.
In a Camera Animation the view angle of the camera changes over time, and either the Sequence or Real Time modes are used.
- Click on Sources > Box and apply the default properties.
- On the Display tab, change the Color By to TCoords
- In the Animation View, select the Camera option from the Object drop-down and add the track; no properties exist for the camera at this time.
- Open the Animation Keyframes window.
- Press the New button four times to add extra keyframes, and change the time values of the new keyframes to 0.2, 0.4, 0.6 and 0.8 so they are evenly spaced.
- Leave the Animation Keyframes window open and click in the render view.
- Rotate the viewpoint a little, then switch back to the Animation Keyframes window (you can see it on the taskbar).
- Double-click on the Position field for the second keyframe; this opens the Key Frame Interpolation window.
- Press the Use Current button to update the camera values to those in the view, then click OK.
- Click on the render view and again move the view point a little and use these settings to update the third keyframe.
- Repeat the steps until the last keyframe has a new camera value.
- Select the first frame and play the animation.
- In Sequence mode the animation plays through quickly; switch to Real Time mode and run the animation again.
Altering the length of an animation
With the above camera animation we saw quite a change between running the animation in Sequence mode and running it in Real Time. However, both modes have settings that can be changed to alter the length of the animation.
- Select the Sequence mode and run the animation again; it only takes a few seconds.
- The No. Frames field defaults to 10 and defines how many frames are displayed; change it to 60 and run the animation.
- 60 frames are now rendered as quickly as possible, causing the animation to run longer (and more slowly)
- Change the number to 100; it slows down some more.
- Select the Real Time mode and run the animation; it runs at a good speed.
- The Real time mode uses the Duration field and runs the animation for the number of seconds specified here, 10 seconds by default.
- Change the duration to 5 and notice how the animation speeds up when you run it.
- You can slow it down by increasing the duration.
- Change back to the Sequence mode and change the number of frames to 10.
Animations can be saved as movie files, or image files, or they can be saved as geometries or within a state file. If an animation is saved as a movie or as image files, it cannot be re-loaded into ParaViewGeo, where as geometries or state files can be re-loaded.
- Use the Animation View to ensure that the animation plays exactly what you want to save, including the playback mode, duration and number of frames.
- To create a move file or image files of your animation, click on File > Save Animation to display the Animation Settings dialog.
- Here you can change the settings of the animation if required, though it is easier to change these in the Animation View since you can run the animation to make sure it plays as required.
- The settings that appear depend on the playback mode that was selected, though all will have the resolution options.
- Click the Save Animation button to display the Save Animation dialog.
- This window defaults to the *.avi movie file type, or you can select an image file format; leave the file format at *.avi and give the animation a name (such as AnimationTutorial1) and save the file.
- The animation will play through as it is saved, and a dialog box may appear to inform you that the resolution settings were changed; click OK.
- Repeat the steps and save the animation as image files of whichever type you'd like (you can use AnimationTutorial2).
- Look in the location where you saved the files; you will see one file for the movie and ten for the image files, one per frame. Play the movie if you wish.
- To save an animation so it can be re-opened in ParaViewGeo, we need to use either a state file or a geometry file.
- When saving a state file, the whole project is saved, which includes any coloring, filters and other actions that were performed on the dataset; but state files are not easily shared among several computers since the original datasets are not saved, merely referenced in the file.
- To save the animation in a state file, click on File > Save State and provide a file name (such as AnimationTutorial3).
- Saving with the geometry option will create a *.pvd file that can be opened on any machine, but this option will save the dataset as it last appeared (so only the results of any filters) and will not save any coloring or camera orientation. You can save multiple datasets into a single geometry file if they are selected in the pipeline when the geometry is saved.
- To save the animation in a geometry file, click on File > Save Geometry and save the geometry under AnimationTutorial4.
- Disconnect to clear the pipeline, and then load the State file you just saved.
- Once loaded, our box appears in the render view, colored by TCoords, and pressing the Play button will show the animation.
- Disconnect to clear the pipeline, and then load the Geometry file you saved.
- Once loaded, the box appears in the render view but it has the default gray color and pressing the Play button starts the animation, but the render view does not change; this is because camera positions are not saved in geometry files, and since our whole animation was based on camera positions, there is nothing to show.
- Disconnect and then create a Sphere from the Sources menu using the default properties.
- Color the sphere.
- Animate the Sphere using End Theta from 30 to 360.
- Change the camera viewpoint so you can better see the animation as it plays (you can use the positive Y axis).
- Save the animation in a Geometry file (call it AnimationTutorial5).
- Disconnect, then reload the file.
- Once loaded, you can see a small part of the sphere, in a gray color, and the camera has defaulted to view along the negative Z axis again.
- Switch to the positive Y axis and run the animation; all the frames were saved, and the animation plays as intended.
- If you want, re-create the Drifts Threshold animation, save it as a geometry file and reload it to see that you can still color by the scalars when the data is reloaded.
We have now covered the various animation options that are available within the program. You know how to load and run datasets that contain time properties and datasets that make up a file series, and you can create property and camera animations. Remember that you are not limited to a single type of animation; you could combine a property and camera animation, or a file series and camera animation, etc. You have also seen the advantages and disadvantages of the various options available for saving animations.
Click on the Disconnect icon and choose Discard to clear the pipeline.