VTK/ProgrammableMultiVolumeRendering

From KitwarePublic
Jump to navigationJump to search

! Page under construction !

The goal of this page is to document the shader replacement functionality available in vtkGPUVolumeRaycastMapper starting with version (9?) of VTK.


Global variables

Variables prefixed with "g_"

Name Type Space Description
g_dataPos vec3 Normalized volume Current ray integration position in texture space (first volume?), recomputed at every iteration along the ray
g_fragColor vec4 None Variable where color is accumulated along the ray
g_srcColor vec4 None Result of the color computation at g_dataPos (current position).
g_exit bool None Terminate ray integration.
g_skip bool None Skip computation of current iteration step if true

Interpolated variables

Variables prefixed with "ip_". These variables contains values computed in the vertex shader stage and interpolated for each fragment.

Name Type Space Description
ip_textureCoords vec3 Normalized volume Interpolated texture coord
ip_vertexPos vec3 ? Interpolated vertex position at current fragment

Uniform variables

Variables prefixed with "in_". The value of these variables is set from the c++ code by the mapper. It is now possible for users to define custom uniform variables by using the class vtkOpenGLUniforms. The vtkOpenGLGPURaycastMapper class contains one instance of this class for each type of shader. The objects can be accessed with vtkOpenGLGPURaycastMapper::GetFragmentCustomUniforms and vtkOpenGLGPURaycastMapper::GetVertexCustomUniforms functions. They allow to define uniform variable of any GLSL type and set their values at any moment. These variables can then be used in custom shader code.

Name Type Space Description
in_volume sampler3D[n] None One sampler for each of the input volumes (n). Allows to sample the 3D texture that contains the volume
in_volume_scale vec4[n] None Scale to apply to the sampled scalar value of each input volume
in_volume_bias vec4[n] None Offset to apply to the sampled scalar value of each input volume
in_noOfComponents int None In the single input volume case, it is possible to feed the mapper with a volume that has multiple components per voxel. This variable contains the number of components.
in_independentComponents int None When a single volume contains multiple components: whether we should treat components as independent. This affects, amongst other things, if a single gradient is computed for all components (dependent) or if one gradient is computed for each component (independent).