VisIt-tutorial-moviemaking

There are two parts to this section:

  1. How to make a single image look better.
  2. How to animate / make a movie

Setup work

Generate a time varying database

For movie making, we will create a time varying data set from example.silo with the Python client interface. This is a good exercise with Python, but if you have trouble, this creates a similar data set to varying.visit.

Open the file example.silo. Then execute the following script:

DefineScalarExpression("X", "coord(Mesh)[0]")
for i in range(20):
   DefineScalarExpression("hgx", "temp*(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.

  1. Open up the "hgx*.vtk database" (the location will be wherever you started VisIt).
  2. Make a contour plot of "hgx".
  3. Bring up the plot attributes for the Contour plot and change the Select By to "N levels" and make the number of levels be 5.
  4. Draw plots

Tips on the Contour plot

  • The contour plot does two things:
    1. Takes contours (isosurfaces) from your input data set
    2. Colors each contour its own color.
  • There are two primary controls:
    1. 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.
      • For Nlevels and Percent, you can aritificially set the minimum and maximum values.
    2. 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.

How to make a single image look better

Before animating through time, it is important to make the visualization look better. This process starts by selecting appropriate colors, lighting, and annotations.

Colors

Here, we cover how to set colors for 2 important plot types.

Contour plot

The default colors for the Contour plot are awfully bright. Sometimes adjusting these colors improves the picture quality.

  1. Open the Contour plot attributes window
  2. Click the Color table radio button
  3. Select the YlOrRd color table or experiment with one of the other color tables
  4. Click the Apply button
  5. Dismiss the window
Using a color table to color the contours

Pseudocolor plot

  1. Hide your Contour plot
  2. Make a Pseudocolor plot of hgx and click Draw
  3. Open the Pseudocolor plot attributes window
  4. Change the Color table from hot to hot_desaturated
  5. Click Apply
  6. Select other color tables to see their effect on the plot
  7. Change the color table to hot

Editing color tables

  1. Open the Color table window Controls->Color table
  2. Modify the hot color table
  3. Change the number of colors to be 6
  4. Move the color control points and change their colors
  5. Apply
    • Your changes to the color table should be reflected.
  6. Delete the Pseudocolor plot
  7. Unhide the Contour plot by clicking the Hide/Show button in the Main window

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.
    1. Type = AMBIENT: direction is not used ... everything is lit more brightly
    2. Type = CAMERA: the light is like a miner's hat. As the camera rotates, the light rotates with it.
    3. Type = OBJECT: the light is fixed in one position in space.

Specular lighting

This is one of the easiest ways to make your movie look nice since it makes the plots shinier.

  1. Go to Options->Rendering
  2. Turn on specular lighting
  3. Play with strength & sharpness

Shadows

Shadows are only supported if VisIt's "scalable rendering" mode is on.

  1. Go to Options->Rendering
  2. Go to the Advanced tab
  3. Turn "Use scalable rendering" to "Always"
  4. Turn Shadows on.
  5. Click apply.
  6. 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.
Shadows and specular highlights have been enabled

Annotations

  1. Open the Annotations window via Controls->Annotations
    1. On the General tab, turn off the "Database", and "User information"
    2. Go to the 3D tab and look at the options there
      • The 2D tab has complete controls of tick mark placement, etc.
    3. Turn off Show axes
  2. Go to the Colors tab
    1. Change the background style to gradient
    2. Experiment with the gradient styles and colors
  3. Go to the Objects tab
    1. Select the Legend:Contour - hgx object in the list of objects
    2. Turn off Let VisIt manage legend position in the Legend properties
    3. Change Orientation to Horizontal, Text on Bottom
    4. Change the legend position to 0.7 0.15 and click Apply
    5. Click on Time slider to create a new time slider object
    6. Click OK to use the default name
    7. 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
    8. Click on Text to make a new text object
    9. Again, click OK and accept the default name
    10. Change the text from 2D text annotation to "Movie Example in VisIt", or whatever
    11. Change the Lower left to be 0.3 0.95
    12. Turn on Shadow and Bold on the font
    13. Click Apply
Annotations can be customized, improving the look of the movie

Time animation

When you have plots from a time-varying database, you can use the time controls in the Main window to animate through time.

  1. Go to the Time controls in the Main window
  2. Click the play button to start animating (the right-facing arrow, to the right of the square ("stop") button)
    • VisIt will start animating in time
  3. Click the stop button to stop the animation

Important Points

When you are animating through time or making movies, you will need to alter your plots to set consistent variable limits. For example, the values in our hgx database change over time. When the Contour plot is free to select its own contour values (as when using NLevels) the contour values will vary over time if the data limits change. This same principle applies to Pseudocolor plots as well.

Let's change the Contour plot to use constant contour values:

  1. Open the Contour plot attributes window
  2. Change the Select by method to Values(s)
  3. Enter 3 6 9 12 15 as the contour values
  4. Apply

How to animate / make a movie

  • The easy way to create a movie is with the Save movie wizard
  • You can also use Python scripting to create a movie

Movie wizard

The movie wizard can be used to create a movie of plots that you have set up in your vis window; this is a Simple movie. The movie wizard also provides movie templates, which let you create premade visualizations with your own data. Movie templates can also be created by the user to incorporate plots from several vis windows. Each vis window generates a sequence of movie frames, which can be played back to back or in various viewports (e.g. picture in picture). Movie templates also provide various transitions between image sequences such as fly-in, dissolve, and many more.

To use the movie wizard:

  1. Go to File->Save Movie
  2. Select New simple movie
  3. Change the format to MPEG movie
    • You can select multiple formats and sizes here
    • Commercial MPEG encoders will surpass the quality of VisIt's default MPEG encoder
    • You might consider selecting an image format and encoding the movies with a separate tool
    • ffmpeg is a good encoder. If VisIt detects ffmpeg, it will use it
  4. Click on the right arrow and then click Next
  5. Click Next all the way through until you get to Finish