[vtkusers] How to control the colors of my vtkGlyph3D

Thomas Deschamps tdeschamps at lbl.gov
Mon Jul 14 20:44:57 EDT 2003

Dear vtkUsers,

I have a vtkStructuredPoints dataset containing scalars (between 0 and 
255) and vector attributes (normalized).
What I want to do is represent the vectors at each point using a color 
depending on the scalar values.

vtkGlyph3D * myGlyph3D = vtkGlyph3D::New();
    myGlyph3D -> SetInput( this -> inputImage );
    myGlyph3D -> SetVectorModeToUseVector();
    myGlyph3D -> SetScaleModeToScaleByScalar();
    myGlyph3D -> SetColorModeToColorByScalar();

vtkPolyDataMapper myMapper = vtkPolyDataMapper::New();
    myMapper -> SetInput( myGlyp3D -> GetOutput() );

The vectors are indeed displayed and correctly scaled. But the color 
information is in grey levels (i.e. the color of the glyphs are darker 
when the scalars are small, etc... ).
So what I did is to use a vtkLookupTable with the vtkPolyDataMapper. 
Since it was not making any difference, I put the norm of each vectors 
equal to the scalar at that point, and I modified my glyph3D object like 

    myGlyph3D -> SetColorModeToColorByVector();

And now I have only a set of vectors in blue (only). So my question is: 
Who controls the color in this case? The mapper or the glyph3D?

What I would like to know is how to correctly manage color with the 
vtkGlyph3D object and if it is necessary to input a vtkLookUpTable 
object to the mapper, or it should work without it.

Thanks for reading this email.

Thomas (TDeschamps at lbl.gov)

More information about the vtkusers mailing list