[Be Solved]GLTF file can not load texture

textures

#1

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])
				} );

#2

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.


#3

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/


#4

.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.


#5

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


#6

test the export files


#7

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?


#8

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


,THX.


#9

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


#10

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


#11

Please share the glTF, bin, and texture files.


#12

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?


#14

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


#15

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.


#16

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


#17

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.


#18

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.


Text not getting applied on watch 3d model
#20

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


#21

Thank you. The problem has been solved