0
votes

I'm trying to render DRC files in browser because of much better compression results than OBJ files. I'm able to render DRC files in browser but I can't add a MTL file to it. My every object has a DRC and a MTL & I want to load/render both in browser.

I first tried using (OBJLoader_MTLLoader_example) https://github.com/mrdoob/three.js/blob/master/examples/webgl_loader_obj_mtl.html but It doesn't seems to be working with DRACOLoader.

Then I tried solution given at https://github.com/google/draco/issues/197 but It's giving error that setMaterials function (in MTLLoader.js) is not defined but It is actually. Please help.

<script 
 src="https://cdn.rawgit.com/mrdoob/three.js/dev/build/three.min.js"> 
</script>
<script src="DDSLoader.js"></script>
<script src="DRACOLoader.js"></script>
<script src="MTLLoader.js"></script>
<script src="geometry_helper.js"></script>

...

//MTL Loader

    THREE.Loader.Handlers.add( /\.dds$/i, new THREE.DDSLoader() );
       new THREE.MTLLoader()
        .load( './bed.mtl', function ( materials ) {
         materials.preload();
         new THREE.DRACOLoader()
        .setMaterials( materials )
  } );

... scene.add(geometry, materials);

Link to entire file: https://pastebin.com/8FSUuSY1

I expect output of a colored 3D object, but actual is black. This means only geometry shows & not colors/material/texture

1
I don't know what DRC format is, but DRACOLoader is a plugin you pass into GLTFLoader.. can you use GLTF format instead of DRC? What is DRC?manthrax

1 Answers

0
votes

I don't know what DRC format is, but DRACOLoader is a plugin you pass into GLTFLoader.. can you use GLTF format instead of DRC?

What is DRC?

Read these:

https://threejs.org/examples/webgl_loader_gltf.html

https://www.khronos.org/blog/gltf-2.0-ecosystem-advancement

https://threejs.org/docs/#examples/loaders/GLTFLoader