Class SoMultiDataSeparator
- java.lang.Object
-
- All Implemented Interfaces:
SafeDisposable
public class SoMultiDataSeparator extends SoSeparator
Separator for combining multiple data sets. TheSoMultiDataSeparatornode allows you to combine multiple data sets.This is the correct method for combining multiple data sets. Combining multiple data sets without inserting them under an
SoMultiDataSeparatornode may produce incorrect results and should be avoided.Each data set is represented by an
SoDataSetnode (typically anSoVolumeDatanode). Combining is enabled by anSoDataCompositornode for CPU combining or anSoVolumeShadernode for GPU combining. A common use of GPU combining is to implement co-blending of multiple volumes, in other words using a fragment shader to combine the color and/or intensity values of the voxels.Some rules must be followed when doing render or data compositing:
- Each
SoVolumeDatanode must have a uniqueSoDataSet.dataSetId.
- All the
SoVolumeDatanodes to be composited, as well as the compositing node (e.g.SoVolumeShaderfor slices orSoVolumeRenderingQualityfor volumes) and the rendering node (e.g.SoVolumeRender), must be under anSoMultiDataSeparatornode. - The
SoVolumeDatanodes to be composited must be all scalar data sets or all RGBA data sets. To composite scalar and RGBA data sets under the sameSoMultiDataSeparator, set the usePalettedTexture field to false in the scalar dataset'sSoVolumeDatanode to force the scalar data to be converted into RGBA data. - An
SoVolumeDatanode used in a data compositing scheme must not be inserted multiple times in the scene graph. Use another volume data node pointing to the same file. - All transfer functions must have the same 'colorMapType' and must have the same number of entries in the colormap.
Each
SoVolumeDatanode has its own resource settings (see fieldSoDataSet.ldmResourceParameters). In the case of combining multi data, data with the same characteristics (volume size, tile size and same location in world coordinates) aggregate their resources to display the best resolution possible. For example with 4 datasets VD1, VD2, VD3, VD4 that have same resource parameters but not SoLMDRessourceParameters.max2DTexMemory:- VD1: max2DTexMemory = 1GB
- VD2: max2DTexMemory = 1GB
- VD3: max2DTexMemory = 9GB
- VD4: max2DTexMemory = 1GB If VD1 and VD3 have the same characteristics and VD2 and VD4 have other identical characteristics, in this case VD1 and VD3 will share 10 GB of 2D texture memory while VD2 and VD4 will share 2 GB. The same rule applies for other ldm resource parameters.
GPU combining must be implemented in a shader program written in the standard GLSL language. Use a
SoVolumeShadernode to specify the shader program. The shader source code is loaded using (for example) aSoFragmentShaderobject. You can specify uniform parameters for the shader using theSoShaderParametersubclasses. SeeSoVolumeShaderfor more information about the shader function library provided by VolumeViz.It is possible to compose datasets that have different dimensions, tile sizes and transformations.
In order to help fetch the correct data values in custom shaders, the included VolumeViz/vvizStructure.h shader provides texture coordinate conversion functions.
SeeSoVolumeShaderfor more details.Each data set typically has a
SoDataRangenode and aSoTransferFunctionnode to define the mapping from data values to color values. For eachSoVolumeData, a separate 3D texture is generated and sent to the GPU. You can generate 3D textures with different precisions (8-bit or 12-bit) according to theSoDataSet.texturePrecisionfield. TheSoDataSet.dataSetIdfield determines the texture unit used for each data. All colormaps are aggregated into a single 2D texture.A custom fragment shader can retrieve the voxel's data value from each 3D texture using the GLSL VolumeViz function:
A custom fragment shader can lookup the color/intensity for each data value from the appropriate colormap, using the GLSL VolumeViz function:VVIZ_DATATYPE value = VVizGetData( dataSetId, texCoord );
A custom fragment shader can then compute (using custom blending functions) the actual color for the voxel and output that color using the GLSL VolumeViz function:vec4 color = VVizTransferFunction( value, colorMapId ); VVizOutputColor( color ): EXAMPLE The following code shows how to do multidata rendering using an
SoVolumeShadernode to combine values for anSoVolumeRendernode. Given twoSoVolumeDatanodes ds1 and ds2:SoVolumeShader volumeShader = new SoVolumeShader(); SoVolumeData volumeData1 = new SoVolumeData(); volumeData1.dataSetId.setValue( 0 ); SoDataRange dataRange1 = new SoDataRange(); dataRange1.dataRangeId.setValue( 0 ); SoTransferFunction colorMap1 = new SoTransferFunction(); SoVolumeData volumeData2 = new SoVolumeData(); volumeData2.dataSetId.setValue( 1 ); SoDataRange dataRange2 = new SoDataRange(); dataRange2.dataRangeId.setValue( 1 ); SoTransferFunction colorMap2 = new SoTransferFunction(); SoVolumeRender volumeRender = new SoVolumeRender(); SoMultiDataSeparator multiDataSep = new SoMultiDataSeparator(); multiDataSep.addChild( volumeShader ); // Shader to combine volumes multiDataSep.addChild( volumeData1 ); multiDataSep.addChild( dataRange1 ); multiDataSep.addChild( colorMap1 ); multiDataSep.addChild( volumeData2 ); multiDataSep.addChild( dataRange2 ); multiDataSep.addChild( colorMap2 ); multiDataSep.addChild( volumeRender ); root.addChild(multiDataSep); - See Also:
SoDataSet,SoVolumeData,SoDataCompositor,SoVolumeShader
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoSeparator
SoSeparator.Cachings, SoSeparator.FastEditings, SoSeparator.RenderUnitIds
-
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
-
Fields inherited from class com.openinventor.inventor.nodes.SoSeparator
boundingBoxCaching, fastEditing, pickCulling, renderCaching, renderCulling, renderUnitId
-
Fields inherited from class com.openinventor.inventor.nodes.SoGroup
boundingBoxIgnoring
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoMultiDataSeparator()Constructor.
-
Method Summary
-
Methods inherited from class com.openinventor.inventor.nodes.SoGroup
addChild, findChild, getChild, getNumChildren, insertChild, removeAllChildren, removeChild, removeChild, replaceChild, replaceChild
-
Methods inherited from class com.openinventor.inventor.nodes.SoNode
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
-
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
-
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-