Balsam资产导入工具

Balsam是QtQuick3D的一部分,是一个命令行工具,用于将Maya、3dsMax、Blender等创建的3D资产转换为适用于实时渲染的高效格式。它支持多种3D格式,包括Wavefront .obj、COLLADA .dae、FBX .fbx等。工具提供了多个选项,如计算切线、优化网格、烘焙光照贴图等,以提高性能和资源效率。此外,Balsam还处理纹理资源和基于图像的照明烘焙,帮助减少运行时处理成本。

Balsam Asset Import Tool

Balsam资产导入工具

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 Maya3ds Max, or 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工具是一个命令行应用程序,是Qt Quick 3D资产调节管道的一部分。其目的是获取在数字内容创建工具(如Maya、3ds Max或Blender)中创建的资源,并将其转换为有效的运行时格式,以便与Qt Quick 3D一起使用。在应用程序中直接引用交换格式是不可能的,也没有意义的,因为需要大量资源来解析和调整资产的内容,然后才能将其用于实时呈现。相反,交换格式可以通过Balsam工具转换为QML组件和资源,如几何体和纹理。

Usage:

用法:

balsam [options] sourceFilename

Example Usage

示例用法

To convert a 3D asset contained in the file testModel.fbx with balsam the following command would be used:

转换文件testModel.fbx中包含的三维资源,将使用以下命令:

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:

然后可以通过使用QML组件在Qt Quick 3D项目中使用:

import QtQuick3D

TestModel {
   id: modelInstance
}

Supported 3D Asset Types

支持的3D资产类型

  • Wavefront (.obj)
  • COLLADA (.dae)
  • FBX (.fbx)
  • STL (.stl)
  • GLTF2 (.gltf, .glb)

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.

支持的某些格式还允许嵌入或引用纹理资源。这些资产也受到支持,前提是Qt也支持它们。

Baking for Image-Based Lighting

基于图像的照明烘焙

Balsam also supports generating a pre-filtered cubemap image from .hdr files. Specifying a file with .hdr extension as the input results in generating a file with the same name but with an extension of .ktx. The application can then ship the resulting .ktx file and reference that from the Texture associated with SceneEnvironment::lightProbe. This avoids the costly runtime processing that is necessary for image-based lighting. See Pre-generating IBL cubemap for more details.

​Balsam还支持从.hdr文件生成预过滤的立方体映射图像。将扩展名为.hdr的文件指定为输入会生成一个名称相同但扩展名为.ktx的文件。然后,应用程序可以发送生成的.ktx文件,并从与SceneEnvironment::lightProbe关联的纹理中引用该文件。这避免了基于图像的照明所需的昂贵的运行时处理。有关详细信息,请参见预生成IBL立方体映射。

Supported Options

支持的选项

The following table lists the command-line options recognized by balsam when converting asset files:

下表列出了balsam在转换资产文件时识别的命令行选项:

Note: For each boolean option it is possible to use --disable-<option-name>

注意:对于每个布尔选项,可以使用--disable-<选项名称>

OptionDescription
--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.

移除节点图并使用其节点的局部变换矩阵预变换所有顶点。

--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.

此步骤将搜索所有网格中的无效数据,如归零的法向量或无效的UV坐标,并删除/修复它们。这是为了消除一些常见的导出器错误。

--transformUVCoordinates

This step applies per-texture UV transformations and bakes them into stand-alone texture coordinate channels.

此步骤应用每纹理UV变换并将其烘焙到独立纹理坐标通道中。

--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.

优化场景层次的后处理步骤。

--useFloatJointIndices

Stores joint indices as floating point numbers for GLES 2.0.

将联合索引存储为GLES 2.0的浮点数。

--globalScale

This step will perform a global scale of the model.

此步骤将执行模型的全局缩放。

--globalScaleValue <value>

Global Scale factor used by --globalScale.

--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.

从网格中删除任何UV组件。

--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)

保留由FBX资源创建的额外轴节点(可以创建深度节点层次)

--generateMipMaps

Force all imported texture components to generate mip maps for mip map texture filtering

