[vtkusers] Show transparency on vtkScalarBarActor

Alex Southern mrapsouthern at gmail.com
Thu Jul 12 05:22:02 EDT 2012


Hi,

I currently have a scalar bar that shows the colors I have assigned to 
it. I have also assigned the alpha transparency as well. The 
transparency is rendered correctly on the ImageActor also in the scene.

My problem is that the vtkScalarBarActor does not show the alpha 
transparency. Here is a snippet of how I set up the vtkScalarBarActor. 
The result is that the vtkScalarBarActor ignores the alpha values.

Is there some way to make the vtkScalarBarActor use the alpha values so 
that those values blend into renderer background color?

Thanks
Al.

vtkSmartPointer<vtkLookupTable> table = 
vtkSmartPointer<vtkLookupTable>::New();
// set-up lookup table here.
const int COLORS = 128;
double alpha = 1.0; //opaque
double r;

for (int x = 0; x < COLORS ; x++)
{
         alpha = alpha - (1.0/COLORS);
         r = alpha; //for simplicity red = alpha
         table->SetTableValue(x,r,0.0,0.0,alpha[x]);
}

vtkSmartPointer<vtkScalarBarActor>   scalarBar = 
vtkSmartPointer<vtkScalarBarActor>::New();
scalarBar->SetLookupTable(table);



More information about the vtkusers mailing list