Skip to content

ENH: Added new node types to support custom volume rendering shader code

With this PR, we introduce a mechanism to manage and store custom modifications and variables of volume rendering shaders. This pull request requires changes to VTK contained in this other pull request:

This change in VTK separates the management of vtkUniforms and shader replacements from the volume mapper and stores all these properties in a new class (vtkShaderProperty), which is stored in vtkVolume. On the Slicer side, I have created wrappers classes to manage vtkShaderProperty:

  • vtkMRMLShaderPropertyNode
  • vtkMRMLShaderPropertyStorageNode
  • qSlicerShaderPropertyReader

The advantages of the new system are twofold:

  • Custom shader modifications are contained in a class that is shared by all displayable managers, i.e. your custom shader effect is visible in both the 3D view and the VR view.
  • Custom modifications to the shaders are now saved with the mrml scene (in a json file with extension .sp), which means that GLSL experts can modify the shader code and variables, send the scene to non-programmers (e.g. clinicians) who will be able to load and visualize the new rendering effect by simply loading the scene.

@lassoan @pieper @cpinter @jcfr please let me know what you think.

Merge request reports