VisIt provides a Pseudocolor plot to map a single scalar field to color values that your eye can easily distinguish. The Volume plot uses scalar and opacity fields to create images. It is possible to use expressions and a Truecolor plot to create and image that simulates a Volume plot. This can be useful for 2D overlays of data where a Volume plot is not necessarily applicable due to its 3d nature.
We'll use 2 color expressions to help design the color variable for the Truecolor plot.
- colorlookup(expression, colortable) : Return the color that expression would produce using colortable. The colortable argument is a string like "hot".
- color4(c0, c1, c2, c3) : Return a color vector variable assembled from the inputs. The inputs should all have values in [0,255].
We'll use the curv2d.silo example dataset to create a new color variable that gets is color based on d and its opacity based on u.
opacity = 255. * ((u + 1.) / 2.) c = colorlookup(d, "hot") c0 = array_decompose(c, 0) c1 = array_decompose(c, 1) c2 = array_decompose(c, 2) newcolor = color4(c0, c1, c2, opacity)
- Be sure to set c and newcolor to Vector Mesh Variable in the VisIt Expression window.
- We use array_decompose instead of the  operator because that latter does not work with 2D data with indices other than 0 or 1.
- You'll need to know the extents for the variable that you use to create the opacity variable so you can map it into the range [0,255].
|Pseudocolor plot of d.
||Pseudocolor plot of u.|
|Truecolor of the newcolor variable.|
Using Images as Color Channels
Images are usually composed of RGB color channels. Using VisIt, you can create a new image where the data for each color channel comes from a separate image. For example, all of the data for the red channel comes from one image, all of the data for the green channel comes from a second image, and so on. In this example, we combine separate red.png, green.png, and blue.png image files into a color expression that can be plotted using VisIt's Truecolor plot. Open the red.png file first and create the following expressions in the Expression window:
R = red G = conn_cmfe(<green.png:green>,ImageMesh) B = conn_cmfe(<blue.png:blue>,ImageMesh) RGB = color(R,G,B)
- Be sure to set the RGB expression's type to Vector Mesh Variable so it appears in the Truecolor plot's variable list.
- Plot the RGB variable using the Truecolor plot.