Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qtquick3d-tool-balsam.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2019 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\page qtquick3d-tool-balsam.html
6
\title Balsam Asset Import Tool
7
\brief Tool for importing assets for use with Qt Quick 3D
8
9
The Balsam tool is an application that is part of Qt Quick 3D's
10
asset conditioning pipeline. The purpose is to take assets created in digital
11
content creation tools like
12
\l{https://www.autodesk.com/products/maya/overview}{Maya},
13
\l{https://www.autodesk.com/products/3ds-max/overview}{3ds Max}, or
14
\l{https://www.blender.org/}{Blender} and convert them into an efficient runtime
15
format for use with Qt Quick 3D. It is not possible, nor does it make sense to
16
reference the interchange formats directly in applications because a large amount
17
of resources are needed to parse and condition the content of the asset before it
18
is usable for realtime rendering. Instead the interchange formats can be
19
converted via the Balsam tool into QML Components and resources like geometry and
20
textures.
21
22
\section1 Balsam Command Line Tool
23
24
To run Balsam through the command line, call the \c balsam executable like
25
this:
26
27
\code
28
balsam [options] sourceFilename
29
\endcode
30
31
To convert a 3D asset contained in the file \c testModel.fbx with \c balsam
32
the following command would be used:
33
34
\code
35
balsam testModel.fbx
36
\endcode
37
38
This would generate the following files:
39
\list
40
\li \c meshes/testModel.mesh
41
\li \c TestModel.qml
42
\endlist
43
44
Which can then be used in a Qt Quick 3D project by using that QML Component:
45
\code
46
import QtQuick3D
47
48
TestModel {
49
id: modelInstance
50
}
51
\endcode
52
53
\note The generated mesh filename depends on the mesh name(s) defined in the
54
source file (in this example, the FBX file) and may differ from
55
\c{testModel.mesh}.
56
57
\section1 Balsam UI
58
59
There is also a GUI frontend for Balsam called \c balsamui that is shipped
60
alongside the \c balsam executable. In \c balsamui you can select your input
61
files and output directory and the command-line options of the \c balsam
62
executable are mapped to interactive elements:
63
64
\image balsamui.webp "A screenshot of the Balsam UI application."
65
66
\section1 Supported 3D Asset Types
67
68
\list
69
\li Wavefront (.obj)
70
\li COLLADA (.dae)
71
\li FBX (.fbx)
72
\li STL (.stl)
73
\li PLY (.ply)
74
\li GLTF2 (.gltf, .glb)
75
\endlist
76
77
Some of the formats supported also allow for either embedding or referencing of
78
texture assets. These assets are also supported, provided Qt also has support
79
for them.
80
81
\section1 Baking for Image-Based Lighting
82
83
Balsam also supports generating a pre-filtered cubemap image from .hdr
84
files. Specifying a file with .hdr extension as the input results in generating
85
a file with the same name but with an extension of .ktx. The application can
86
then ship the resulting .ktx file and reference that from the \l Texture
87
associated with \l SceneEnvironment::lightProbe. This avoids the costly runtime
88
processing that is necessary for image-based lighting. See \l{Pre-generating IBL
89
cubemap} for more details.
90
91
\section1 Supported Options
92
93
The following table lists the command-line options recognized by \c balsam when
94
converting asset files:
95
96
\note For each boolean option it is possible to use \c{--disable-<option-name>}.
97
98
\table
99
\header \li Option \li Description
100
\row \li \c {--outputPath, -o <outputPath>} \li Sets the location to place the
101
generated file(s). Default is the current directory.
102
\row \li \c {--calculateTangentSpace} \li Calculates the tangents and
103
bitangents for the imported meshes.
104
\row \li \c {--joinIdenticalVertices} \li Identifies and joins identical vertex
105
data sets within all imported meshes.
106
\row \li \c {--generateNormals} \li Generates normals for all faces of all
107
meshes.
108
\row \li \c {--generateSmoothNormals} \li Generates smooth normals for all
109
vertices in the mesh.
110
\row \li \c {--splitLargeMeshes} \li Splits large meshes into smaller
111
sub-meshes.
112
\row \li \c {--preTransformVertices} \li Removes the node graph and
113
pre-transforms all vertices with the local transformation matrices of
114
their nodes.
115
\row \li \c {--improveCacheLocality} \li Reorders triangles for better vertex
116
cache locality.
117
\row \li \c {--removeRedundantMaterials} \li Searches for
118
redundant/unreferenced materials and removes them.
119
\row \li \c {--fixInfacingNormals} \li Tries to determine which meshes have
120
normal vectors that are facing inwards and inverts them.
121
\row \li \c {--findDegenerates} \li This step searches all meshes for
122
degenerate primitives and converts them to proper lines or points.
123
\row \li \c {--findInvalidData} \li This step searches all meshes for invalid
124
data, such as zeroed normal vectors or invalid UV coords and removes/fixes
125
them. This is intended to get rid of some common exporter errors.
126
\row \li \c {--transformUVCoordinates} \li This step applies per-texture UV
127
transformations and bakes them into stand-alone texture coordinate channels.
128
\row \li \c {--findInstances} \li This step searches for duplicate meshes and
129
replaces them with references to the first mesh.
130
\row \li \c {--optimizeMeshes} \li A postprocessing step to reduce the number
131
of meshes.
132
\row \li \c {--optimizeGraph} \li A postprocessing step to optimize the scene
133
hierarchy.
134
\row \li \c {--useFloatJointIndices} \li Stores joint indices as floating point
135
numbers for GLES 2.0.
136
\row \li \c {--globalScale} \li This step will perform a global scale of the
137
model.
138
\row \li \c {--globalScaleValue <value>} \li Global Scale factor used by
139
\c --globalScale.
140
\row \li \c {--dropNormals} \li Drops normals for all faces of all meshes.
141
\row \li \c {--removeComponentNormals} \li Removes Normal component from
142
meshes.
143
\row \li \c {--removeComponentTangentsAndBitangents} \li Removes Tangents and
144
Bitangents components from meshes.
145
\row \li \c {--removeComponentColors} \li Removes any Color components from
146
meshes.
147
\row \li \c {--removeComponentUVs} \li Removes any UV components from meshes.
148
\row \li \c {--removeComponentBoneWeights} \li Removes any bone weights from
149
meshes.
150
\row \li \c {--removeComponentAnimations} \li Removes any animation components
151
from meshes.
152
\row \li \c {--removeComponentTextures} \li Removes any embedded texture
153
components from meshes.
154
\row \li \c {--fbxPreservePivots} \li Preserves extra pivot nodes created by
155
FBX assets (can create deep node hierarchies)
156
\row \li \c {--generateMipMaps} \li Force all imported texture components to
157
generate mip maps for mip map texture filtering
158
\row \li \c {--useBinaryKeyframes} \li Record keyframe data as binary files
159
160
\row \li \c {--generateLightmapUV} \li Perform lightmap UV unwrapping and
161
generate an additional UV channel for the meshes. This UV data is then used by
162
the \l{Lightmaps and Global Illumination}{lightmap baker and during run-time
163
lightmapping}.
164
165
\row \li \c {--generateMeshLevelsOfDetail} \li When possible create mesh Levels
166
of Detail by automatically simplifying the source mesh.
167
168
\row \li \c {--recalculateLodNormals} \li Calculate new normals when necessary
169
for Generated Mesh levels of detail.
170
171
\row \li \c {--recalculateLodNormalsMergeAngle <value>} \li Maximum angle in
172
degrees to consider for normal smoothing/merging when recalculating normals
173
for Generated Mesh levels of detail.
174
175
\row \li \c {--recalculateLodNormalsSplitAngle <value>} \li Maximum angle in
176
degrees to consider for normal spliting when recalculating normals for
177
Generated Mesh levels of detail.
178
179
\endtable
180
181
*/
qtquick3d
src
quick3d
doc
src
qtquick3d-tool-balsam.qdoc
Generated on
for Qt by
1.14.0