Commit bcf077f1 authored by Sankhesh Jhaveri's avatar Sankhesh Jhaveri

Fix issues with volume rendering for dependent component data

When considering the components of the volume as dependent, the
last component (#1 for 2 component data and #3 for 4 component
data) is passed through the first opacity transfer function, set
with volumeProperty->SetScalarOpacity(0, piecewiseFunction) or
volumeProperty->SetScalarOpacity(piecewiseFunction).

Along the same lines, the gradients are computed based on the
last component scalar values for dependent component data. The
opacity is modulated based on these gradients by passing them
through the first gradient opacity transfer function.
parent 36228cab
......@@ -1216,11 +1216,11 @@ int vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::
// TODO Currently we expect the all of the tables will
// be initialized once and if at that time, the gradient
// opacity was not enabled then it is not used later.
if (!volumeProperty->HasGradientOpacity(component) ||
!this->GradientOpacityTables)
{
return 1;
}
// if (!volumeProperty->HasGradientOpacity(component) ||
// !this->GradientOpacityTables)
// {
// return 1;
// }
vtkPiecewiseFunction* gradientOpacity = 0;
......@@ -1256,7 +1256,7 @@ int vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::
gradientOpacity,
this->ActualSampleDistance,
scalarRange,
volumeProperty->GetScalarOpacityUnitDistance(),
volumeProperty->GetScalarOpacityUnitDistance(component),
#if GL_ES_VERSION_2_0 != 1
filterVal,
#else
......@@ -2907,9 +2907,11 @@ void vtkOpenGLGPUVolumeRayCastMapper::GPURender(vtkRenderer* ren,
{
if (noOfComponents == 2 || noOfComponents == 4)
{
this->Impl->UpdateOpacityTransferFunction(ren, vol, noOfComponents, 0);
this->Impl->UpdateOpacityTransferFunction(ren, vol, noOfComponents,
noOfComponents - 1);
this->Impl->UpdateGradientOpacityTransferFunction(ren, vol,
noOfComponents, 0);
noOfComponents,
noOfComponents - 1);
this->Impl->UpdateColorTransferFunction(ren, vol, noOfComponents, 0);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment