GLB Material not working

Hi everyone!

I rarely ask in forums, but Im having deep troubles with the materials of a GLB character from quaternius(dot)com (Rogue character from the 3D RPG character collection). Importing the model works fine but the material is not showing.

To be specific this is the model in glb format:

and here is the PNG texture/material (I don’t think this is necessary for GLB):

here is the snippet of my code for loading the model

    async _loadPlayerAssets(scene) {
        async function loadPlayer() {
            // create collider for the collision mesh of player
            const outer = MeshBuilder.CreateBox('outer', { width: 2, depth: 1, height: 3 }, scene);
            outer.isVisible = false;
            outer.isPickable = false;
            outer.checkCollisions = true;

            // move box collider to the bottom to match player mesh
            outer.bakeTransformIntoVertices(Matrix.Translation(0, 1.5, 0));

            // for collisions (?)
            outer.ellipsoid = new Vector3(1, 1.5, 1);
            outer.ellipsoidOffset = new Vector3(0, 1.5, 0);

            outer.rotationQuaternion = new Quaternion(0, 1, 0, 0) // back of the player

            return SceneLoader.ImportMeshAsync(null, './models/', 'rogue.glb', scene).then((res) => {
                const root = res.meshes[0];
                // actual player mesh
                const body = root;
                body.parent = outer;
                // prevent self raycast
                body.isPickable = false;
                body.getChildMeshes().forEach(element => {
                    element.isPickable = false;
                });

                // let rougeDaggerTexture = new StandardMaterial('Rouge_Dagger_Texture', this._scene);

                return {
                    mesh: outer,
                    animationGroups: res.animationGroups
                }
            });

        }

        return loadPlayer().then((assets) => {
            this.assets = assets;
        })
    }

From what I know GLB files come with the material applied already, so Im not sure if its the code or the GLB file that’s not working.

The export looks wrong:
image

Basically the materials are in but they are not referencing any textures. You can see the same behaviour in other gltf viewers.

Wow thanks for the fast reply!

Ahhh ok. Im very new to 3d modelling so I have no idea how to fix the exports you mentioned. Do you have any suggestion on how to fix it?

Should I apply the texture manually in my code?

Ohh and I forget to mention that the model comes in with two textures

Rogue_Texture.png
Rogue_Dagger_Texture.png

Im not sure if that helps but could that be the reason why the exports are seperated into two?

You should check with the source software to see why the export does not work, it might also help them :slight_smile:

Ok understood. So basically the GLB file is not working properly.

One last thing, the model comes in with other different formats like .obj, .blend, and FBX. I tried opening it in blender and it seems like the texture is working fine. But once I export it to .glb and open it in Babylon.js or other .gltf/.glb viewer the material is not working.

If anyone wants to try it out, here is the link with the different formats I mentioned above: quaternius.com (rpg characters)
I can’t upload the google drive folder link for some reason

sorry for asking too much :frowning: I have tried using this models for days but its not working somehow, so I’m desperate at this point.

Hey there! I’m also using Quaternius’ models and had this exact same issue, but it’s easy(ish) to fix in the .blend files.

Quaternius’ models use the Diffuse BSDF material type, which isn’t supported by Blender’s GLTF exporter. You’ll need to change it to Principled BSDF before exporting to GLTF.

I wrote an article with the details here:

2 Likes