当前位置:网站首页>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模型示例
边栏推荐
- ACL11.12
- 会员卡头部组件使用文档
- Systemservice (system service)
- 邬贺铨:因地制宜 数字化技术赋能“双碳”实践
- 剑指 Offer 25. 合并两个排序的链表
- Arrayadapter (array adapter) and simpleadapter (simple adapter)
- C# 后台GC 的前因后果
- VALN 11.9
- [IOT] Wei Peng: Interpretation of 6000 + words | seven necessary product management tools for product people in 2022 (version 1.0)
- ACL11.12
猜你喜欢

Sqlife (database)

邬贺铨:因地制宜 数字化技术赋能“双碳”实践

2022 love analysis · smart community manufacturer panoramic report manufacturer solicitation

How to encrypt the data in MySQL database? Mysql8.0 comes with new features

Detailed introduction to common coordinate system of cesium

Systemservice (system service)

Static test. 2021.01 .13
![[paper reading] rich feature hierarchies for accurate object detection and semantic segmentation](/img/a9/690f52b5c4afba684f0add2434888c.png)
[paper reading] rich feature hierarchies for accurate object detection and semantic segmentation

使用VS编译NCNN

Introduction to basic cesium controls
随机推荐
中国业务型CDP白皮书 | 爱分析报告
[pytorch series] detailed explanation of the torchvision image processing library of pytorch
Program design Comprehensive Experiment III
ECU的软硬件架构
Chemical giant BASF & Pasqual: using quantum neural network to optimize weather forecast
深度主动学习综述2020
What does bus mean
Static test. 2021.01 .13
Intent (whether there is return value to jump)
Rodin 安装 SMT Solvers 插件
PMP每日一练 | 考试不迷路-7.27(包含敏捷+多选)
10.31静态路由的扩展配置
mysql函数汇总之系统信息函数
解决 ViewUI 表格无数据时展示滚动条的问题
C# 后台GC 的前因后果
PC博物馆(3) MITS Altair 8800
[Redis] Redis几种部署方式
Container summary
unity2D 动态漫画剧本(给猛虎桥章节做动画演示二)
Sharepreference (storage)