Problem with Collada model without textures

Hello,

I have worked with 2D in Defold for quite some time and have started fiddling around with 3D models recently. Unfortunately, I got stuck quickly…

I have created a model in the Basic 3d project template provided with Defold. I have tried to take a simple, freely available Collada-format model from the kenney_space-kit in order to add it to a Defold gameobject. Adding this model works somewhat - but unexpectedly, the model remains completely black and partly invisible.

The Collada file comes without any textures, but has orange and gray colors that do not get displayed, so I wonder what is wrong?

I created the Defold model object and set its “mesh” property to the “craft_speederA.dae” file and its material to “/builtins/materials/model.material”. There is no texture, so I leave “tex0” empty, just like skeleton, animations and default animation.

When, as an experiment, I do assign any bitmap as the model’s texture (e.g. “brown.png” or “green.png” from the Basic 3d template), the speeder model does get rendered with that texture (in parts), although of course, the texture does not fit the model.

However, just opening the .dae-File in even a very simple viewer (“Preview” on MacOSX), the model is rendered correctly including its colors, as intended by Kenny, but not so in Defold.

Can anyone give me a hint what I am doing wrong?
You can download the very simple example project at https://spaceboom.de/Basic3Dspeeder.zip

Thanks,
Lutz

Please consider Collada as a deprecated format. I suggest that you convert the file to glTF (using Blender or some other tools).

Hi Britzl,

thanks for the quick reply. Ok, I just tried the GLTF format of that model instead, also provided directly by Kenny. I can open that file in Preview/MacOSX and it renders correctly.

In Defold, same setup, just different Mesh file for the model, I now get a render error:

assets/models/craft_speederA.glb
The file ‘/assets/models/craft_speederA.glb’ failed to load:
Cannot read field “skins” because “scene” is null

I have updated the example project under https://spaceboom.de/Basic3Dspeeder.zip.
Any idea?

Thanks,
Lutz

I dropped the glb file on the glTF/glb validator from Khronos and there is actually an error in the file:

https://github.khronos.org/glTF-Validator/

{
    "uri": "craft_speederA.glb",
    "mimeType": "model/gltf-binary",
    "validatorVersion": "2.0.0-dev.3.10",
    "validatedAt": "2024-12-29T22:18:55.321Z",
    "issues": {
        "numErrors": 1,
        "numWarnings": 0,
        "numInfos": 5,
        "numHints": 0,
        "messages": [
            {
                "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": "/meshes/0/primitives/1/attributes/TEXCOORD_0"
            },
            {
                "code": "UNUSED_OBJECT",
                "message": "This object may be unused.",
                "severity": 2,
                "pointer": "/meshes/0/primitives/2/attributes/TEXCOORD_0"
            },
            {
                "code": "UNUSED_OBJECT",
                "message": "This object may be unused.",
                "severity": 2,
                "pointer": "/meshes/0/primitives/3/attributes/TEXCOORD_0"
            },
            {
                "code": "SCENE_NON_ROOT_NODE",
                "message": "Node 1 is not a root node.",
                "severity": 0,
                "pointer": "/scenes/0/nodes/0"
            },
            {
                "code": "UNUSED_OBJECT",
                "message": "This object may be unused.",
                "severity": 2,
                "pointer": "/nodes/0"
            }
        ],
        "truncated": false
    },
    "info": {
        "version": "2.0",
        "generator": "UniGLTF-1.27",
        "extensionsUsed": [
            "KHR_materials_unlit"
        ],
        "resources": [
            {
                "pointer": "/buffers/0",
                "mimeType": "application/gltf-buffer",
                "storage": "glb",
                "byteLength": 17760
            }
        ],
        "animationCount": 0,
        "materialCount": 4,
        "hasMorphTargets": false,
        "hasSkins": false,
        "hasTextures": false,
        "hasDefaultScene": true,
        "drawCallCount": 4,
        "totalVertexCount": 1800,
        "totalTriangleCount": 280,
        "maxUVs": 1,
        "maxInfluences": 0,
        "maxAttributes": 3
    }
}
1 Like

ah. Ok, thanks for pointing that out so quickly. I did not know that tool yet ;o)

Ok, other files from that Kenny set seem to have the same problem. Then I will have to use something else, apparently.

Thanks for your support. Have a great New Year!
Lutz

Our general stance is that we don’t want to have a bunch of hacks in our importer to work around errors in glTF/glb files. The data should be correctly formatted. On the other hand, it gives a bad impression of Defold if other engines are able to import these files despite the errors, so I would like for us to at least take a look at this file in detail and see what exactly goes wrong and if we can import it somehow and give a warning about malformed data. @l.harder could you please create a ticket on GitHub so that we can keep track of this particular problem?

You can probably open the file in Blender and re-export it and/or correct the problem.

ok, done ;o)

Thanks for looking into this.

Regards,
Lutz

1 Like