Class SoLDMResourceParameters
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.misc.SoBase
-
- com.openinventor.inventor.fields.SoFieldContainer
-
- com.openinventor.ldm.nodes.SoLDMResourceParameters
-
- All Implemented Interfaces:
SafeDisposable
public class SoLDMResourceParameters extends SoFieldContainer
Defines resource parameters constraints of anSoDataSet
object. This class specifies the resource parameters of an instance of the classSoDataSet
. See the field SoDataset.ldmResourceParameters.You can set global resource parameters using static methods in class
SoLDMGlobalResourceParameters
. See theSoLDMGlobalResourceParameters
class description for an overview of LDM memory management.- See Also:
SoDataSet
,SoVolumeData
,SoLDMGlobalResourceParameters
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SoLDMResourceParameters.FixedResolutionReport
This structure returns information to the application whenfixedResolution
is true andresolution
is not -1.static class
SoLDMResourceParameters.LoadPolicies
Tile Load Policy.static class
SoLDMResourceParameters.ScreenResolutionCullingPolicies
Screen resolution culling policies.static class
SoLDMResourceParameters.TileCachePolicies
Tile cache management policy.static class
SoLDMResourceParameters.ViewpointRefinementPolicies
Viewpoint refinement policies.-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
Fields Modifier and Type Field Description SoSFBool
fixedResolution
Specifies if a single resolution or several resolutions are used when the rendering is stabilized.SoSFInt32
loadNotificationRate
Tile loading notification rate.SoSFEnum<SoLDMResourceParameters.LoadPolicies>
loadPolicy
Tile loading policy.SoSFInt32
max2DTexMemory
Maximum of 2D textures memory in MB for this data set.SoSFInt32
maxMainMemory
Maximum allowed main memory in MB that LDM is allowed to use for this data set.SoSFInt32
maxResolutionThreshold
Maximum loading threshold for the LDM module.SoSFInt32
maxTexMemory
Maximum allowed texture (GPU) memory in MB for this data set.SoSFInt32
minResolutionThreshold
Minimum loading threshold for LDM module.SoSFInt32
minTilesToLoad
Minimum number of tiles that must be loaded in memory before rendering.SoSFInt32
numPrefetchThread
Number of threads used by the tile prefetch mechanism.SoSFInt32
resolution
Specifies the resolution level whenfixedResolution
is true.SoSFEnum<SoLDMResourceParameters.ScreenResolutionCullingPolicies>
screenResolutionCullingPolicy
Defines the screen resolution culling policy.SoSFVec3i32
subTileDimension
Size of subtiles used by some accelerated algorithms.SoSFInt32
tex2LoadRate
Maximum number of 2D tiles to be loaded in texture memory per frame.SoSFInt32
tex3LoadRate
Maximum number of 3D tiles to be loaded into texture memory per frame for this data set.SoSFBool
tileBorders
Defines whether or not to generate borders around tiles.SoSFEnum<SoLDMResourceParameters.TileCachePolicies>
tileCachePolicy
Specify how LDM store the tiles in memory.SoSFVec3i32
tileDimension
Sets the tile size.SoSFFloat
tileHalfLife
Tile half-life (seconds).SoSFEnum<SoLDMResourceParameters.ViewpointRefinementPolicies>
viewpointRefinementPolicy
Defines the viewpoint refinement policy.-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoLDMResourceParameters()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getDataSize()
Gets the size of a voxel in bytes.float
getGeometryPriority(java.lang.Class<? extends Inventor> geometryType)
Returns the priority of the specified geometry type.float
getMovingTimeOut()
Returns the amount of time during which LDM continues not loading data once a user stops interaction.void
setGeometryPriority(java.lang.Class<? extends Inventor> geometryType, float priority)
Sets the importance of one type of geometry relative to others.void
setMovingTimeOut(float timeout)
Sets the amount of time (in seconds) during which LDM continues not loading once a user stops interaction.-
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, touch
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-
-
-
Field Detail
-
maxMainMemory
public final SoSFInt32 maxMainMemory
Maximum allowed main memory in MB that LDM is allowed to use for this data set. Default value is -1, meaning LDM is in charge of the automatic sharing of a given resource. Automatic sharing means LDM will compute, by itself, the amount of associated resource it allocates to each dataset. The automatic allocation take in account all nodes in scenegraph.If value is not -1 (default) LDM will not consider this node in memory allocation, and allocated CPU memory for this node will be the exact value set in the field. In this case, the amount of memory is removed from Global value. All other dataset will share (
SoLDMGlobalResourceParameters.getMaxMainMemory
- ( Sum of memory of all datasets withmaxMainMemory
!= -1 )) / ( number of datasets withmaxMainMemory
== -1 )
-
maxTexMemory
public final SoSFInt32 maxTexMemory
Maximum allowed texture (GPU) memory in MB for this data set. This field is only considered forSoVolumeRender
nodes.Default value is -1, meaning LDM is in charge of the automatic sharing of a given resource. Automatic sharing means LDM will compute, by itself, the amount of associated resource it allocates to each dataset. The automatic allocation take in account all nodes in scenegraph.
If value is not -1 (default) LDM will not consider this node in memory allocation, and allocated CPU memory for this node will be the exact value set in the field. In this case, the amount of memory is removed from Global value. All other dataset will share (
SoLDMGlobalResourceParameters.getMaxTexMemory
- ( Sum of memory of all datasets withmaxTexMemory
!= -1 )) / ( number of datasets withmaxTexMemory
== -1 )
-
loadPolicy
public final SoSFEnum<SoLDMResourceParameters.LoadPolicies> loadPolicy
Tile loading policy. . Default is NO_USER_INTERACTION. NO_USER_INTERACTION means the asynchronous loading threads will only load tiles when the user is not interacting with the scene (i.e. the application is idle).The loading occurs as long as there is something to load if ALWAYS is passed. No loading occurs if NEVER is passed, however at least the resolution 0 is loaded.
-
tileCachePolicy
public final SoSFEnum<SoLDMResourceParameters.TileCachePolicies> tileCachePolicy
Specify how LDM store the tiles in memory. Please refer toTileCachePolicy
for the different options. Default value is ALL.- Since:
- Open Inventor 10.0
-
tex3LoadRate
public final SoSFInt32 tex3LoadRate
Maximum number of 3D tiles to be loaded into texture memory per frame for this data set. You can set this number for all data sets by callingSoLDMGlobalResourceParameters.setTex3LoadRate()
. This field is only considered forSoVolumeRender
nodes.Each tile needed for volume rendering (
SoVolumeRender
) and volume geometry must be transfered to GPU memory as a 3D texture. So, for example, transfering 1000 tiles at the loadRate 10 requires 100 frames. (How many seconds this takes depends on the frames per second possible, which in turn depends on many factors including the complexity of the scene graph.) Increasing the loadRate value reduces the number of frames required to reach maximum resolution. But the render traversal has to wait for the data transfer to finish, so each frame may take longer to render, increasing the total time to reach maximum resolution.Default value is -1, meaning LDM is in charge of the automatic sharing of a given resource. Automatic sharing means LDM will compute, by itself, the amount of associated resource it allocates to each dataset. The automatic allocation takes into account all nodes in scenegraph.
If value is not -1 (default) LDM will not consider this node in automatic allocation, and allocated 3D texture LoadRate for this node will be the exact value set in the field. In this case, the amount of memory is removed from Global value. All other dataset will share (
SoLDMGlobalResourceParameters.getTex3LoadRate
- ( Sum of memory of all datasets withtex3LoadRate
!= -1 )) / ( number of datasets withtex3LoadRate
== -1 )
-
max2DTexMemory
public final SoSFInt32 max2DTexMemory
Maximum of 2D textures memory in MB for this data set. This field is only considered forSoSlice
nodes.Each tile needed to render a slice (
SoOrthoSlice
,SoVolumeSkin
, etc) must be stored in GPU memory as a 2D texture. This method limits the amount of GPU memory that can be used by (for example)SoOrthoSlice
andSoVolumeSkin
nodes. This can be useful when combining slices and volume rendering because the 3D textures used by volume rendering require much more GPU memory.Default value is -1, meaning LDM is in charge of the automatic sharing of a given resource. Automatic sharing means LDM will compute, by itself, the amount of associated resource it allocates to each dataset. The automatic allocation takes into account all nodes in scenegraph.
If value is not -1 (default) LDM will not consider this node in memory allocation, and allocated CPU memory for this node will be the exact value set in the field. In this case, the amount of memory is removed from Global value. All other dataset will share (
SoLDMGlobalResourceParameters.setMax2DTexMemory
- ( Sum of memory of all datasets withmax2DTexMemory
!= -1 )) / ( number of datasets withmax2DTexMemory
== -1 )- Since:
- Open Inventor 9.6.0
-
tex2LoadRate
public final SoSFInt32 tex2LoadRate
Maximum number of 2D tiles to be loaded in texture memory per frame. This affects rendering nodes that use 2D textures, for exampleSoOrthoSlice
andSoVolumeSkin
. Default isSoLDMGlobalResourceParameters.getTex2LoadRate()
. This field is only considered forSoSlice
nodes.Each tile needed to render a slice (
SoOrthoSlice
,SoVolumeSkin
, etc) must be loaded into GPU memory as a 2D texture. Increasing the loadRate value reduces the number of frames required to reach maximum resolution. But the render traversal has to wait for the data transfer to finish, so each frame may take longer to render, increasing the total time to reach maximum resolution.Default value is -1, meaning LDM is in charge of the automatic sharing of a given resource. Automatic sharing means LDM will compute, by itself, the amount of associated resource it allocates to each dataset. The automatic allocation takes into account all nodes in scenegraph.
If value is not -1 (default) LDM will not consider this node in automatic allocation, and allocated 2D texture for this node will be the exact value set in the field. In this case, the amount of LoadRate is removed from Global value. All other dataset will share (
SoLDMGlobalResourceParameters.getTex2LoadRate
- ( Sum of memory of all datasets withtex2LoadRate
!= -1 )) / ( number of datasets withtex2LoadRate
== -1 )
-
minResolutionThreshold
public final SoSFInt32 minResolutionThreshold
Minimum loading threshold for LDM module. Specifies to LDM to never unload tiles below this resolution threshold. Threshold is the power of 2 of the desired subsample level. For instance, passing 2 means never unload tiles of resolution 1/4. Default is -1, meaning the minimum subsample level.If used with an ROI enabled, only tiles below the min resolution threshold and within the ROI subvolume will never be unloaded. All tiles outside the ROI subvolume will be unloaded. The ROI box allows you to specify where it is the most important to increase the resolution within the subvolume. By default, (subvolume ROI flag enabled) this would be within the box. If for example using the exclusion box mode, then lower resolution tiles will be within the box and higher resolution ones outside the box and within the subvolume.
-
maxResolutionThreshold
public final SoSFInt32 maxResolutionThreshold
Maximum loading threshold for the LDM module. LDM will never load tiles below this resolution threshold. Threshold is the power of 2 of the desired subsample level. For instance, passing 1 means never load tiles of full resolution. Default is 0, full resolution, i.e., load everything.
-
tileDimension
public final SoSFVec3i32 tileDimension
Sets the tile size. VolumeViz always manages volume data in CPU memory as a hierarchy of tiles and data is transferred to GPU memory as tiles.When using VolumeViz with in-memory data or a file format other than LDM, the data is converted to tiles "on the fly". In this case, the default tile size is (128, 128, 128).
When loading data using an LDM volume reader, e.g. loading an LDM format file or using a custom volume reader that implements the readTile() method, the tile size is initialized with the value returned by the reader's getTileSize() method. The application can specify a different tile size, in which case the tiles are automatically generated using the data from the reader's tiles, with the following limitation: If the reader's readTile() method returns uniform or compressed buffers (
SoCpuBufferUniform
orSoCpuBufferCompressed
), they are converted to regular buffers and the memory optimization is lost.Changing the default tile size may affects the rendering or data loading performances. Basically, a larger tile size is usually better for rendering performance or to quickly obtain the highest resolution thanks to more optimal GPU utilization. On the other hand, it may penalize the data fetching on the CPU side from slow hard disk drives or over the network. Experimentation is generally required to find a good trade-off between rendering efficiency and data fetching time.
Notes:
- tileDimension must be set
after setting the volume filename or volume reader on an
SoVolumeData
node. - Tiles are stored as textures on the GPU. Therefore a tile must not exceed the maximum size allowed by the GPU. See
SbGPUCapabilities.getMax3DTextureSize()
. - If the tile dimension is set larger than the default value and the
SoVolumeRender.subdivideTile
field is set to true, then the subtileDimension should also be set to a larger value to avoid reducing performance. In general we recommend settingsubTileDimension
totileDimension
/4
- tileDimension must be set
after setting the volume filename or volume reader on an
-
subTileDimension
public final SoSFVec3i32 subTileDimension
Size of subtiles used by some accelerated algorithms. Default is (32, 32, 32). This field is only considered when fieldSoVolumeRender.subdivideTile
is set to true. Notes:- The subTileDimension values must be a power-of-2, e.g. 32, 64, 128, etc.
- It takes time to build subtiles, in general we recommend setting
subTileDimension
totileDimension
/4. - The default subTileDimension (32) is appropriate for the default tileDimension (128), but should be set to a larger value if the tileDimension is a larger value. Using too small a value will reduce performance.
-
loadNotificationRate
public final SoSFInt32 loadNotificationRate
Tile loading notification rate. Default is 50 tiles. When rate tiles have been loaded in main memory, a redraw will be scheduled. Which means, for the default rate, that if each voxel is one byte and the tile size is 64x64x64, a redraw will be scheduled whenever 13 MB of data has been loaded.Default value is -1, meaning LDM is in charge of the automatic sharing of a given resource. Automatic sharing means LDM will compute, by itself, the amount of associated resource it allocates to each dataset. The automatic allocation takes into account all nodes in scenegraph.
If value is not -1 (default) LDM will not consider this node in automatic allocation, and allocated Notification rate for this node will be the exact value set in the field. In this case, the fixed value of notification rate is then removed from Global value. All other dataset will share (
SoLDMGlobalResourceParameters.getLoadNotificationRate
- ( Sum of memory of all datasets with *loadNotificationRate
!= -1 )) / ( number of datasets withloadNotificationRate
== -1 )
-
tileHalfLife
public final SoSFFloat tileHalfLife
Tile half-life (seconds). Default is 2 seconds. When calling SoDataSet.getLdmDataAccess.getData(), once a tile is unlocked by the application (call to SoDataSet.getLdmDataAccess.releaseData), its weight will decrease until the tile is weighted again by LDM. This function allows you to set how long it takes for the tile's weight to be divided by 2 (initial weight is 1). The tile weight will be set to 0 when the weight becomes less than 0.05.
-
fixedResolution
public final SoSFBool fixedResolution
Specifies if a single resolution or several resolutions are used when the rendering is stabilized. When true, this single resolution level is specified by the fieldresolution
.Default is false, which specifies that the field
resolution
is ignored.
-
resolution
public final SoSFInt32 resolution
Specifies the resolution level whenfixedResolution
is true.- When the value of this field is greater or equal to 0, it specifies the volume resolution used for rendering: 0 for full resolution and higher for sub-resolutions. The resolution value may be incompatible with the hardware configuration (e.g. not enough memory) or with the LDM settings (i.e. see
maxMainMemory
,maxTexMemory
andSoLDMGlobalResourceParameters
for more details). In this case, this field andfixedResolution
are ignored.
Note that there is no rendering until the given resolution is reached. - When this field value is set to -1, the fixed resolution is adaptive, and is computed to be the highest one according to:
- the memory resources
- the position of the camera
- the region of interest (see
SoROI
for more details)
Default is 1, i.e, 1 voxel out of 2 of the full resolution.
- When the value of this field is greater or equal to 0, it specifies the volume resolution used for rendering: 0 for full resolution and higher for sub-resolutions. The resolution value may be incompatible with the hardware configuration (e.g. not enough memory) or with the LDM settings (i.e. see
-
numPrefetchThread
public final SoSFInt32 numPrefetchThread
Number of threads used by the tile prefetch mechanism. Tile prefetch is activated when LDM_USE_PREFETCH_OPTIM is true andtileCachePolicy
is NONE. Default value is -1, meaning the maximum number of threads will be used.
-
tileBorders
public final SoSFBool tileBorders
Defines whether or not to generate borders around tiles. Borders are used to accelerate the interpolation of voxel values at the boundary of adjacent tiles.- If set to true:
- Borders are generated around tiles. When interpolation between adjacent tiles is enabled (see
SoVolumeShader.interpolateOnMove
), a rendering performance gain can be observed (compared to when tileBorders is false), at the cost of a precomputation that is done each time a tile is sent to the GPU. Using borders will also slightly increase the size of the tile textures on the GPU.
- Borders are generated around tiles. When interpolation between adjacent tiles is enabled (see
- If set to false:
- No borders are generated around tiles. No precomputation is required before sending a tile to the GPU. Interpolation between adjacent tiles is computed "on the fly" (slower compared to when tileBorders is true, but the cost might be negligible on modern GPUs).
Limitations:
- Volume projection and rectilinear coordinates are not supported when this value is set to false (artifacts appear at the intersection between tiles). Set to true instead in those cases.
The default value is true.
- Since:
- Open Inventor 10.9.0
- If set to true:
-
minTilesToLoad
public final SoSFInt32 minTilesToLoad
Minimum number of tiles that must be loaded in memory before rendering. For example, if this number is 50 and 40 tiles are currently loaded, then at least 10 new tiles must be loaded before the next rendering.This can be used as a "minimum quality" parameter, where the quality is defined by the number of loaded tiles in memory. No rendering will be done until this minimum number of tiles is loaded in memory.
The tiles are selected according to their weight, which depends in particular on their hierarchy level in the octree topology.
If this number of tiles requires a memory amount that exceeds
maxMainMemory
, then it will be internally clamped to the maximum value that respectsmaxMainMemory
.The default value is 1 (root tile only).
- Since:
- Open Inventor 10.9.0
-
viewpointRefinementPolicy
public final SoSFEnum<SoLDMResourceParameters.ViewpointRefinementPolicies> viewpointRefinementPolicy
Defines the viewpoint refinement policy. . The default value isVIEWPOINT_REFINEMENT_INHERITED_FROM_GLOBAL
.- Since:
- Open Inventor 10.9.0
-
screenResolutionCullingPolicy
public final SoSFEnum<SoLDMResourceParameters.ScreenResolutionCullingPolicies> screenResolutionCullingPolicy
Defines the screen resolution culling policy. . The default value isSCREEN_RESOLUTION_CULLING_INHERITED_FROM_GLOBAL
.- Since:
- Open Inventor 10.10.0
-
-
Method Detail
-
setGeometryPriority
public void setGeometryPriority(java.lang.Class<? extends Inventor> geometryType, float priority)
Sets the importance of one type of geometry relative to others. The geometry type should be one of the VolumeViz geometry classes. For example, SoOrthoSlice.getClassTypeId().The priority passed must be between 0 and 1, 0 being lowest priority and 1 the highest. LDM will refine tiles first where geometries are the most important. For example, if an
SoVolumeRender
node has a higher priority than slices, then the tiles required for thisSoVolumeRender
node will be refined first.Default is 0.5 for a volume, 0.9 for other geometry.
-
getDataSize
public int getDataSize()
Gets the size of a voxel in bytes.
-
getGeometryPriority
public float getGeometryPriority(java.lang.Class<? extends Inventor> geometryType)
Returns the priority of the specified geometry type. The function will return false if the geometry is of unknown type. SeesetGeometryPriority()
.
-
setMovingTimeOut
public void setMovingTimeOut(float timeout)
Sets the amount of time (in seconds) during which LDM continues not loading once a user stops interaction. In other words, LDM will start loading again timeOut seconds after the user stops interaction. Considered only in NO_USER_INTERACTION mode. Default is 0.3 seconds.
-
getMovingTimeOut
public float getMovingTimeOut()
Returns the amount of time during which LDM continues not loading data once a user stops interaction. Considered only in NO_USER_INTERACTION mode. SeesetMovingTimeOut()
.
-
-