GLB 纹理不适用于场景形式
GLB texture not applying in sceneform
我在 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 模型?
问题在于导出 3D 的方式。它被导出为 FBX,然后转换为 GLB。当更改为导出为具有不同比例的 OBJ,然后转换为 GLB 时。效果很好。
我在 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 模型?
问题在于导出 3D 的方式。它被导出为 FBX,然后转换为 GLB。当更改为导出为具有不同比例的 OBJ,然后转换为 GLB 时。效果很好。