Module vrOptimize
[frames] | no frames]

Module vrOptimize



 The vrOptimize module allows to optimize the representation of the graphical scene to speed up rendering.

Example::       
        See also example optimize.py

Functions
 
cleanupGroupNodes(root_node, recursive)
Cleanup group nodes.
 
createMultiMaterials(root_node)
Create multi-materials for a given subgraph.
 
createOcTree(root_node)
Transform all geometries by an octree structure.
 
flushMaterialGroups(root_node)
The materials of a MaterialGroup will be flushed into the underlying geometries and the MaterialGroups will be transformed into group nodes.
 
flushRotations(root_node)
Moves rotation-related transform information of selected sub-tree to the geometry nodes on lowest level.
 
flushScales(root_node)
Moves scale-related transform information of selected subtree to the geometry nodes on lowest level.
 
flushSelectedTransformation(node)
Moves transformation of selected node to the geometry nodes on lowest level.
 
flushTexGen(root_node)
Flush gen funcs.
 
flushTexTransform(root_node)
Flush texture transformations.
 
flushTransformations(root_node)
Flush transformations.
 
flushTransformationsKeepFaceNormals(root_node)
Flush transformations.
 
flushTranslations(root_node)
Moves translation-related transform information of selected sub-tree to the geometry nodes on lowest level.
float (32bit)
measureCacheEfficiency(root_node, cache_size)
Measures the cache efficiency.
 
mergeGeometry(root_node)
Merges geometry nodes.
 
optimizeGeometry(root_node, strips, fans, stitches)
Optimizes geometry to speed up rendering.
 
optimizeIndices(root_node)
Optimize indices to improve render speed.
 
optimizeMaterials(root_node)
Optimize the specified scenegraph by using as few materials as possible.
 
optimizeTree(root_node, options)
Optimizes the scenegraph by applying specified optimization functions.
 
removeAnimations(root_node)
Removes all animations from nodes in the selected sub-tree.
 
removeBSides(root_node)
Removes all geometries that are set to B-side from the selected sub-tree.
 
removeDegPolys(root_node)
Degenerated Polygons (covering an area of size 0) will be removed.
 
removeEmptyGeometries(root_node)
Removes empty geometry nodes.
 
removeEmptyShells(root_node)
Removes empty shell nodes.
 
removeIdentityTransforms(root_node)
Removes identity Transforms.
 
removeInvalidTexCoords(root_node)
Remove invalid texture coordinates.
 
removeLODNodes(root_node)
Remove LOD nodes.
 
removeLines(root_node)
Remove line geometries from the scene representation.
 
removeMaterialGroups(root_node)
Remove material groups.
 
removeMetadata(root_node)
Removes all metadata from nodes in the selected sub-tree.
 
removeNURBS(root_node)
Remove the NURBS information of the selected Node hierarchy.
 
removePoints(root_node)
Remove point geometries from the scene representation.
 
removeSwitchNodes(root_node)
Remove Switch nodes from a given subgraph.
 
removeTransformNodesWithNoChildren(root_node)
Removes all transform nodes with no children.
 
removeTransformVariants(root_node)
Removes all transform variants from nodes in the selected sub-tree.
 
removeUnusedMaterials()
Removes unused materials.
 
separateGeoProperties(root_node)
Separate shared geometry properties.
 
shareGeometries(root_node, checkWorldMatrix)
Shares equal geometry nodes.
 
shareImages()
Share images.
 
sharePtrs(root_node, types)
Share pointers.
 
sortIndices(root_node)
Sort indices to improve render speed.
 
tipsifyIndices(root_node, cache_size)
Optimize indices to improve render speed.
 
triangulate(root_node, recreateAllProperties)
Triangulate the geometries.
 
unflushMaterialGroups(root_node)
The materials within a geometry will be removed, instead a MaterialGroup with the material will be placed above.
 
unifyVertices(root_node)
Optimize the geometry by creating shared indices and removing unused and double coords, colors, and texcoords.
 
