我正在Android应用程序中使用sceneform 1.17.1并下载glb来显示它。 我的问题是我有两个3D模型,而一个模型中的图像纹理效果很好。在另一种方法中,图像纹理不适用。
使用khronos gltf验证程序,它们看起来很相似。这是一种很好的方法:
{
"uri": "AviatorApp_98.glb",
"mimeType": "model/gltf-binary",
"validatorVersion": "2.0.0-dev.3.2",
"validatedAt": "2020-08-24T12:53:37.209Z",
"issues": {
"numErrors": 0,
"numWarnings": 0,
"numInfos": 0,
"numHints": 0,
"messages": [],
"truncated": false
},
"info": {
"version": "2.0",
"generator": "Gestaltor 2020.2.1 Alpha 'Zuckerwatte' (CI-38fb8ee1*)",
"resources": [
{
"pointer": "/buffers/0",
"mimeType": "application/gltf-buffer",
"storage": "glb",
"byteLength": 1501852
},
{
"pointer": "/images/0",
"mimeType": "image/jpeg",
"storage": "buffer-view",
"image": {
"width": 1024,
"height": 1024,
"format": "rgb",
"bits": 8
}
},
{
"pointer": "/images/1",
"mimeType": "image/png",
"storage": "buffer-view",
"image": {
"width": 1024,
"height": 1024,
"format": "rgba",
"primaries": "srgb",
"transfer": "srgb",
"bits": 8
}
}
],
"animationCount": 0,
"materialCount": 3,
"hasMorphTargets": false,
"hasSkins": false,
"hasTextures": true,
"hasDefaultScene": true,
"drawCallCount": 3,
"totalVertexCount": 15848,
"totalTriangleCount": 28336,
"maxUVs": 1,
"maxInfluences": 0,
"maxAttributes": 4
}
}
这是不加载纹理的图片:
{
"uri": "ChromanceApp_98_2.glb",
"mimeType": "model/gltf-binary",
"validatorVersion": "2.0.0-dev.3.2",
"validatedAt": "2020-08-24T12:56:29.902Z",
"issues": {
"numErrors": 0,
"numWarnings": 0,
"numInfos": 0,
"numHints": 0,
"messages": [],
"truncated": false
},
"info": {
"version": "2.0",
"generator": "Gestaltor 2020.2.1 Alpha 'Zuckerwatte' (CI-38fb8ee1*)",
"resources": [
{
"pointer": "/buffers/0",
"mimeType": "application/gltf-buffer",
"storage": "glb",
"byteLength": 3235956
},
{
"pointer": "/images/0",
"mimeType": "image/jpeg",
"storage": "buffer-view",
"image": {
"width": 1024,
"height": 1024,
"format": "rgb",
"bits": 8
}
},
{
"pointer": "/images/1",
"mimeType": "image/png",
"storage": "buffer-view",
"image": {
"width": 1024,
"height": 1024,
"format": "rgba",
"primaries": "srgb",
"transfer": "srgb",
"bits": 8
}
}
],
"animationCount": 0,
"materialCount": 3,
"hasMorphTargets": false,
"hasSkins": false,
"hasTextures": true,
"hasDefaultScene": true,
"drawCallCount": 3,
"totalVertexCount": 51070,
"totalTriangleCount": 38324,
"maxUVs": 1,
"maxInfluences": 0,
"maxAttributes": 4
}
}
我在应用程序中没有任何错误。如何显示带有纹理的3D模型?
答案 0 :(得分:0)
问题在于3D的导出方式。它已被导出为FBX,然后转换为GLB。更改时将其导出为具有不同比例的OBJ,然后转换为GLB。效果很好。