Closed trevorld closed 2 years ago
Thanks for the report. This isn't something that I'm likely to work on in the near term: a new rgl
release is a higher priority right now, because rgl2gltf
needs some unreleased rgl
features. But if you can track down what the problem is, and possibly submit a PR, I'd be more likely to get to it sooner.
Thanks! Although I'm excited about the possibility of gltf
/ glb
export support for my R package my use cases for this aren't urgent.
The khronos glTF validator gives the following output for my example scene.glb
file:
{
"uri": "scene.glb",
"mimeType": "model/gltf-binary",
"validatorVersion": "2.0.0-dev.3.7",
"validatedAt": "2022-05-06T01:59:29.391Z",
"issues": {
"numErrors": 3,
"numWarnings": 0,
"numInfos": 4,
"numHints": 3,
"messages": [
{
"code": "TYPE_MISMATCH",
"message": "Type mismatch. Property value 0 is not a 'object'.",
"severity": 0,
"pointer": "/materials/1/pbrMetallicRoughness/baseColorTexture"
},
{
"code": "BUFFER_VIEW_TARGET_MISSING",
"message": "bufferView.target should be set for vertex or index data.",
"severity": 3,
"pointer": "/meshes/0/primitives/0/attributes/POSITION"
},
{
"code": "BUFFER_VIEW_TARGET_MISSING",
"message": "bufferView.target should be set for vertex or index data.",
"severity": 3,
"pointer": "/meshes/0/primitives/0/attributes/NORMAL"
},
{
"code": "MESH_PRIMITIVE_ATTRIBUTES_ACCESSOR_INVALID_FORMAT",
"message": "Invalid accessor format '{VEC3, BYTE}' for this attribute semantic. Must be one of ('{VEC3, FLOAT}').",
"severity": 0,
"pointer": "/meshes/0/primitives/0/attributes/NORMAL"
},
{
"code": "MESH_PRIMITIVE_ACCESSOR_UNALIGNED",
"message": "Vertex attribute data must be aligned to 4-byte boundaries.",
"severity": 0,
"pointer": "/meshes/0/primitives/0/attributes/NORMAL"
},
{
"code": "BUFFER_VIEW_TARGET_MISSING",
"message": "bufferView.target should be set for vertex or index data.",
"severity": 3,
"pointer": "/meshes/0/primitives/0/attributes/TEXCOORD_0"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/0/attributes/TEXCOORD_0"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/materials/0"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/textures/0"
},
{
"code": "IMAGE_NPOT_DIMENSIONS",
"message": "Image has non-power-of-two dimensions: 360x144.",
"severity": 2,
"pointer": "/images/0"
}
],
"truncated": false
},
"info": {
"version": "2.0",
"generator": "rgl2gltf version 0.1.14",
"resources": [
{
"pointer": "/buffers/0",
"mimeType": "application/gltf-buffer",
"storage": "glb",
"byteLength": 2728
},
{
"pointer": "/images/0",
"mimeType": "image/png",
"storage": "buffer-view",
"image": {
"width": 360,
"height": 144,
"format": "rgb",
"primaries": "srgb",
"transfer": "srgb",
"bits": 8
}
}
],
"animationCount": 0,
"materialCount": 2,
"hasMorphTargets": false,
"hasSkins": false,
"hasTextures": true,
"hasDefaultScene": false,
"drawCallCount": 1,
"totalVertexCount": 24,
"totalTriangleCount": 12,
"maxUVs": 1,
"maxInfluences": 0,
"maxAttributes": 3
}
}
PR #39 gives a partial fix for this. There are still other issues...
This should now be fixed, though there are likely other minor validation problems -- please report as you find them!
This should now be fixed
Thanks! I upgraded {rgl}
and {rgl2gltf}
and tried four different glTF viewers and my meshes now seem to render in all of them now.
though there are likely other minor validation problems -- please report as you find them!
The khronos glTF validator now reports zero "Errors" and zero "Warnings" and that the "GLB asset is valid". The glTF validator does report the following two (seemingly non-critical) "Infos":
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/materials/0"
},
{
"code": "IMAGE_NPOT_DIMENSIONS",
"message": "Image has non-power-of-two dimensions: 360x144.",
"severity": 2,
"pointer": "/images/0"
}
When exporting textured meshes using
writeGLB()
orwriteglTF()
I can successfully re-import the textured meshes into{rgl}
usingreadGLB()
orreadglTF()
but I haven't found success in viewing such textured meshes in 3rd party glb/gltf viewers such as https://github.khronos.org/glTF-Sample-Viewer-Release/:textured Wavefront obj files used in example: tile.zip
For example Khronos's sample glTF viewer won't show anything and warns that
"Texture is undefined: undefined
when I try to viewscene.glb
. Other glTF viewers will show the mesh but won't render the texture.