[vtkusers] colormaps

Roni Choudhury aichoudh at midway.uchicago.edu
Thu Oct 9 10:23:36 EDT 2003


hi everyone.  i have a question about colormaps and how they are drawn in
vtk.

i'm using vtkUnstructuredGrids to respresent meshes with functions plotted
on them.  I define a colormap that ranges from red (low values) to blue
(high values) and use it to plot functions.  If I create an unstructured
grid of a single triangle, and put values of 1, 2, and 3 at the vertices,
and plot using my colormap, I get a very pretty triangle that is red at
the 1-vertex, green and the 2-vertex, and blue at the 3-vertex.  That all
is correct, but I'm concerned about what happens at midpoints of the
triangle.

The function is linear (it is defined by three points in the
plane).  Therefore, on the edge between the 1-vertex and the 3-vertex, you
expect to find a value of 2 somewhere.  But the colormap behaves
strangely.  It seems to interpolate color across the *color wheel* instead
of my colormap, so instead of green halfway between the 1- and 3-vertices,
i get a sort of muddy gray.  The same goes for the other edge midpoints,
and also the center of the triangle.

Does anyone know a way to make an unstructured grid interpolate its values
along its edges and faces, and use the colormap to map *those*
interpolated values to colors?  It would be mighty helpful for my
project.  Thanks for any help!

roni




More information about the vtkusers mailing list