SoVolumeShaderShaderPositions Enumeration |
Specifies the position of the shader pipeline stages in the field shaderObject.
Namespace: OIV.VolumeViz.Nodes
Member name | Value | Description | |||||||
---|---|---|---|---|---|---|---|---|---|
GEOMETRY_MAIN | 0 | The main geometry program used for rendering. Notes: Defining a custom GEOMETRY_MAIN slot is only supported for compatibility. It is not compatible with the raycasting volume rendering technique that is now the default for SoVolumeRender. If you must use this slot, set the raycasting field to false. | |||||||
DATA_COMBINE_FUNCTION | 1 | This shader is used for GPU multi-data composition. It must contain an application defined data combining function whose prototype is: VVIZ_DATATYPE VVizCombineData(in vec3 dataCoord); The subtraction of two volumes can be written in GLSL like this: uniform VVizDataSetId dataId1;
uniform VVizDataSetId dataId2;
VVIZ_DATATYPE VVizCombineData(vec3 tcoord)
{
VVIZ_DATATYPE d1 = VVizGetData(dataId1, tcoord);
VVIZ_DATATYPE d2 = VVizGetData(dataId2, tcoord);
return d1-d2;
}
NOTE: On the GPU, voxel values are always returned as a normalized value in the range 0..1. If the actual voxel value is needed, the shader function must compute that value using the current data range (see SoDataRange). The application must pass the data range to the shader function as a uniform parameter. See VolumeVizFragmentShaders for more details. | |||||||
GET_DATA_FUNCTION | 2 | This shader is used to access datasets. It must contain an application defined data accessor function whose prototype is: VVIZ_DATATYPE VVizGetData(in VVizDataSetId dataset, in vec3 dataCoord); The default implementation is defined as follows: VVIZ_DATATYPE VVizGetData(VVizDataSetId tex, vec3 tcoord)
{
return VVizGetRawData(tex, tcoord);
} This function can be used to apply filters on each data volume. The following example shows how to make a smoothing filter which will remove some noise: VVIZ_DATATYPE VVizGetData(in VVizDataSetId dataset, vec3 tcoord) { vec3 voxelDim = VVizGetVoxelDimensions(dataset); vec3 du = vec3(voxelDim[0], 0., 0.); vec3 dv = vec3(0., voxelDim[1], 0.); vec3 dw = vec3(0., 0., voxelDim[2]); return 1./6.*(VVizGetRawData(dataset, tcoord-du).w+VVizGetRawData(dataset, tcoord+du).w+ VVizGetRawData(dataset, tcoord-dv).w+VVizGetRawData(dataset, tcoord+dv).w+ VVizGetRawData(dataset, tcoord-dw).w+VVizGetRawData(dataset, tcoord+dw).w); }
NOTE: On the GPU, voxel values are always returned as a normalized value in the range 0..1. If the actual voxel value is needed, the shader function must compute that value using the current data range (see SoDataRange). The application must pass the data range to the shader function as a uniform parameter. See VolumeVizFragmentShaders for more details. | |||||||
FRAGMENT_COMPUTE_COLOR | 3 | This shader is used to compute the current fragment color. Note: VVizComputePreIntegrated should only be called when SoVolumeRendering.renderMode is set to VOLUME_RENDERING (the default). It is not appropriate for MIN, MAX, etc composition. It must contain an application defined compute fragment color function whose prototype is: vec4 VVizComputeFragmentColor(in VVizDataSetId dataset, in vec3 rayDir, inout VVizVoxelInfo voxelInfoFront, in VVizVoxelInfo voxelInfoBack, in int mask); vec4 VVizComputeFragmentColor(in VVIZ_DATATYPE vox, in vec3 dataCoord); This function can be used to do co-blending on multiple data volumes. The following example shows how to blend two volumes: uniform VVizDataSetId data1; uniform VVizDataSetId data2; vec4 blend(in vec3 texCoord) { VVIZ_DATATYPE index1 = VVizGetData(data1, texCoord); vec4 data1Color = VVizTransferFunction(index1, 0); VVIZ_DATATYPE index2 = VVizGetData(data2, texCoord); vec4 data2Color = VVizTransferFunction(index2, 1); // Color modulated by intensity from volume2 data2Color.rgb *= data1Color.r; data2Color.a *= data1Color.a; return res; } vec4 VVizComputeFragmentColor(VVIZ_DATATYPE vox, vec3 texCoord) { return blend(texCoord); } vec4 VVizComputeFragmentColor(VVizDataSetId data, vec3 rayDir, inout VVizVoxelInfo voxelInfoFront, in VVizVoxelInfo voxelInfoBack, int maskId) { return blend(voxelInfoFront.texCoord); } See VolumeVizFragmentShaders for more details. NOTE: enumeration value available since Open Inventor 9.0 | |||||||
VERTEX_MAIN | 4 | Main vertex shader used for rendering. This stage should not be redefined unless you know exactly what you are doing. If the goal of your application is to compute specific varying attributes to pass to the fragment shader you should use the shaderPosition slot named VERTEX_POSTPROCESSING. Notes: Defining a custom VERTEX_MAIN slot is only supported for compatibility. It is not compatible with the raycasting volume rendering technique that is now the default for SoVolumeRender. If you must use this slot, set the raycasting field to false. See VolumeVizVertexShaders for more details. | |||||||
FRAGMENT_MAIN | 5 | Main fragment shader used for rendering. This stage should not be redefined unless you know exactly what you are doing. If the goal of your application is to blend colors or add effects to the existing pipeline you should use the shaderPosition slot named FRAGMENT_COMPUTE_COLOR. Notes: Defining a custom FRAGMENT_MAIN slot is only supported for compatibility. It is not compatible with the raycasting volume rendering technique that is now the default for SoVolumeRender. If you must use this slot, set the raycasting field to false. See VolumeVizFragmentShaders for more details. | |||||||
VERTEX_POSTPROCESSING | 6 | Method called at the end of the VolumeViz vertex shader stage. This shader allows the application to generate custom varying values at the vertex shader stage for use in the fragment shader stage. See VolumeVizVertexShaders for more details. NOTE: enumeration value available since Open Inventor 9.0 | |||||||
CLIPPING_FUNCTION | 7 | This method can be used to implement a custom clipping algorithm. Note that when using this method, it may not always be possible for VolumeViz to correctly manage slicing artifacts. You have to use SoVolumeRender.samplingAlignement = BOUNDARY_ALIGNED to avoid slicing artifacts. When applying a custom clipping function with SoVolumeRenderingQuality.voxelizedRendering = true, the voxels will be hollow. NOTE: enumeration value available since Open Inventor 9.7 | |||||||
CUSTOM_SHADER | 64 | This position and all subsequent positions CUSTOM_SHADER+x are freely available for user-defined shaders. NOTE: enumeration value available since Open Inventor 9.0 |
In other words, use these enumeration values for the first parameter of the set1Value() method when setting a custom shader in the SoVolumeShader node.