CLI Naming Scripting Guide
This documentation summarizes all information to get started with RapidCompact’s (re)- naming scripting functionality and CLI settings.
Naming Scripting functionalities for 3D Processor are only available since CLI v7.2.0
and later.
The 3D Processor Naming Scripting functionalities and settings are only compatible with the 3D Processor CLI
.
They do not show up in the general 3D Processing Schema
and are not compatible with the 3D Processor REST API
or Web Platform
!
Flattening with scene depth preservation
This guide requires the basic understanding of the scene graph flattening process and method settings within the 3D Processor CLI. Get started with scene graph flattening in the 3D Processor Docs.
The setting preservedSceneDepth
can be used to specify how many levels of the scene hierarchy should be preserved:
- If the
scene graph flattening
method
isnone
, the setting has no effect - If the value for the setting is
0
, the setting has no effect - For methods other than
none
, the nodes below the given level are flattened with the requestedmethod
, example:- if
scene graph flattening
method
is set tobyOpacity
andpreservedSceneDepth
is set to1
, one level of parent nodes of the original scene graph is preserved and all nodes below that preserved level are flattened according to the given method (byOpacity
in this example).
- if
When utilizing scene graph flattening, separate meshes are created for each material. This means that in some cases a node may have children to contain the multiple meshes, one per material.
Read more about scene graph flattening and preserving scene depth in the 3D Processor CLI Documentation.
Note: scene graph flattening settings only have an effect if scene graph flattening is performed by:
sceneGraphFlattening
object within a 3D ProcessorJSON
configuraiton settings file.
Renaming Nodes
When utilizing RapidPipeline 3D Processor's scene graph flattening and baking workflows (via scene graph flattening
and optimize
), merged mesh nodes often inherit standard naming (e.g. node1
).
In order to customize this behavior with certain rules (adding suffixes, prefixes, metadata, inheriting naming from parent nodes etc.), the node naming script can be useful.
The setting nodeNamingScript
within object sceneGraphFlattening
allows to compute a name for nodes containing meshes created during flattening using a script.
As of CLI v7.2.0
, this only applies to nodes containing meshes that were created during scene graph flattening.
- A JavaScript script can be set in the setting value directly
- e.g.:
nodeNamingScript "script_code"
- e.g.:
- If the value of the setting starts with
@
,rpdx
(the CLI) tries to load the script from a file path defined after the@
When the script is executed
The script runs at the end of the scene graph flattening operation
, for each new node containing newly created flat meshes.
In case scene graph flattening
is not specified at all or the method
is set to none
, the script is not applied since no new nodes are created.
Properties available in the Script
The following properties are made accessible in the node naming script:
node.parentName
- the name of the parent of the current nodenode.isOpaque
- true if the materials used by the mesh under this node are all considered opaquenode.meshGroupIdx
- the index of this mesh in the respective group (see Mesh Groups)node.meshGroupSize
- the number of meshes in the respective group (see Mesh Groups)
Mesh Groups
Meshes are currently divided into two groups - opaque and non-opaque.
Each mesh has an index within the group which starts with 0 and is less than the number of meshes in the group.
There is no way to tell the order of the meshes (how indices are assigned).
Example:
Opaque Group:
mesh1
,mesh2
Non-opaque Group:
mesh3
,mesh4
mesh1
will have group index0
and mesh2
group index1
.mesh3
will have group index0
and mesh4
group index1
.
Node Renaming Example
- Model:
MosquitoInAmber.gltf
- Source: https://github.com/KhronosGroup/glTF-Sample-Models/tree/main/2.0/MosquitoInAmber
Model by Loïc Norgeot and mosquito scan by Geoffrey Marchal for Sketchfab licensed under CC BY 4.0
Input scene graph
Definitions:
__root__ = node is the internal asset root, not part of the original asset.
[T] = the node has a transformation
[M] = the node contains a mesh (mesh node)
[ ] = the node does not contain a mesh
__root__ [T]
RootNode (gltf orientation matrix) [T]
RootNode (model correction matrix) []
0a89b95064be46e6943aaad2c83817a2.fbx [T]
RootNode [T]
2_mosquito_lr [T]
2_mosquito_lr_original.o_material_0_0 [M]
5_amber_lr [T]
5_amber_lr_PBR_0 [M]
6_eclats [T]
6_eclats_eclats_0 [M]
Example script 1:
'mesh_' + node.parentName + (node.isOpaque ? '_opaque_' : '_transparent_') + node.meshGroupIdx
- Input:
NODE
(assuming this node is the first node containing an opaque mesh) - Output of Script:
mesh_NODE_opaque_0
preservedSceneDepth 5:
Using example script 1 and optimize
and sceneGraphFlattening
with setting preservedSceneDepth
= 5
, method
= byMaterial
, atlasMode
= separateAlpha
(default):
command:
rpdx -i MosquitoInAmber.gltf --read_c processor_script-1-depth-5-byMtl.json -e renameNodes-script-1-presDepth5-byMtl/MosquitoInAmber.gltf -r
settings configuration (JSON
):
processor_script-1-depth-5-byMtl.json
{
"sceneGraphFlattening": {
"method": "byMaterial",
"preservedSceneDepth": 5,
"nodeNamingScript": "'mesh_' + node.parentName + (node.isOpaque ? '_opaque_' : '_transparent_') + node.meshGroupIdx"
},
"optimize": {
"3dModelOptimizationMethod": {
"meshAndMaterialOptimization": {
"decimator": {
"target": {
"faces": {
"value": 20000
}
},
"materialOptimization": {
"materialMerger": {
"materialRegenerator": {
"uvAtlasGenerator": {
"textureBaker": {},
"atlasMode": "separateAlpha"
}
}
}
}
}
}
}
},
"export": [
{
"fileName": "export",
"format": {
"gltf": {}
}
}
]
}
Resulting Scene Graph:
__root__ [T]
RootNode (gltf orientation matrix) [T]
RootNode (model correction matrix) []
0a89b95064be46e6943aaad2c83817a2.fbx [T]
RootNode [T]
2_mosquito_lr [T]
mesh_2_mosquito_lr_opaque_0 [M]
5_amber_lr [T]
mesh_5_amber_lr_transparent_0 [M]
6_eclats [T]
mesh_6_eclats_opaque_0 [M]
Two visible effects on the output data (besides the optimization via optimize
operation):
- the scene graph preserved scene depth level of
5
ensured the same (parent) nodes as in the input - re-naming of the mesh nodes according to the used naming node script
- adding prefix
mesh_
- inheriting the respective parent names (e.g.
2_mosquito_lr
) - adding information of the associated material opacity types (
opaque
vstransparent
) - adding mesh count index (e.g.
_0
)
- adding prefix
preservedSceneDepth 1:
Using example script 1 and optimize
and sceneGraphFlattening
with setting preservedSceneDepth
= 1
, method
= byMaterial
, atlasMode
= separateAlpha
(default):
command:
rpdx -i MosquitoInAmber.gltf --read_c processor_script-1-depth-1-byMtl.json -e renameNodes-script-1-presDepth1-byMtl/MosquitoInAmber.gltf -r
settings configuration (JSON
):
processor_script-1-depth-1-byMtl.json
{
"sceneGraphFlattening": {
"method": "byMaterial",
"preservedSceneDepth": 1,
"nodeNamingScript": "'mesh_' + node.parentName + (node.isOpaque ? '_opaque_' : '_transparent_') + node.meshGroupIdx"
},
"optimize": {
"3dModelOptimizationMethod": {
"meshAndMaterialOptimization": {
"decimator": {
"target": {
"faces": {
"value": 20000
}
},
"materialOptimization": {
"materialMerger": {
"materialRegenerator": {
"uvAtlasGenerator": {
"textureBaker": {},
"atlasMode": "separateAlpha"
}
}
}
}
}
}
}
},
"export": [
{
"fileName": "export",
"format": {
"gltf": {}
}
}
]
}
Resulting Scene Graph:
__root__ [T]
RootNode (gltf orientation matrix) [T]
mesh_RootNode (gltf orientation matrix)_opaque_0 [M]
mesh_RootNode (gltf orientation matrix)_opaque_1 [M]
mesh_RootNode (gltf orientation matrix)_transparent_0 [M]
Visible effects on the output data (besides the optimization via optimize
operation):
- the scene graph preserved scene depth level of
1
preserved only1
parent node level, in this case:RootNode (gltf orientation matrix)
- re-naming of the mesh nodes according to the used naming node script
- adding prefix
mesh_
- inheriting the respective parent names (e.g.
RootNode (gltf orientation matrix)
) - adding information of the associated material opacity types (
opaque
vstransparent
) - adding mesh count index (e.g.
_0
)
- adding prefix
Example script 2:
assetID = node.parentName.split('_').slice(1,2).join('_'); idx = node.meshGroupIdx + 1; idxstr = node.meshGroupSize > 1 ? ('_' + (idx > 9 ? idx : '0' + idx)) : ''; 'geo_' + (node.isOpaque ? 'opq_' : 'trp_') + assetID + idxstr;
Using example script 2 and optimize
and sceneGraphFlattening
with setting preservedSceneDepth
= 5
, method
= byOpacity
, atlasMode
= separateAlpha
(default):
command:
rpdx -i MosquitoInAmber.gltf --read_c processor_script-2-depth-5-byOpcty.json -e renameNodes-script-2-presDepth5-byOpcty/MosquitoInAmber.gltf -r
settings configuration (JSON
):
processor_script-2-depth-5-byOpcty.json
{
"sceneGraphFlattening": {
"method": "byOpacity",
"preservedSceneDepth": 5,
"nodeNamingScript": "assetID = node.parentName.split('_').slice(1,2).join('_'); idx = node.meshGroupIdx + 1; idxstr = node.meshGroupSize > 1 ? ('_' + (idx > 9 ? idx : '0' + idx)) : ''; 'geo_' + (node.isOpaque ? 'opq_' : 'trp_') + assetID + idxstr;"
},
"optimize": {
"3dModelOptimizationMethod": {
"meshAndMaterialOptimization": {
"decimator": {
"target": {
"faces": {
"value": 20000
}
},
"materialOptimization": {
"materialMerger": {
"materialRegenerator": {
"uvAtlasGenerator": {
"textureBaker": {},
"atlasMode": "separateAlpha"
}
}
}
}
}
}
}
},
"export": [
{
"fileName": "export",
"format": {
"gltf": {}
}
}
]
}
Resulting Scene Graph:
__root__ [T]
RootNode (gltf orientation matrix) [T]
RootNode (model correction matrix) []
0a89b95064be46e6943aaad2c83817a2.fbx [T]
RootNode [T]
2_mosquito_lr [T]
geo_opq_mosquito [M]
5_amber_lr [T]
geo_trp_amber [M]
6_eclats [T]
geo_opq_eclats [M]
Visible effects on the output data (besides the optimization via optimize
operation):
- the scene graph preserved scene depth level of
5
ensured the same (parent) nodes as in the input - re-naming of the resulting mesh nodes (via
flattening
byOpacity
) according to the used naming node script:- adding prefix
geo_
- adding information of the associated material opacity types (
opq
vstrp
) - inheriting a specific part of the direct parent nodes (e.g. second part of parent node name, separated by
_
:mosquito
) - adding mesh count index (e.g.
_01
) - does not apply here as each mesh node lives separatly under an individual parent node
- adding prefix
Renaming Materials
When utilizing RapidPipeline 3D Processor's scene graph flattening and baking workflows (via scene graph flattening
and optimize
), merged materials often inherit standard naming (e.g. mat0
).
In order to customize this behavior with certain rules (adding suffixes, prefixes, metadata, inheriting naming from parent nodes etc.), the material naming script can be useful.
The setting materialNamingScript
within the materialMerger
object allows to compute a name for each baked material using a script.
- A JavaScript script can be set in the setting value directly
- e.g.:
materialNamingScript "script_code"
- e.g.:
- If the value of the setting starts with
@
,rpdx
(the CLI) tries to load the script from a file path defined after the@
When the script is executed
The script is running within the material merger operation
and only renames materials resulting from material merging. It runs for each material.
Properties available in the Script
The following properties are made accessible in the material naming script:
material.parentNodeName
- name of the parent of the node containing the mesh using the materialmaterial.isOpaque
- self explanatorymaterial.materialGroupIdx
- the index of this material in the respective group (see Material Groups)material.materialGroupSize
- the number of materials in the respective group (see Material Groups)
The material may be used by different nodes/meshes, in which case different names for parentNodeName may exist and it is not defined which one will be passed to the script.
Material Groups
Materials are currently divided in two groups - opaque and non-opaque. Each material has an index within the group which starts with 0 and is less than the number of materials in the group. There is no way to tell the order of the materials (how indices are assigned). e.g.: Opaque Group: material1, material2 Non-opaque Group: material3, material4 material1 will have group index 0 and material2 group index 1. material3 will have group index 0 and material4 group index 1.
Material Naming Example
Same example model as in the Node Renaming Section.
Input scene graph and materials
Definitions:
__root__ = node is the internal asset root, not part of the original asset.
[T] = the node has a transformation
[M] = the node contains a mesh (mesh node)
[ ] = the node does not contain a mesh
scene graph:
__root__ [T]
RootNode (gltf orientation matrix) [T]
RootNode (model correction matrix) []
0a89b95064be46e6943aaad2c83817a2.fbx [T]
RootNode [T]
2_mosquito_lr [T]
2_mosquito_lr_original.o_material_0_0 [M]
5_amber_lr [T]
5_amber_lr_PBR_0 [M]
6_eclats [T]
6_eclats_eclats_0 [M]
materials:
eclats
material
original.o_material_0
associations:
material | associated mesh node(s) |
---|---|
eclats | 6_eclats_eclats_0 |
material | 5_amber_lr_PBR_0 |
original.o_material_0 | 2_mosquito_lr_original.o_material_0_0 |
Example script 1:
'mat_' + (material.isOpaque ? '_opaque_' : '_transparent_') + material.materialGroupIdx
If the material is opaque
and this is the first opaque
material, the script would result in mat_opaque_0
.
Using example script 1 and optimize
and sceneGraphFlattening
with preservedSceneDepth
= 1
, method
= byMaterial
, atlasMode
= separateAlpha
(default):
command:
rpdx -i MosquitoInAmber.gltf --read_c processor_mtl-script-1-depth-1-byMtl.json -e renameMaterials-script-1-presDepth1-byMtl/MosquitoInAmber.gltf -r
settings configuration (JSON
):
processor_mtl-script-1-depth-1-byMtl.json
{
"sceneGraphFlattening": {
"method": "byMaterial",
"preservedSceneDepth": 1
},
"optimize": {
"3dModelOptimizationMethod": {
"meshAndMaterialOptimization": {
"decimator": {
"target": {
"faces": {
"value": 20000
}
},
"materialOptimization": {
"materialMerger": {
"materialRegenerator": {
"uvAtlasGenerator": {
"textureBaker": {},
"atlasMode": "separateAlpha"
}
},
"materialNamingScript": "'mat_' + (material.isOpaque ? '_opaque_' : '_transparent_') + material.materialGroupIdx"
}
}
}
}
}
},
"export": [
{
"fileName": "export",
"format": {
"gltf": {}
}
}
]
}
Results:
scene graph:
__root__ [T]
RootNode (gltf orientation matrix) [T]
2_mosquito_lr_original.o_material_0_0 [M]
5_amber_lr_PBR_0 [M]
6_eclats_eclats_0 [M]
materials:
mat__opaque_0
mat__opaque_1
mat__transparent_0
associations:
material | associated mesh node(s) |
---|---|
mat__opaque_0 | 6_eclats_eclats_0 |
mat__opaque_1 | 2_mosquito_lr_original.o_material_0_0 |
mat__transparent_0 | 5_amber_lr_PBR_0 |
Visible effects on the output data (besides the optimization via optimize
operation):
- the scene graph preserved scene depth level of
1
preserved only1
parent node level, in this case:RootNode (gltf orientation matrix)
- re-naming of the material nodes according to the used naming node script
- adding prefix
mat_
- adding information of the associated material opacity types (
_opaque
vs_transparent
) - adding material count index (e.g.
_0
)
- adding prefix
Example script 2:
assetID = material.parentNodeName.split('_').slice(1,2).join('_'); idx = material.materialGroupIdx + 1; idxstr = material.materialGroupSize > 1 ? ('_' + (idx > 9 ? idx : '0' + idx)) : ''; 'mat_' + (material.isOpaque ? 'opq_' : 'trp_') + assetID + idxstr;
Using example script 2 and optimize
and sceneGraphFlattening
with preservedSceneDepth
= 5
, method
= byMaterial
, atlasMode
= separateAlpha
(default):
command:
rpdx -i MosquitoInAmber.gltf --read_c processor_mtl-script-2-depth-5-byMtl.json -e renameMaterials-script-2-presDepth5-byMtl/MosquitoInAmber.gltf -r
settings configuration (JSON
):
processor_mtl-script-2-depth-5-byMtl.json
{
"sceneGraphFlattening": {
"method": "byMaterial",
"preservedSceneDepth": 5
},
"optimize": {
"3dModelOptimizationMethod": {
"meshAndMaterialOptimization": {
"decimator": {
"target": {
"faces": {
"value": 20000
}
},
"materialOptimization": {
"materialMerger": {
"materialRegenerator": {
"uvAtlasGenerator": {
"textureBaker": {},
"atlasMode": "separateAlpha"
}
},
"materialNamingScript": "assetID = material.parentNodeName.split('_').slice(1,2).join('_'); idx = material.materialGroupIdx + 1; idxstr = material.materialGroupSize > 1 ? ('_' + (idx > 9 ? idx : '0' + idx)) : ''; 'mat_' + (material.isOpaque ? 'opq_' : 'trp_') + assetID + idxstr;"
}
}
}
}
}
},
"export": [
{
"fileName": "export",
"format": {
"gltf": {}
}
}
]
}
Results:
scene graph:
__root__ [T]
RootNode (gltf orientation matrix) [T]
RootNode (model correction matrix) []
0a89b95064be46e6943aaad2c83817a2.fbx [T]
RootNode [T]
2_mosquito_lr [T]
2_mosquito_lr_original.o_material_0_0 [M]
5_amber_lr [T]
5_amber_lr_PBR_0 [M]
6_eclats [T]
6_eclats_eclats_0 [M]
materials:
mat_opq_eclats
mat_opq_mosquito
mat_trp_amber
associations:
material | associated mesh node(s) |
---|---|
mat_opq_eclats | 6_eclats_eclats_0 |
mat_opq_mosquito | 2_mosquito_lr_original.o_material_0_0 |
mat_trp_amber | 5_amber_lr_PBR_0 |
Visible effects on the output data (besides the optimization via optimize
operation):
- the scene graph preserved scene depth level of
5
ensured the same (parent) nodes as in the input - re-naming of the material nodes according to the used naming node script
- adding prefix
mat_
- adding information of the associated material opacity types (
_opq
vs_trp
) - materials are inheriting the second part (separated by
_
of the individual associated meshes' parent nodes, e.g.eclats
)
- adding prefix
Renaming Textures
When utilizing RapidPipeline 3D Processor's scene graph flattening and baking workflows (via scene graph flattening
and optimize
), exported textures from merged materials often inherit standard naming (e.g. `material0_basecolor.jpg).
In order to customize this behavior with certain rules (adding custom suffixes, prefixes, metadata, inheriting naming from parent nodes etc.), the texture naming script can be useful.
The setting textureNamingScript
within each exportSlot
array element of the export
array
object makes it possible to define the names for exported textures by using a script.
The setting itself can be used to specify the script code directly or a name of a file containing the script.
In order to put together the texture name, some global variables about the material and texture are made available to the script.
Global variables available to the script
material.index
- index of the material (rpdx internal index, same as default output - "material" + index)material.isOpaque
- true if the material is opaquematerial.name
- name of the materialtexture.width
texture.height
texture.type
- basecolor, metallic, roughness, etc. In some cases will be combined e.g.: metallic_roughnesstexture.numChannels
- number of channels in the texture
Other material or texture info could be provided, for example texture.channels containing a string like "rgb".
Texture Renaming Example
- Model:
FlightHelmet.gltf
- Source: https://github.com/KhronosGroup/glTF-Sample-Models/tree/main/2.0/FlightHelmet
This script re-creates the default 3D Processor
texture naming behavior:
"'material' + material.index + '_' + texture.type"
in the settings configuration JSON
file:
{
"version": 1.1,
"export": [
{
"fileName": "",
"textureMapFilePrefix": "",
"discard": {},
"textureNamingScript": "'material' + material.index + '_' + texture.type",
"format": {
"gltf": {
"pbrMaterial": {}
}
}
}
]
}
Another script example this time using metadata about texture types and dimensions:
material.name + '_' + texture.type + '_' + texture.width + 'x' + texture.height
in the settings configuration JSON
file:
texureNaming-script-dimensions.json
{
"version": 1.1,
"export": [
{
"fileName": "",
"textureMapFilePrefix": "",
"discard": {},
"textureNamingScript": "material.name + '_' + texture.type + '_' + texture.width + 'x' + texture.height",
"format": {
"gltf": {
"pbrMaterial": {}
}
}
}
]
}
All this could also be achieved by creating a javascript file (for example script.js) file with the same content.
And within the JSON
configuration settings file adding the link to the javascript script file "@script_filepath" instead of the script itself:
{
"version": 1.1,
"export": [
{
"fileName": "",
"textureMapFilePrefix": "",
"discard": {},
"textureNamingScript": "@script.js",
"format": {
"gltf": {
"pbrMaterial": {}
}
}
}
]
}
Results for the FlightHelmet.gltf
sample model using the following command and the second example script either directly or referenced within the JSON
settings file:
command options:
rpdx -i FlightHelmet.gltf --read_c texureNaming-script-dimensions.json -e output/res.gltf
rpdx -i FlightHelmet.gltf --read_c scriptLink.json -e output/res.gltf
Output:
Complete Renaming Example
Same example model as in the Node Renaming Section.
- Model:
MosquitoInAmber.gltf
- Source: https://github.com/KhronosGroup/glTF-Sample-Models/tree/main/2.0/MosquitoInAmber
Model by Loïc Norgeot and mosquito scan by Geoffrey Marchal for Sketchfab licensed under CC BY 4.0
Input scene graph, materials and textures
Definitions:
__root__ = node is the internal asset root, not part of the original asset.
[T] = the node has a transformation
[M] = the node contains a mesh (mesh node)
[ ] = the node does not contain a mesh
scene graph:
__root__ [T]
RootNode (gltf orientation matrix) [T]
RootNode (model correction matrix) []
0a89b95064be46e6943aaad2c83817a2.fbx [T]
RootNode [T]
2_mosquito_lr [T]
2_mosquito_lr_original.o_material_0_0 [M]
5_amber_lr [T]
5_amber_lr_PBR_0 [M]
6_eclats [T]
6_eclats_eclats_0 [M]
materials:
eclats
material
original.o_material_0
texture maps:
MosquitoInAmber0.jpg
MosquitoInAmber1.jpg
MosquitoInAmber2.jpg
MosquitoInAmber3.jpg
MosquitoInAmber4.jpg
associations:
material | associated mesh node(s) | associated textures |
---|---|---|
eclats | 6_eclats_eclats_0 | - |
material | 5_amber_lr_PBR_0 | MosquitoInAmber0.jpg , MosquitoInAmber1.jpg , MosquitoInAmber2.jpg |
original.o_material_0 | 2_mosquito_lr_original.o_material_0_0 | MosquitoInAmber3.jpg , MosquitoInAmber4.jpg |
Complete script
Example for all scripts for node, material and texture renaming (each can be saved as .js file and referenced within configuration settings JSON
files):
nodeNamingScript:
assetID = node.parentName.split('_').slice(1,2).join('_'); idx = node.meshGroupIdx + 0; idxstr = node.meshGroupSize > 1 ? ('_' + (idx > 9 ? idx : '0' + idx)) : ''; 'geo_' + (node.isOpaque ? 'opq' : 'trp') + assetID + idxstr;
materialNamingScript:
assetID = material.parentNodeName.split('_').slice(1,2).join('_'); idx = material.materialGroupIdx + 0; idxstr = material.materialGroupSize > 1 ? ('_' + (idx > 9 ? idx : '0' + idx)) : ''; 'mat_' + (material.isOpaque ? 'opq' : 'trp') + assetID + idxstr;
textureNamingScript"
texture.type + '_' + material.name + '_' + texture.width
Reading these naming configurations can be combined with reading other configurations as well, alternatively the longer settings containing the scripts themselves could be added to any existing configuration file as well.
Using complete example configuration settings JSON
file referencing 3 javascript files and using optimize
and sceneGraphFlattening
with preservedSceneDepth
= 1
, method
= byMaterial
, atlasMode
= separateMaterials
:
command:
rpdx -i MosquitoInAmber.gltf --read_c processor_complete-script.json -e completeScript/MosquitoInAmber.gltf -r
javascript files:
settings configuration (JSON
):
processor_complete-script.json
{
"sceneGraphFlattening": {
"method": "byMaterial",
"preservedSceneDepth": 1,
"nodeNamingScript": "@completeNodeScript.js"
},
"optimize": {
"3dModelOptimizationMethod": {
"meshAndMaterialOptimization": {
"decimator": {
"target": {
"faces": {
"value": 20000
}
},
"materialOptimization": {
"materialMerger": {
"materialRegenerator": {
"uvAtlasGenerator": {
"textureBaker": {},
"atlasMode": "separateMaterials"
}
},
"materialNamingScript": "@completeMtlScript.js"
}
}
}
}
}
},
"export": [
{
"fileName": "export",
"textureNamingScript": "@completeTexScript.js",
"format": {
"gltf": {}
}
}
]
}
Results
scene graph:
__root__ [T]
RootNode (gltf orientation matrix) [T]
geo_opq_00 [M]
geo_opq_01 [M]
geo_trp [M]
materials:
mat_opq_00
mat_opq_01
mat_trp
texture maps:
normal_mat_opq_00_512.jpg
basecolor_mat_opq_01_1024.jpg
normal_mat_opq_01_1024.jpg
metallic_roughness_mat_trp_2048.jpg
basecolor_mat_trp_2048.jpg
normal_mat_trp_2048.jpg
associations:
material | associated mesh node(s) | associated textures |
---|---|---|
mat_opq_00 | geo_opq_00 | normal_mat_opq_00_512.jpg |
mat_opq_01 | geo_opq_01 | basecolor_mat_opq_01_1024.jpg , normal_mat_opq_01_1024.jpg , metallic_roughness_mat_trp_2048.jpg |
mat_trp | geo_trp | basecolor_mat_trp_2048.jpg , normal_mat_trp_2048.jpg |
Visible effects on the output data (besides the optimization via optimize
operation):
- the scene graph preserved scene depth level of
1
preserved only1
parent node level, in this case:RootNode (gltf orientation matrix)
- reanaming of the exported mesh, material nodes and textures according to the used naming node script:
- adding prefix
geo_
for meshes - adding prefix
mat_
for materials - adding information of the associated material opacity types (
_opq
vs_trp
) - adding node count index where needed (e.g.
_00
) - adding information about texture types (e.g.
normal
) - adding information about texture resolution (e.g.
1024
)
- adding prefix