VTK/ProgrammableMultiVolumeRendering: Difference between revisions
Simon.Drouin (talk | contribs) |
Simon.Drouin (talk | contribs) |
||
Line 38: | Line 38: | ||
= Uniform variables = | = 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. | 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 == | |||
{| class="wikitable" | {| class="wikitable" | ||
!Name | !Name | ||
Line 53: | Line 55: | ||
|- | |- | ||
|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). | |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 == | |||
{| class="wikitable" | |||
!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_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. | |in_depthSampler || sampler2D || None || Texture that contains the depth buffer generated by the rendering of polygonal geometry. | ||
|} | |||
== Camera == | |||
{| class="wikitable" | |||
!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). | |||
|} | |} |
Revision as of 13:54, 8 October 2018
! 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.
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). |