强制所有导入的纹理组件生成用于mip贴图纹理过滤的mip贴图

--useBinaryKeyframes

Record keyframe data as binary files

将关键帧数据记录为二进制文件

--generateLightmapUV

Perform lightmap UV unwrapping and generate an additional UV channel for the meshes. This UV data is then used by the lightmap baker and during run-time lightmapping.


执行光照贴图UV展开并为网格生成额外的UV通道。然后,该UV数据由光照贴图面包师在运行时光照贴图期间使用。

© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

        你是否想用 Python 打造专业桌面客户端?你是否在寻找一门系统全面、案例实战驱动的 QtQuick 视频教程?这门课程就是为你量身定制的!  本课程通过 10大模块、多个实战项目,手把手带你掌握 PySide6 + QtQuick 的核心开发技能,最终实现一个高度还原的「剪映」客户端。无论你是 Python 爱好者,还是 Qt 桌面开发者,这门课都能帮你快速提升!课程亮点一览全平台开发环境搭建(Win11 & macOS)掌握 QML 常用控件与布局深入理解 Python 与 QML 的双向交互掌握 QML 动画与 Canvas 绘图模型-视图-代理 MVD 编程模式玩转 QtQuick3D,轻松构建3D场景完整项目实战:高仿剪映 PC 客户端课程总结+进阶学习路线指导课程章节介绍第1章:开发环境全攻略  从零配置开发环境:Miniconda 安装、PySide6 配置、PyCharm & VS Code 开发调试、macOS 与 Win11 跨平台部署,让你轻松开始 QtQuick 编程之旅!第2章:QML 核心控件全面掌握  掌握 Item、Window、ApplicationWindow 等窗口根对象,文本/图片/按钮、CheckBox、RadioButton、ComboBox、SpinBox等控件的使用,还将实现一个视频进度调节的 Slider与视频播放控件。第3章:布局系统与组件机制  详细讲解行列布局、栅格布局、流式布局、Component、Loader、Repeater 等关键概念,最后实现一个综合案例:自定义电池控件。第4章:Python × JS × QML 高效交互  系统讲解 Python 注册 QML 的四种方式、QML 调用 Python 方法、信号槽机制、值绑定、鼠标/键盘事件处理,让你实现Python 与前端 QML 的无缝通信!第5章:QML 动画系统实战  掌握缩放、旋转、State 状态切换、NumberAnimation 数值动画、Behavior 行为动画、动画控制启动与停止 —— 为你的应用增添高级动态体验!第6章:模型-视图-代理 MVD 精讲  详细解析 ListView、GridView、TableView 等复杂控件使用,配合 DelegateChooser 实现高灵活的代理渲染效果,助力你构建数据驱动的 UI 界面。第7章:Canvas 绘图:打造炫酷 UI  深入 Canvas 编程,绘制路径、圆弧、文本,并结合项目案例,开发一个动态汽车仪表盘,提升界面表现力!第8章:QtQuick3D:迈入三维开发  从 View3D 的基本使用到复杂属性控制,掌握材质、纹理、光照、天空盒、实例化渲染等核心内容,最终完成两个3D项目:3D 茶壶 与 3D 多形态机器人!第9章:项目实战:高仿剪映 PC 客户端  将前面所学内容应用于真实项目,完整实现一个桌面级视频编辑客户端,真正做到学以致用。项目截图如下:  首页  剪辑主窗口  导出窗口第10章:课程总结与进阶建议  回顾全程知识点,规划你的 QtQuick 技术进阶路线,让你少走弯路,技能持续成长!适合人群想快速入门 QtQuick 桌面开发的 Python 开发者有 PyQt / C++ Qt 基础,想转向更现代的 PySide6/QML 开发者UI 工程师、工具开发人员、开源爱好者对剪映客户端等专业项目实现感兴趣的进阶程序员你将获得230页精美课件完整的源代码 & 项目素材持续更新答疑 & 技术支持结课后具备独立构建 QtQuick 应用的能力不止是教程,更是一次实战成长之旅!  立即加入课程,掌握 PySide6 QtQuick 开发的核心技能,开启你的桌面应用进阶之路!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值