How to apply textures to a drc


I have a drc file and a texture file(jpg).

I want to load the drc model and apply the texture to it.

Loading the drc model succeeded. But applying the texture failed.

my code:

const loader = new DRACOLoader();

loader.load(url, (geometry) => {
    const textureLoader = new THREE.TextureLoader();
    const material = new THREE.MeshStandardMaterial({ map: textureLoader.load(textureUrl) });
    const mesh = new THREE.Mesh(geometry, material);

The code looks OK, can you share a demo or the .drc file?

Note that a mesh must have UVs to use textures. You can check for that if geometry.attributes.uv exists.

More commonly people use glTF/GLB files with internal Draco compression, instead of .drc files, then you can have the compressed mesh and the textures all packaged into one file.

1 Like