How to apply texture on glb which does not have UV data

I have a glb file which is compressed.
This glb file does not contain the UV data.
I can load this glb file in the Three.js based application.
I want to apply the material with texture on this model.
But since the UV data is not there I am not able to do this.
Can anyone tell me how to apply texture on model even though it does not contains the UV data.
cube.glb (1.7 KB)

You have to compute/provide UVs by yourself. Then you can use geometry.setAttribute("uv", computedUvs); to assign them to the geometry of the loaded model. computedUvs should be a BufferAttribute with two values per vertex.

If that model is a cube (I assume from the filename), then you have to provide just a few of them. You can check this as a starting point: WebGL Textures

The question is, how do you want the texture wrapping on the GLB? UVs exist to answer that, and there are good Blender tutorials on “UV unwrapping” that I would recommend if you’re not familiar with the process. It’s much easier in Blender than in code, when your models become more complex than a cube.

But if you really just have a cube, I would suggest using THREE.BoxGeometry instead of loading a GLB for it, you’ll get UVs automatically that way, and geometry groups so you can put a different texture on each face of the cube. :slight_smile: