[vtkusers] Updating color transfer function for GPU volume

Eric Foo foo at iastate.edu
Mon Dec 20 20:03:12 EST 2010


Hi all,

Does anyone know how I can update the color transfer function for a vtkOpenGLGPUVolumeRayCastMapper type volume?

The volume is constructed like so:

_volumeProperty = vtkVolumeProperty::New();
_volumeProperty->SetColor(_color);
_volumeProperty->SetScalarOpacity(_opacity);
_volumeProperty->SetInterpolationTypeToLinear();
_volumeProperty->ShadeOff();

_gpuVolumeMapper = vtkOpenGLGPUVolumeRayCastMapper::New();
_gpuVolumeMapper->SetImageSampleDistance(_imageSampleDistance);
_gpuVolumeMapper->SetSampleDistance(_sampleDistance);
_gpuVolumeMapper->AutoAdjustSampleDistancesOff();
_gpuVolumeMapper->SetInput(_voxels);

_volume = vtkVolume::New();
_volume->SetProperty(_volumeProperty);
_volume->SetMapper(_gpuVolumeMapper);

To swap between different predefined color transfer functions, I call:

_volumeProperty->SetColor(someNewColor);

This is where the problem starts. The only way the volume will update to the new color is if I delete the current volume mapper and then recreate it with the new color transfer function, which is bad for performance. I've tried calling _volume->Update() and _gpuVolumeMapper->Update(), which doesn't seem to work. 

Any help or ideas would be appreciated. Thanks in advance!

eric


More information about the vtkusers mailing list