Texture Not Displaying After Loading it unto gltf model

The model must have UVs. UVs are how you define where the texture appears on a mesh. Without them, the texture will not appear on the mesh at all.

gltfjsx makes it easier to specify which meshes in your model you apply textures too (if the model has multiple meshes), but still, all the meshes must have UVs to define where the texture goes on the mesh.

I tried going on blender to get the uvs but I still had no luck so i decided to start from scratch I took a model from threejs examples in order to add the material to it here is the link to the threejs model I loaded. Can you try and see if you can manipulate the texture on flower?

Also if possible could you send a model that has UV vectors so i can try it on that?

The flower also has no UVs, because it is not designed to be used with textures. Built-in geometries like THREE.BoxGeometry will have UVs. Or BoomBox.glb would be an example of a glTF model with UVs.

I would caution that it’s not just about finding a model with any UVs. UVs are designed to wrap specific textures onto a specific mesh. If the mesh’s UVs are not designed for your texture, or (more often) the texture is not designed for the mesh’s UVs it’s unlikely to look the way you want and you’d need to edit the UV layout to fix that. I would recommend searching youtube tutorials for “blender uv unwrapping” to see how this works.

2 Likes

Thank you so much for the model with that model I was able to get this.

Screenshot 2024-06-26 091022

Although the shade is a bit lighter than the texture I assume that has to do with light so now i am trying to cross reference the difference between my model and the model provided.

@donmccurdy is right you would need UV’s to apply the texture, the model you uploaded doesn’t have separate nodes the reason why you can’t apply the texture on it. Again my model had separate nodes which makes it easier to define where to apply the texture

So I implemented the UV’s on the model I had I and I was able to get this.

Thank you @donmccurdy, @AshhadDevLab and @manthrax for helping me with this.

2 Likes

I agree it’s probably lighting, but just for completeness — I would recommend specifying a color space each time you load a texture. In this case it would be sRGB.

texture.colorSpace = THREE.SRGBColorSpace;
1 Like