[vtkusers] Opacity and vtkColorTransferFunction

Wen-Hsing Chiang wchiang at iesinet.com
Fri Aug 15 15:22:46 EDT 2003


Hi,
I am getting a problem in making an actor translucent. The color of the
actor is mapped to the scalar values by vtkColorTransferFunction. I
tried to set a rather small opacity value (0.1) to the actor, but it
remains opaque. The problem does not occur when using vtkLookupTable.
Since I need to map particular values to designated colors,
vtkLookupTable is not suitable.

Here is the suedo code, can anyone tell me what is wrong? Thanks! 

vtkPolyData * pPolyData = vtkPolyData::New()
//set up pPolyData here....

vtkColorTransferFunction * pColorTransferFunction =
vtkColorTransferFunction::New();
for (int i = 0; i < m_iNumberOfColors; i++)	
{
    pColorTransferFunction->AddRGBPoint(value[i], red[i], green[i],
blue[i]);
}
// pColorTransferFunction->SetAlpha(0.1) does not work also!!

vtkPolyDataMapper * pPolyDataMapper	= vtkPolyDataMapper::New();
pPolyDataMapper->SetInput(pPolyData);
pPolyDataMapper->SetLookupTable(pColorTransferFunction);

vtkActor * pActor = vtkActor::New();
pActor->SetMapper(pPolyDataMapper);	
pActor->GetProperty()->SetOpacity(.1); 
......



Wen-Hsing Chiang, Ph.D.
Integrated Environmental Services, Inc.
20 Fairbanks, Suite 187
Irvine, CA 92618
USA
tel. 949.460.7003
fax. 949 460 7019

************************** PRIVACY NOTICE ****************************

The information contained in this communication is confidential and is
intended only for the individual or entity to whom it is addressed.
Any unauthorized use, distribution, copying or disclosure of this
communication is prohibited.  If you have received this communication
in error, please contact the sender immediately using the reply mail
function and then delete the message.

Thank you, Integrated Environmental Services, Inc. www.iesinet.com
**********************************************************************
  







More information about the vtkusers mailing list