verifyGeometry(root_node)
Verifies geometry nodes.
Variables
  OptimizeCleanUpGroupNodes = 8
  OptimizeCreateFans = 256
  OptimizeCreateStitches = 512
  OptimizeCreateStrips = 128
  OptimizeDeepTriangulate = 16384
  OptimizeFlushMaterialGroupNodes = 16
  OptimizeFlushSelectedTransformation = 1152921504606846976
  OptimizeFlushTexGen = 131072
  OptimizeFlushTexTransform = 262144
  OptimizeFlushTransformationNodes = 4
  OptimizeFlushTransformationNodesKeepFaceNormals = 562949953421312
  OptimizeFlushTransformationRotations = 36028797018963968
  OptimizeFlushTransformationScales = 72057594037927936
  OptimizeFlushTransformationTranslations = 18014398509481984
  OptimizeIndices = 140737488355328
  OptimizeMaterials = 64
  OptimizeMergeGeometryNodes = 2
  OptimizeNothing = 1
  OptimizeOctree = 524288
  OptimizeReduction16BitIndices = 17179869184
  OptimizeReduction16BitLengths = 34359738368
  OptimizeReductionByteNormals = 8589934592
  OptimizeRemoveAnimations = 65536
  OptimizeRemoveBSides = 9007199254740992
  OptimizeRemoveDegPolys = 32768
  OptimizeRemoveEmptyGeometries = 274877906944
  OptimizeRemoveEmptyGroupNodes = 137438953472
  OptimizeRemoveEmptyShells = 549755813888
  OptimizeRemoveFileInfo = 4503599627370496
  OptimizeRemoveLODs = 1024
  OptimizeRemoveLODsKeepWorst = 1125899906842624
  OptimizeRemoveLines = 4096
  OptimizeRemoveMaterialGroupNodes = 68719476736
  OptimizeRemoveMetadata = 2251799813685248
  OptimizeRemovePoints = 2048
  OptimizeRemoveSwitches = 4294967296
  OptimizeRemoveTexCoord1 = 8388608
  OptimizeRemoveTexCoord2 = 16777216
  OptimizeRemoveTexCoord3 = 33554432
  OptimizeRemoveTexCoord4 = 67108864
  OptimizeRemoveTextureCoordinates = 8388608
  OptimizeRemoveTextureCoordinates1 = 16777216
  OptimizeRemoveTextureCoordinates2 = 33554432
  OptimizeRemoveTextureCoordinates3 = 67108864
  OptimizeRemoveTextureCoordinates4 = 4398046511104
  OptimizeRemoveTextureCoordinates5 = 8796093022208
  OptimizeRemoveTextureCoordinates6 = 17592186044416
  OptimizeRemoveTextureCoordinates7 = 35184372088832
  OptimizeRemoveTransformVariants = 2305843009213693952
  OptimizeRemoveVertexColor = 2097152
  OptimizeRemoveVertexNormals = 1048576
  OptimizeRemoveVertexSecondaryColor = 4194304
  OptimizeShareBlendChunks = 2147483648
  OptimizeShareGeometries = 134217728
  OptimizeShareGeometryProperties = 268435456
  OptimizeShareMaterials = 536870912
  OptimizeShareTextures = 1073741824
  OptimizeSortIndices = 2199023255552
  OptimizeTriangulate = 8192
  OptimizeUnflushMaterialGroupNodes = 1099511627776
  OptimizeUnifyVertices = 32
  RemoveIdentityTransforms = 70368744177664
  RemoveInvalidTexCoords = 281474976710656
Function Details

cleanupGroupNodes(root_node, recursive)

 

Cleanup group nodes. Empty group nodes or group nodes with a single child will be removed. There are two functions:

cleanupGroupNodes(root_node)

cleanupGroupNodes(root_node,recursive)

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.
  • recursive (boolean) - Recursive: On/Off (Optional).

createMultiMaterials(root_node)

 

Create multi-materials for a given subgraph.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to create multi-materials for.

createOcTree(root_node)

 

Transform all geometries by an octree structure. Not necessary on todays graphic cards.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

flushMaterialGroups(root_node)

 

The materials of a MaterialGroup will be flushed into the underlying geometries and the MaterialGroups will be transformed into group nodes.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

