我有一个 gltf,它是一组建筑。
我想为每个建筑物添加一些信息,为此,我需要向我的 gltf 模型添加一些属性。
但是,我试着添加这样的东西
{
"accessors": [
{
"name": "object_1_1_0_positions",
"componentType": 5126,
"count": 4,
"min": [
-232.96347045898438,
3.5689821243286133,
-204.4241485595703
],
"max": [
-230.46347045898438,
35.427982330322266,
-204.4241485595703
],
"properties" : { "description" : "my description 1" }
"type": "VEC3",
"bufferView": 0,
"byteOffset": 0
},
{
"name": "object_1_1_0_normals",
"componentType": 5126,
"count": 4,
"min": [
-0.1212499663233757,
0,
0.9926220178604126
],
"max": [
-0.1212499663233757,
0,
0.9926220178604126
],
"properties" : { "description" : "my description 2" }
"type": "VEC3",
"bufferView": 1,
"byteOffset": 0
},
.....
}
但这破坏了 gltf。
如何向 gltf 添加一些元数据?
最佳答案
glTF 规范允许通过 extras
属性将元数据附加到对象:
https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#reference-extras
"extras" : { "description" : "my description 2" }
此外,不要忘记在属性后加上逗号——此更改必须是有效的 JSON。
关于gltf - 如何在 gltf 文件上添加元数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57073016/