The Balsam tool is a command line application that is part of Qt Quick 3D's asset conditioning pipeline. The purpose is to take assets created in digital content creation tools like Maya , 3ds Max ,或 Blender and convert them into an efficient runtime format for use with Qt Quick 3D. It is not possible, nor does it make sense to reference the interchange formats directly in applications because a large amount of resources are needed to parse and condition the content of the asset before it is usable for realtime rendering. Instead the interchange formats can be converted via the Balsam tool into QML Components and resources like geometry and textures.
用法:
balsam [options] sourceFilename
To convert a 3D asset contained in the file
testModel.fbx
with
balsam
the following command would be used:
balsam testModel.fbx
This would generate the following files:
meshes/testModel.mesh
TestModel.qml
Which can then be used in a Qt Quick 3D project by using that QML Component:
import QtQuick3D 1.15 TestModel { id: modelInstance }
Some of the formats supported also allow for either embedding or referencing of texture assets. These assets are also supported, provided Qt also has support for them.
The Balsam tool also has support for converting projects created with Qt 3D Studio into Qt Quick 3D QML projects.
The conversion of Qt 3D Studio projects does have some limitations due to differences in features available. Features such as Effects and CustomMaterials are not available and will not be generated. There is also some differences in how Animations are implemented, so there can be differences in behavior on conversion. The conversion process will not be 100% and it is expected that some adjustments will be necessary, but should ease the porting process for existing projects.
下表列出的命令行选项识别通过
balsam
when converting asset files:
注意: For each boolean option it is possible to use --disable-<option-name>
选项 | 描述 |
---|---|
--outputPath, -o <outputPath>
|
Sets the location to place the generated file(s). Default is the current directory. |
--calculateTangentSpace
|
Calculates the tangents and bitangents for the imported meshes. |
--joinIdenticalVertices
|
Identifies and joins identical vertex data sets within all imported meshes. |
--generateNormals
|
Generates normals for all faces of all meshes. |
--generateSmoothNormals
|
Generates smooth normals for all vertices in the mesh. |
--splitLargeMeshes
|
Splits large meshes into smaller sub-meshes. |
--preTransformVertices
|
Removes the node graph and pre-transforms all vertices with the local transformation matrices of their nodes. |
--limitBoneWeights
|
Limits the number of bones simultaneously affecting a single vertex to a maximum value (4). |
--improveCacheLocality
|
Reorders triangles for better vertex cache locality. |
--removeRedundantMaterials
|
Searches for redundant/unreferenced materials and removes them. |
--fixInfacingNormals
|
Tries to determine which meshes have normal vectors that are facing inwards and inverts them. |
--findDegenerates
|
This step searches all meshes for degenerate primitives and converts them to proper lines or points. |
--findInvalidData
|
This step searches all meshes for invalid data, such as zeroed normal vectors or invalid UV coords and removes/fixes them. This is intended to get rid of some common exporter errors. |
--transformUVCoordinates
|
This step applies per-texture UV transformations and bakes them into stand-alone texture coordinate channels. |
--findInstances
|
This step searches for duplicate meshes and replaces them with references to the first mesh. |
--optimizeMeshes
|
A postprocessing step to reduce the number of meshes. |
--optimizeGraph
|
A postprocessing step to optimize the scene hierarchy. |
--globalScale
|
This step will perform a global scale of the model. |
--globalScaleValue <value>
|
Global Scale factor used by
--globalScale
.
|
--dropNormals
|
Drops normals for all faces of all meshes. |
--removeComponentNormals
|
Removes Normal component from meshes. |
--removeComponentTangentsAndBitangents
|
Removes Tangents and Bitangents components from meshes. |
--removeComponentColors
|
Removes any Color components from meshes. |
--removeComponentUVs
|
Removes any UV components from meshes. |
--removeComponentBoneWeights
|
Removes any bone weights from meshes. |
--removeComponentAnimations
|
Removes any animation components from meshes. |
--removeComponentTextures
|
Removes any embedded texture components from meshes. |
--fbxPreservePivots
|
Preserves extra pivot nodes created by FBX assets (can create deep node hierarchies) |
下表列出的命令行选项识别通过
balsam
when converting Qt 3D Studio projects:
选项 | 描述 |
---|---|
--createProjectWrapper
|
Creates a wrapper Window component for the imported UIA project. Only valid for UIA imports. |
--createIndividualLayers
|
Creates an individual component for each layer instead of including layer contents in presentation components. |
--framesPerSecond <value>
|
Specifies how many animation frames are created per second in animations. |