flushRotations(root_node)

 

Moves rotation-related transform information of selected sub-tree to the geometry nodes on lowest level.

Parameters:
  • root_node (NodePtr) - the root node of the sub-tree.

flushScales(root_node)

 

Moves scale-related transform information of selected subtree to the geometry nodes on lowest level.

Parameters:
  • root_node (NodePtr) - the root node of the sub-tree.

flushSelectedTransformation(node)

 

Moves transformation of selected node to the geometry nodes on lowest level.

Parameters:
  • node (NodePtr) - The node to be flushed.

flushTexGen(root_node)

 

Flush gen funcs. All TexGenChunks will be removed and appropriate texture coordinates will be calculated.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

flushTexTransform(root_node)

 

Flush texture transformations. All texture transformations will be multiplied onto the texture coordinates and deleted afterwards.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

flushTransformations(root_node)

 

Flush transformations. All transformations will be applied to the geometry nodes on lowest level of the selected sub-tree. Afterwards all transform nodes will be identity transforms.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

flushTransformationsKeepFaceNormals(root_node)

 

Flush transformations. All transformations will be applied to the geometry nodes on lowest level of the selected sub-tree. Afterwards all transform nodes will be identity transforms. Doesn't change the face normals for mirror transform parents.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

flushTranslations(root_node)

 

Moves translation-related transform information of selected sub-tree to the geometry nodes on lowest level.

Parameters:
  • root_node (NodePtr) - the root node of the sub-tree.

measureCacheEfficiency(root_node, cache_size)

 

