[Be Solved]GLTF file can not load texture

First,I learned an example of the GLTFLoad ,then I used Blender to build a Model and used glTF-Blender-Exporter export gltf file. when i used GLTFLoad() to load the gltf file,why can’t load the texture. There is no error in the Console.I can find the texture Info .

var gltfLoader = new THREE.GLTFLoader();
      gltfLoader.load( 'assset/test/testgltf1.gltf', function ( gltf ) {
					gltf.scene.position.set(0,2,3);
					scene.add( gltf.scene );
					console.log(gltf.scene.children[0])
				} );

Can you share your model and textures here?

Make sure that you have placed the texture in the same directory as the glTF file so that the loader can find it.

GLTFLoader should fail with an error if it can’t find a texture — when you export from Blender, do you see the texture in the export folder? If not, probably double-check that your materials are configured in a way the exporter understands.

Also be sure to include an error callback when calling .load(), to be sure errors aren’t silenced:

loader.load('foo.gltf', onLoad, undefined, onError);

May also be worth trying the model here: https://gltf-viewer.donmccurdy.com/

.bin .gltf and texture all three files exported through blender are in the same path,i can load the model and no error in the Console . I don’t know WHY NOT show the texture.

I can load the model and no error in the Console . when i through gltf-viewer also can’t show the texture

test the export files

I think you’ll need to share the files if you can. Ideally the four files shown above, as well as the original .blend file. If you can’t share those, could you open the .gltf file in a text editor and verify that the images are mentioned there?

In the Console , i print the gltf.scene.children[0] ,that about Mesh info.image
image ,THX.

I tried to add Diffuse color to Model,it can be show.

The Model is very simple.3D.blend (497.7 KB).thank you .

Please share the glTF, bin, and texture files.

Do you see the image in Blender? When I open the .blend file, I can see that there is supposed to be an image, but it isn’t visible in the 3D view, probably because it isn’t embedded in the .blend file. When I replace it with an image of my own, it exports correctly. Also, are you using KhronosGroup/glTF-Blender-Exporter, or Kupoman/blendergltf, to export?

testgltf1.gltf (4.1 KB)
testgltf1.bin (612 Bytes)
server

I used Kupoman/blendergltf, to export. Can you give me your test image,i want to try it.I thought that as long as the size of the picture is 2 power.

I don’t knows the images is visible in 3D view,just thought it could be Rendered the images is ok.

Your geometry doesn’t have any UVs. I would suggest you try exporting with a different exporter, such as the KhronosGroup/glTF-Blender-Exporter, or make sure the exporter you are using is up to date.

You may need to add UVs in Blender, too. In the Mesh tab, add a “UV Map” :slight_smile:

But typically I also use KhronosGroup/glTF-Blender-Exporter. Only one can be enabled at a time.

1 Like

Thank you very much for solving the problem.It’s great to meet you as a beginner.

Thank you. The problem has been solved

1 Like

I stumbled across this thread in search of an answer.

I checked the fbx file that I converted with FBX2glTF at the following site: https://gltf-viewer.donmccurdy.com/

The object loads completely white. There are six notes for the object (representing the parts)

Code:
MESH_PRIMITIVE_UNUSED_TEXCOORD
Message:
Material does not use texture coordinates sets with indices (0).
Pointer:
/meshes/0/primitives/0/material

  • Format: glTF 2.0
  • Generator: FBX converter by Facebook
  • Primitives: 5

The output from running FBX2glTF file.fbx is two directories:

file_out: which contains
file.gltf
buffer.bin

and

file.fbm: which contains
example.tif.

I was reading elsewhere that three.js might not be able to read the .tif format so I also saved this as a .png.

I can’t get the texture / image to load and need to know what the message was in the FBX GLTF debugger.

example

If anyone has any suggestions they’d be greatly appreciated.