当前位置:网站首页>GLTF模型添加关节控制
GLTF模型添加关节控制
2022-07-27 17:33:00 【giao00000】
GLTF模型添加关节控制
1. 前言
在Cesium官方示例中提供了一个控制火箭整流罩分离的例子,例子链接CZML Model Articulations。该例子展示了通过控制glb/gltf模型中的articulations来控制模型部分关节的运动。前提条件是模型文件中有articulations属性,本文主要介绍如何在Blender等三维建模软件导出的gltf模型中添加articulations属性。
2. 环境准备
- Blender或其他主流三维建模软件:用于导出gltf模型
- VS Code:需要安装插件
glTF Tools和STK GMDF Tools,分别用于gltf模型预览和注入articulations属性 - 三维模型:可以到 https://github.com/AnalyticalGraphicsInc/gmdf/tree/master/samples 下载
3. 操作步骤
Blender中打开三维模型,以samples\VehicleTest\source\VehicleTest.blend为例,可以看到模型主要包括车身、前轮和后轮三部分,在导出gltf后可以在
nodes属性下找到对应的部分;
导出gltf格式的模型;

VS Code中预览gltf模型,可以看到gltf文件中的nodes包括上文提到的前轮、后轮,下面就可以通过添加属性来控制前后轮的运动;

在VehicleTest.gltf同级目录下创建VehicleTest.gmdf文件,文件内容如下:
{
"AGI_articulations": {
"articulations": [
{
"name": "Wheels",
"stages": [
{
"name": "Drive",
"type": "xRotate",
"minimumValue": -360,
"maximumValue": 360,
"initialValue": 0
}
],
"modelNodes": [
"FrontWheels",
"RearWheels"
]
}
]
}
}
AGI_articulations和articulations都是固定格式,主要关注modelNodes和stages。modelNodes用来说明要控制的模型关节,就是上文中的前后轮;stages用来说明关节如何运动,示例中的type表示运动类型为沿x轴旋转,minimumValue和maximumValue用来控制范围。关于属性字段更加具体的含义可以参考https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/AGI_articulations/README.md#overview
将gmdf文件注入到gltf文件,首先在VS Code中选中
VehicleTest.gltf文件,按住快捷键Ctrl + Shift + P,搜索GMDF,选择命令inject GMDF into glTF,然后就可以看到在gltf文件中有新的内容增加了,在保存后就可以在模型预览界面中看到控制关节运动的操作界面,通过拖动滑块就可以控制轮子的运动;


4. 参考链接
[1]. Cesium示例
[2]. GMDF工具与glTF模型示例
边栏推荐
- 产品经理:排查下线上哪里冒出个“系统异常”的错误提示
- AutoCompleteTextView (input box pre match)
- Chemical giant BASF & Pasqual: using quantum neural network to optimize weather forecast
- [openbmc series] 4. Start the process and use qume to simulate ast2600 EVB
- Function priority
- C171:考勤系统
- C170:复试筛选
- 1.2、基于增量式生成遮挡与对抗抑制的行人再识别(代码理解与实验进度+报告)
- PC博物馆(3) MITS Altair 8800
- 如何运行 kevinchappell / formBuilder
猜你喜欢
随机推荐
统一建模语言 (UML) 规范
Qtexttospeech class of QT realizes voice broadcast function
Fileoutputstream (file storage) and FileInputStream (file reading)
What does bus mean
Global function
Detailed introduction to common coordinate system of cesium
顶级“黑客”能厉害到什么地步?无信号也能上网,专家:高端操作!
程序设计综合实验三
Program design Comprehensive Experiment III
Chemical giant BASF & Pasqual: using quantum neural network to optimize weather forecast
Gesturedetector (gesture recognition)
Gestureoverlayview (gesture recognition 2)
Rodin installs the SMT solvers plug-in
成年人只有一份主业是要付出代价的,被人事劝退后,我哭了一整晚
软件配置 | tigerVNC的下载、安装及配置
GridView (implement table display icon)
11.5.OSPF
C193:评分系统
#yy关于鱼的英文学习
Basic functions of pytorch tensor