Measures the cache efficiency. 1.0 means one vertex calculation per triangle.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.
  • cache_size (integer) - The cache size in [12,inf[.
Returns: float (32bit)
The cache efficiency in [0.5,3.0].

mergeGeometry(root_node)

 

Merges geometry nodes.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

optimizeGeometry(root_node, strips, fans, stitches)

 

Optimizes geometry to speed up rendering. Stripes and fans are optimized primitives that can be rendered much faster by your graphics hardware.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.
  • strips (boolean) - Strips: On/Off (Optional).
  • fans (boolean) - Fans: On/Off (Optional).
  • stitches (boolean) - Stitches: On/Off (Optional).

optimizeIndices(root_node)

 

Optimize indices to improve render speed.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

optimizeMaterials(root_node)

 

Optimize the specified scenegraph by using as few materials as possible.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

optimizeTree(root_node, options)

 

Optimizes the scenegraph by applying specified optimization functions. There are two functions available:

optimizeTree(options) optimizes the complete scene or

optimizeTree(root_node,options) optimizes only a specified subgraph.

The Options parameter is to be defined by using bitwise OR of parameters of the following list:

OptimizeNothing

OptimizeMergeGeometryNodes

OptimizeFlushTransformationNodes

OptimizeFlushTransformationNodesKeepFaceNormals

OptimizeFlushTransformationTranslations

OptimizeFlushTransformationRotations

OptimizeFlushTransformationScales

OptimizeFlushSelectedTransformation

OptimizeCleanUpGroupNodes

OptimizeFlushMaterialGroupNodes

OptimizeUnflushMaterialGroupNodes

OptimizeUnifyVertices

OptimizeMaterials

OptimizeCreateStrips

OptimizeCreateFans

OptimizeRemoveLODs

OptimizeRemoveLODsKeepWorst

OptimizeRemovePoints

OptimizeRemoveLines

OptimizeTriangulate

OptimizeDeepTriangulate

OptimizeRemoveDegPolys

OptimizeFlushTexGen

OptimizeFlushTexTransform

OptimizeOctree

OptimizeRemoveVertexNormals

OptimizeRemoveVertexColor

OptimizeRemoveLines

OptimizeRemoveVertexSecondaryColor

OptimizeRemoveTextureCoordinates (replaces deprecated option OptimizeRemoveTexCoord1)

OptimizeRemoveTextureCoordinates1 (replaces deprecated option OptimizeRemoveTexCoord2)

OptimizeRemoveTextureCoordinates2 (replaces deprecated option OptimizeRemoveTexCoord3)

OptimizeRemoveTextureCoordinates3 (replaces deprecated option OptimizeRemoveTexCoord4)

OptimizeRemoveTextureCoordinates4

OptimizeRemoveTextureCoordinates5

OptimizeRemoveTextureCoordinates6

OptimizeRemoveTextureCoordinates7

OptimizeShareGeometries

OptimizeShareGeometryProperties

OptimizeShareMaterials

OptimizeShareTextures

OptimizeShareBlendChunks

OptimizeRemoveSwitches

OptimizeReductionByteNormals

OptimizeReduction16BitIndices

OptimizeReduction16BitLengths

OptimizeRemoveMaterialGroupNodes

OptimizeRemoveEmptyGroupNodes

OptimizeRemoveEmptyGeometries

OptimizeRemoveEmptyShells

OptimizeRemoveAnimations

OptimizeRemoveMetadata

OptimizeRemoveFileInfo

OptimizeRemoveBSides

OptimizeRemoveTransformVariants

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.
  • options (integer) - Options.

removeAnimations(root_node)

 

Removes all animations from nodes in the selected sub-tree.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

removeBSides(root_node)

 

Removes all geometries that are set to B-side from the selected sub-tree.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

removeDegPolys(root_node)

 

Degenerated Polygons (covering an area of size 0) will be removed.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

removeEmptyGeometries(root_node)

 

Removes empty geometry nodes.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

removeEmptyShells(root_node)

 

Removes empty shell nodes.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

removeIdentityTransforms(root_node)

 

Removes identity Transforms. This command is deprecated and doesn't do anything.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

removeInvalidTexCoords(root_node)

 

Remove invalid texture coordinates.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

removeLODNodes(root_node)

 

Remove LOD nodes. Removes the lower resolution children of all LOD nodes and keeps only the highest resolution LOD within the scene. Rendering performance may drop but the model will utilize less memory.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

removeLines(root_node)

 

Remove line geometries from the scene representation.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

removeMaterialGroups(root_node)

 

Remove material groups.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

removeMetadata(root_node)

 

Removes all metadata from nodes in the selected sub-tree.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

removeNURBS(root_node)

 

Remove the NURBS information of the selected Node hierarchy. All surfaces and shell nodes are converted to meshes.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

removePoints(root_node)

 

Remove point geometries from the scene representation.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

removeSwitchNodes(root_node)

 

Remove Switch nodes from a given subgraph.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

removeTransformNodesWithNoChildren(root_node)

 

Removes all transform nodes with no children.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

removeTransformVariants(root_node)

 

Removes all transform variants from nodes in the selected sub-tree.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

separateGeoProperties(root_node)

 

Separate shared geometry properties.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

shareGeometries(root_node, checkWorldMatrix)

 

Shares equal geometry nodes.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.
  • checkWorldMatrix (bool) - If true, this method only shares the geometry when the world matrix of both nodes is equal (Optional).

sharePtrs(root_node, types)

 

Share pointers. Eliminates all duplicate entities from the scene and replaces them with references. Saves a lot of memory.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.
  • types (list of strings) - The list of types e.g. TextureChunk,Image.

sortIndices(root_node)

 

Sort indices to improve render speed.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

tipsifyIndices(root_node, cache_size)

 

Optimize indices to improve render speed.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.
  • cache_size (integer) - The cache size in [12,inf[ (Optional).

triangulate(root_node, recreateAllProperties)

 

Triangulate the geometries. The resulting geometry is no longer optimized for the graphics card.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.
  • recreateAllProperties (bool) - If true, this method recreates all properties. Otherwise, it generates only new indices, types, and lengths.

unflushMaterialGroups(root_node)

 

The materials within a geometry will be removed, instead a MaterialGroup with the material will be placed above.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

unifyVertices(root_node)

 

Optimize the geometry by creating shared indices and removing unused and double coords, colors, and texcoords. Speeds up rendering and saves memory.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.

verifyGeometry(root_node)

 

Verifies geometry nodes.

Parameters:
  • root_node (NodePtr) - The root node of the subgraph to be optimized.