public static enum SoVolumeShader.ShaderPositions extends java.lang.Enum<SoVolumeShader.ShaderPositions> implements IntegerValuedEnum
shaderObject
.
In other words, use these enumeration values for the first parameter of the set1Value() method when setting a custom shader in the SoVolumeShader
node.Enum Constant and Description |
---|
CLIPPING_FUNCTION
This method can be used to implement a custom clipping algorithm.
|
CUSTOM_SHADER
This position and all subsequent positions CUSTOM_SHADER+x are freely available for user-defined shaders.
|
DATA_COMBINE_FUNCTION
This shader is used for GPU multi-data composition.
|
FRAGMENT_COMPUTE_COLOR
This shader is used to compute the current fragment color.
|
FRAGMENT_MAIN
Main fragment shader used for rendering.
|
GEOMETRY_MAIN
The main geometry program used for rendering.
|
GET_DATA_FUNCTION
This shader is used to access datasets.
|
VERTEX_MAIN
Main vertex shader used for rendering.
|
VERTEX_POSTPROCESSING
Method called at the end of the VolumeViz vertex shader stage.
|
Modifier and Type | Method and Description |
---|---|
static SoVolumeShader.ShaderPositions |
fromValue(int val)
Deprecated.
Use
valueOf(int) instead. |
int |
getValue()
Returns the integer value of the enum constant.
|
static SoVolumeShader.ShaderPositions |
valueOf(int val)
Returns the enum constant of this type with the specified integer value
|
static SoVolumeShader.ShaderPositions |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static SoVolumeShader.ShaderPositions[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SoVolumeShader.ShaderPositions GEOMETRY_MAIN
SoVolumeRender
. If you must use this slot, set the raycasting
field to false. public static final SoVolumeShader.ShaderPositions DATA_COMBINE_FUNCTION
VVIZ_DATATYPE VVizCombineData(in vec3 dataCoord);
The subtraction of two volumes can be written in GLSL like this:
// !oiv_include <VolumeViz/vvizGetData_frag.h> // !oiv_include <VolumeViz/vvizCombineData_frag.h> 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; }
First volume | Second volume | Subtraction |
![]() | ![]() | ![]() |
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.
public static final SoVolumeShader.ShaderPositions GET_DATA_FUNCTION
VVIZ_DATATYPE VVizGetData(in VVizDataSetId dataset, in vec3 dataCoord);
The default implementation is defined as follows:
// !oiv_include <VolumeViz/vvizGetData_frag.h> // Default 3D DATA interpolation 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:
// !oiv_include <VolumeViz/vvizGetData_frag.h> 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); }
Non filtered data | Filtered data |
![]() | ![]() |
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.
public static final SoVolumeShader.ShaderPositions FRAGMENT_COMPUTE_COLOR
It must contain an application defined compute fragment color function whose prototype is:
// For an SoVolumeRender node vec4 VVizComputeFragmentColor(in VVizDataSetId dataset, in vec3 rayDir, inout VVizVoxelInfo voxelInfoFront, in VVizVoxelInfo voxelInfoBack, in int mask);
// For all other VolumeViz shape nodes (SoOrthoSlice, SoObliqueSlice, SoVolumeSkin ...) 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:
// !oiv_include <VolumeViz/vvizGetData_frag.h> // !oiv_include <VolumeViz/vvizTransferFunction_frag.h> 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; } // Implement VVizComputeFragmentColor for slice nodes vec4 VVizComputeFragmentColor(VVIZ_DATATYPE vox, vec3 texCoord) { return blend(texCoord); } // Implement VVizComputeFragmentColor for SoVolumeRender vec4 VVizComputeFragmentColor(VVizDataSetId data, vec3 rayDir, inout VVizVoxelInfo voxelInfoFront, in VVizVoxelInfo voxelInfoBack, int maskId) { return blend(voxelInfoFront.texCoord); }
See VolumeVizFragmentShaders for more details.
public static final SoVolumeShader.ShaderPositions VERTEX_MAIN
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.
public static final SoVolumeShader.ShaderPositions FRAGMENT_MAIN
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.
public static final SoVolumeShader.ShaderPositions VERTEX_POSTPROCESSING
See VolumeVizVertexShaders for more details.
public static final SoVolumeShader.ShaderPositions CLIPPING_FUNCTION
When applying a custom clipping function with SoVolumeRenderingQuality.voxelizedRendering
= true, the voxels will be hollow.
public static final SoVolumeShader.ShaderPositions CUSTOM_SHADER
public static SoVolumeShader.ShaderPositions[] values()
for (SoVolumeShader.ShaderPositions c : SoVolumeShader.ShaderPositions.values()) System.out.println(c);
public static SoVolumeShader.ShaderPositions valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null@Deprecated public static SoVolumeShader.ShaderPositions fromValue(int val)
valueOf(int)
instead.public static SoVolumeShader.ShaderPositions valueOf(int val)
public int getValue()
IntegerValuedEnum
getValue
in interface IntegerValuedEnum
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com