Skip to content

Support overlapping volumes through multiple inputs in GPUVolumeMapper

Alvaro Sanchez requested to merge alvaro.sanchez/vtk:overlapping-volumes into master

When multiple inputs are rendered through the same mapper, it is possible to composite the overlapping areas correctly. Inputs are connected directly to the mapper and its parameters (transfer functions, transformations, etc.) are specified through a standard vtkVolume instance. These vtkVolume instances are to be registered in a special vtkProp3D, vtkMultiVolume. vtkMultiVolume represents a 3D space containing a set of vtkVolume instances which could be but are not necessarily overlapping, this instance computes the bounding-box containing all of its registered vtkVolumes.

vtkGPUVolumeRayCastMapper prepares and keeps track of the inputs as they are allowed to be disconnected at any time. vtkOpenGLGPUVRCMapper's internals particular to an input (vtkVolumeTexture, OpenGL helper instances, etc.) have been promoted to a separate class vtkVolumeInputHelper. Other internals (such as ComputeBounds, ComputePointToCellMatrix and related variables) have been moved into vtkVolumeTexture as they are inherent to the texture definition (or some of its blocks during streaming).

A separate code path is used when rendering multiple-inputs in order to facilitate the co-existance of these two modes (single/multiple), due to current feature incompatibilities with multiple inputs (e.g. texture-streaming, cropping, etc.). Splitting DoGPURender into various smaller routines improves code reusability between these two paths.

A limited set of the mapper features are currently supported for multiple inputs:

  • Transfer functions: these are defined separately for per input.

    • 1D color
    • 1D scalar opacity
    • 1D gradient magnitude opacity
    • 2D scalar-gradient magnitude
  • Point and cell data

    • With the limitation that all of the inputs are assumed to share the same name/id.
  • Composite blending (front-to-back)

Test cases:

  • TestGPURayCastMultiVolumeOverlapping
  • TestGPURayCastMultiVolumeTransfer2D
  • TestGPURayCastMultiVolumeAddRemove
  • TestGPURayCastMultiVolumeCellData

petct

Edited by Alvaro Sanchez

Merge request reports