VisIt-tutorial-moviemaking
From DOE SciDAC VACET Center Wiki
| Back to the tutorial index |
There are two parts to this section:
- How to make a single image look better.
- How to animate / make a movie
Contents |
Setup work
Generate a time varying database
VisIt doesn't come with any time varying databases to play with, so we will make some with the Python command language. This is a good exercise with Python, but if you have trouble, we've also made a tarball of the data files available at http://users.nccs.gov/~ahern/HGX.tar.gz
Open the file "noise.silo". Then execute the following script:
DefineScalarExpression("X", "coord(Mesh)[0]")
for i in range(20):
DefineScalarExpression("hgx", "hardyglobal*(1+max(0,abs(%d - (X+10))/5))" %(i))
DeleteAllPlots()
AddPlot("Pseudocolor", "hgx")
DrawPlots()
e = ExportDBAttributes()
e.db_type = "VTK"
e.variables = ("hgx")
e.filename = "hgx%02d" %(i)
ExportDatabase(e)
DeleteAllPlots()
DeleteExpression("hgx")
Create a plot
We will now create a plot that we will work with for the rest of this wiki page.
- Open up the "hgx*.vtk database" (the location will be wherever you started VisIt).
- Make a contour plot of "hgx".
- Bring up the plot attributes for the Contour plot and chance the Select By to "N levels" and make the number of levels be 5.
- Draw plots
Tips on the Contour plot
- The contour plot does two things:
- Takes contours (isosurfaces) from your input data set
- Colors each contour its own color.
- There are two primary controls:
- How to set the isovalues
- This is done with "Select by"
- Nlevels automatically chooses the values for you based on the minimums and maximums.
- EXAMPLE: For min=0 and max = 1 and nLevels = 3, it would choose isovalues of 0.25, 0.5, and 0.75
- Percent allows you to specify locations in terms of percentages. You may have multiple values that are space delimited
- EXAMPLE: For min=0 and max = 1 and percent = "20 80", the isovalues would be 0.2 and 0.8
- Values allows you to explicity set the values.
- EXAMPLE: values = "0.2 0.8" would (obviously) be 0.2 and 0.8.
- Nlevels automatically chooses the values for you based on the minimums and maximums.
- For Nlevels and Percent, you can aritificially set the minimum and maximum values.
- This is done with "Select by"
- How to color each isovalue.
- Single: color each isovalue with the same single color.
- This is best for contours with 2D data sets.
- Multiple: give each isovalue its own color and then control the individual colors and opacities separately.
- Single: color each isovalue with the same single color.
- How to set the isovalues
How to make a single image look better
Colors
Contour plot
The default colors for the Contour plot are awfully bright. Sometimes adjusting these colors improves the picture quality.
Pseudocolor plot
This section is using the Contour plot, but this is a natural place to demonstrate colors with the Pseudocolor plot. So let's take a quick detour...
- Hide your Contour plot and make a Pseudocolor plot of "hgx".
- Bring up the Pseudocolor plot attributes.
- Change the Color table from "hot" to "hot_desaturated".
- This is my favorite colormap.
- Iterate over the rest of the color maps.
- Now go to Controls->Color table.
- Rather than creating a new color table, modify the "hot" color table.
- Change the number of colors to be 6. Move the widgets and change their colors.
- Apply
- Change the Pseudocolor plot to use "hot" again.
- Your changes to the color table should be reflected.
- We're done with our detour. Delete your Pseudocolor plot and unhide your Contour plot.
Lights
Modifying the number of lights, position and intensity
Go to Controls->Lighting to do this.
- You have 8 lights to work with.
- (You will never need this many)
- Most are disabled. When you want to turn on a light, it is important that you click "Enabled".
- The three primary controls are direction, brightness, and type.
- Type = AMBIENT: direction is not used ... everything is lit more brightly
- Type = CAMERA: the light is like a miner's hat. As the camera rotates, the light rotates with it.
- Type = POSITION: the light is fixed in one position in space.
Specular lighting
This is one of the easiest ways to make your movie look nice.
- Go to Options->Rendering.
- Turn on specular lighting.
- Play with strength & sharpness.
Shadows
Shadows are only supported if VisIt's "scalable rendering" mode is on.
- Go to Options->Rendering
- Go to the Advanced tab
- Turn "Use scalable rendering" to "Always"
- Turn Shadows on.
- Click apply.
- You will only see shadows if you have moved the light source.
- If the light source is at direction 0,0,-1, then the light source is coincident with your eye, hence shadows are invisible.
Annotations
- Go to Controls->Annotations
- On the General tab, turn off the "Database", and "User information"
- Go to the 3D tab and look at the options there.
- The 2D tab has complete controls of tick mark placement, etc.
- Go to the Colors tab
- Change the background style to gradient.
- Experiment with the gradient styles and colors.
- Go to the Objects tab.
- Highlight the Legend object.
- Turn off "Let VisIt manage legend position"
- Change the legend position to be "0.8 0.9" and click apply
- Click on "Time slider"
- Click OK for the autogenerated name.
- Change the text label from "Time=$time" to the empty string
- The time will be incorrect because we generated this database artificially and each file has the same time.
- Click on "Text"
- Again click OK and accept the autogenerated name.
- Change the text from "2D text annotation" to "This is my first VisIt movie" or whatever.
- Change the "Lower left" to be "0.5 0.01"
- Click apply
Another detour: time animation
Now that we have a time varying database, we can use the VCR controls.
- Go to the VCR controls below the selected files list.
- Click the right-facing arrow, the one to the right of the square ("stop")
- VisIt starts animating in time.
- Click the square to stop the animation.
How to animate / make a movie
- The easy way to animate a movie is with the movie wizard.
- You are limited by what you can do with the movie wizard.
- The simplest is to animate over time
- You can also use premade movie templates
- Keyframing is also possible, but is not robust.
- You are limited by what you can do with the movie wizard.
- The alternate way is to use Python scripting.
- With Python, you would add "SaveWindow" calls for each frame.
To use the movie wizard:
- Go to File->Save Movie
- Select new simple movie
- Change the format to an image format
- You often want MPEG encoding, but that has been failing frequently recently
- Never select the other movie formats
- Click on the right arrow and then click next.
- Click "Next" all the way through until you get to "Finish"
This is a terrible movie ... the isovalues change from time slice to time slice!! Fix this by changing the Contour plot attributes so the min and max are fixed.
| Back to the tutorial index |
