SoTransferFunctiontransferFunctionId Property |
This field allows the use of multiple transfer functions.
Namespace: OIV.LDM.Nodes
By default all transfer function nodes are initialized to a transfer function id of 0. If you want to use multiple transfer functions, a different id must be assigned to each transfer function. The transfer function id can be used in shader programs (see OIV.VolumeViz.Nodes.SoVolumeShader) to access one of multiple transfer funcions and can also be used to associate a transfer function with a volume mask (see OIV.VolumeViz.Nodes.SoVolumeMask). Note that, unlike SoDataSet/SoVolumeData, this value is NOT a GL texture unit number. Therefore it is possible (but not recommended) to use id values starting at 0. The OIV.VolumeViz.Nodes.SoVolumeData dataSetId values should start at 1, so generally it's best to be consistent and use the same value as the data set that this TF corresponds to, which usually means starting the numbering at 1. Note that whatever values you assign, if you create a custom GLSL shader function, you must use the same values when you call VVizTransferFunction() in your shader function.
All active transfer functions are combined into a single 2D texture by "stacking" them in order according to their ids. By default this texture is bound to OpenGL texture unit 0. It is possible to change the texture unit used for transfer functions by setting the preferences variable IVVR_TF_TEX_UNIT (see OIV.Inventor.SoPreferences).
Since Open Inventor 8.1, functions are provided which allow convenient access to a specific transfer function in a GLSL fragment shader. Although direct access is still possible, we strongly recommend using the GLSL convenience functions provided by VolumeViz to ensure compatibility with future rendering features:
vec4 VVizTransferFunction( float pos, int tfId ) Returns the color at the normalized position pos in the transfer function tfId .
vec4 VVizTransferFunction( float frontVoxel, float backVoxel, int tfId ) Returns the preintegrated color between frontVoxel and backVoxel in the transfer function tfId .
For direct access, the texture S coordinate specifies the entry in the color map and the texture T coordinate specifies which color map to use. If N is the number of color maps used, the rules are:
Like all texture coordinates, the s and t coordinates range from 0 to 1.
The transferFunctionId ranges from 0 to N-1.
To access a specific transfer function, the t value passed must be between [ transferFunctionId / N, ( transferFunctionId + 1 ) / N ]
Note |
---|
Field available since Open Inventor 6.0 |