VisIt-tutorial-moviemaking

From VisItusers.org

Jump to: navigation, search

There are two parts to this section:

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

Contents

[edit] Setup work

[edit] 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://vis.lbl.gov/~hrchilds/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")

[edit] 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 chance the Select By to "N levels" and make the number of levels be 5.
  4. Draw plots

[edit] 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.

[edit] How to make a single image look better

[edit] Colors

[edit] Contour plot

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

[edit] 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...

  1. Hide your Contour plot and make a Pseudocolor plot of "hgx".
  2. Bring up the Pseudocolor plot attributes.
  3. Change the Color table from "hot" to "hot_desaturated".
    • This is my favorite colormap.
  4. Iterate over the rest of the color maps.
  5. Now go to Controls->Color table.
  6. Rather than creating a new color table, modify the "hot" color table.
  7. Change the number of colors to be 6. Move the widgets and change their colors.
  8. Apply
  9. Change the Pseudocolor plot to use "hot" again.
    • Your changes to the color table should be reflected.
  10. We're done with our detour. Delete your Pseudocolor plot and unhide your Contour plot.

[edit] Lights

[edit] 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 = POSITION: the light is fixed in one position in space.

[edit] 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.

[edit] 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.

[edit] Annotations

  1. Go to 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.
  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. Highlight the Legend object.
    2. Turn off "Let VisIt manage legend position"
    3. Change the legend position to be "0.8 0.9" and click apply
    4. Click on "Time slider"
    5. Click OK for the autogenerated name.
    6. 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.
    7. Click on "Text"
    8. Again click OK and accept the autogenerated name.
    9. Change the text from "2D text annotation" to "This is my first VisIt movie" or whatever.
    10. Change the "Lower left" to be "0.5 0.01"
    11. Click apply

[edit] Another detour: time animation

Now that we have a time varying database, we can use the VCR controls.

  1. Go to the VCR controls below the selected files list.
  2. Click the right-facing arrow, the one to the right of the square ("stop")
    • VisIt starts animating in time.
  3. Click the square to stop the animation.

[edit] 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.
  • The alternate way is to use Python scripting.
    • With Python, you would add "SaveWindow" calls for each frame.

To use the movie wizard:

  1. Go to File->Save Movie
  2. Select new simple movie
  3. Change the format to an image format
    • MPEG encoding is hard to support. You will get the best results by saving images, then encoding to a movie with a separate tool.
    • Never select the other movie formats
  4. Click on the right arrow and then click next.
  5. 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.