How to assign textures for imported gltf model

Heya, so I downloaded a gltf model and am trying to figure out how to map its textures properly. Here you can see the names of the texture files that were included with the model.

Does anyone know which properties of the PBRMaterial each of the textures should be assigned to? This is what I tried so far but I must have it wrong because it doesn’t look right at all compared to the demo for the model, even without using the normal texture, which I’m pretty sure I have completely wrong. :sweat:

PS I don’t think I should post the model because I purchased just a single entity usage license, otherwise would make a PG for it. :slightly_smiling_face:

material.albedoTexture = new BABYLON.Texture("./robot_1/textures/Robot_1_baseColor.png");
material.emissiveTexture = new BABYLON.Texture("./robot_1/textures/Robot_1_emissive.png");
material.metallicTexture = new BABYLON.Texture("./robot_1/textures/Robot_1_metallicRoughness.png");
material.lightmapTexture = new BABYLON.Texture("./robot_1/textures/Robot_1_normal.png");

material.useRoughnessFromMetallicTextureAlpha = true;
//material.useRoughnessFromMetallicTextureGreen = true;

Drop everything, textures included, to Sandbox and save as GLB.
Then you’ll have some reference, at least. I usually do this with GLTF Sketchfab models.
Also, after that you may comfortably load GLB instead of GLTF and all corresponding textures.

1 Like

Thanks Labris, I’ll give that a try after dinner and report back, sounds promising thou! :grinning: :beers:

1 Like

I tried dropping everything into the Sandbox but it doesn’t seem to support the png texture files: the console has the error “Unable to find a plugin to load .png files.” I wonder if I need to convert the texture files to another format? :thinking:

Something wrong with your files or their relative paths. Did you drop all Texture folder to Sandbox or just images as separate files?
PNG and JPG are default GLTF texture formats - glTF™ 2.0 Specification - and they work in Sandbox.

3 Likes

From checking the sandbox inspector’s validation details, it turns out there are actually validation errors. I think I will check in with the model’s creator about it tomorrow. Thanks for your help! :slightly_smiling_face:

1 Like