[vtk-developers] Volume Rendering Changes

Lisa S. Avila lisa.avila at kitware.com
Tue Mar 19 00:40:31 EST 2002


Hello Everyone,

I'd like to propose some API changes for volume rendering. Actually, the
stuff I need to change is currently broken at the moment (at least it
doesn't function as intended) so I doubt anyone is successfully using it...

Currently you can turn shading on in the volume property and the gradients
will be generated for you - this will not change.

Currently you can specify the gradient estimator to use (there is only one
type in VTK) - the way in which this is done will change.

The current code may look like this:

vtkFiniteDifferenceGradientEstimator grad

vtkVolumeRayCastMapper mapper1
mapper1 SetInput [reader GetOutput]
mapper1 SetGradientEstimator grad

vtkVolumeTextureMapper2D mapper2
mapper2 SetInput [reader GetOutput]
mapper2 SetGradientEstimator grad

This is intended to share the gradients between the two mappers, which used
to work but recent changes to move entirely over the vtkImageData introduced
a clipper between the input specified to the mapper and the actual input of
the mapper. This means the one gradient estimator is being toggled between
two different inputs and therefore normals are thrashing.

I need to overhaul the gradient estimator due to the upcoming changes for
rendering multiple component volumes. To make this flexible enough, and to
bring the gradient estimators more inline with VTK, I am changing the
gradient estimators to be imaging filters, with two outputs (unsigned short
encoded gradient directions and unsigned char gradient magnitudes). You
would then set not the gradient estimator on the mapper, but the gradients
themselves.  For example:

vtkFiniteDifferenceGradientEstimator grad
grad SetInput [reader GetOutput]

vtkVolumeRayCastMapper mapper1
mapper1 SetInput [reader GetOutput]
mapper1 SetGradientDirectionInput [grad GetGradientDirectionOutput]
mapper1 SetGradientMagnitudeInput [grad GetGradientMagnitudeOutput]

vtkVolumeTextureMapper2D mapper2
mapper2 SetInput [reader GetOutput]
mapper2 SetGradientDirectionInput [grad GetGradientDirectionOutput]
mapper2 SetGradientMagnitudeInput [grad GetGradientMagnitudeOutput]


Obviously this provides much more flexibility than the previous method
(since filters may be applied to the data before passing it into the
gradient estimator, or even after it comes out to subsample for a lower
resolution mapper) and solves the thrashing problem.

Again, the person who is using just one volume mapper for their data will
never need to create the gradient estimator - it will be created
automatically using the mapper's input.

Any objections to these changes?

Lisa





More information about the vtk-developers mailing list