! Page under construction !
The goal of this page is to document the shader replacement functionality available in vtkGPUVolumeRaycastMapper starting with version (9?) of VTK.
Fragment shader variables
Global variables
Variables prefixed with "g_"
Name
|
Type
|
Space
|
Description
|
g_dataPos |
vec3 |
Normalized volume |
Current ray integration position in texture space defined by the first volume, recomputed at every iteration along the ray
|
g_terminatePos |
vec3 |
Normalized volume |
Position where we terminate ray integration in texture coordinates of the first volume. This position is computed from the input depth buffer.
|
g_eyePosObj |
vec4 |
data |
position of the camera in the data space (space of first volume)
|
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
|
ip_inverseTextureDataAdjusted |
mat4 |
Volume 0 to Texture 0 |
Transforms from data space (volume 0) to texture space (volume 0). The matrix is adjusted to take into account the offset between geometry and texture space.
|
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.
Input volumes
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).
|
Other textures
Name
|
Type
|
Space
|
Description
|
in_noiseSampler |
sampler2D |
None |
Texture that contains noise and that is used to slightly modify the path of each ray an avoid sampling artefacts.
|
in_depthSampler |
sampler2D |
None |
Texture that contains the depth buffer generated by the rendering of polygonal geometry.
|
Camera
Name
|
Type
|
Space
|
Description
|
in_cameraPos |
vec3 |
World |
Same as vtkCamera::GetPosition().
|
in_projectionMatrix |
mat4 |
World to Clip |
Projection matrix including model view. Transform vertices from world space to clip space.
|
in_inverseProjectionMatrix |
mat4 |
Clip to World |
Inverse of projection matrix including model view. Transform vertices from world space to clip space.
|
in_modelViewMatrix |
mat4 |
World to Camera |
Transforms vertices from world space to camera space
|
in_inverseModelViewMatrix |
mat4 |
Camera to World |
Transforms vertices from camera space to World space
|
in_windowLowerLeftCorner |
vec2 |
screen pixels |
Lower left corner of the viewport
|
in_inverseOriginalWindowSize |
vec2 |
screen pixels |
1/(viewport size).
|
in_inverseWindowSize |
vec2 |
screen pixels |
1/(viewport size).
|
Vertex shader variables
Uniform variables
Name
|
Type
|
Space
|
Description
|
in_cellSpacing |
vec3[n] |
data? |
Distance between voxels for each volume in volume space
|
in_modelViewMatrix |
mat4 |
camera to world |
Transforms between camera space and world space
|
in_projectionMatrix |
mat4 |
camera to clip |
Projects data from camera space to clip space
|
in_volumeMatrix |
mat4[n] |
data to world |
Transforms bounding box of each of the volumes to world coordinates
|
in_inverseTextureDatasetMatrix |
mat4[n] |
data to texture |
Transforms from data space to texture space for each volume
|
in_cellToPoint |
mat4[n] |
--- |
Corrects for offset between points and OpenGL texture coordinates for each volume
|