4

I am trying to load quite complex .3ds model into three.js using TDSLoader exactly the same way as in three.js/examples: https://github.com/mrdoob/three.js/blob/master/examples/webgl_loader_3ds.html but what I get looks like this Result when it is supposed to look like this Loaded using https://3dviewer.net/. I can see that this online viewer uses three.js so it is possible. I also know that TDSLoader loads textures but does not map them for some reason (if I move texture out of the folder I get an load resource error). Code looks like this:

var loader = new THREE.TextureLoader();
var normal = loader.load('textures/normal.png');
var loader = new THREE.TDSLoader();
loader.setPath('textures/');
loader.load('textures/CAT_336D.3ds', function (object) {
  object.traverse(function (child) {
    if (child instanceof THREE.Mesh) {
      child.material.normalMap = normal;
    }
  });
  scene.add(object);
});

My model has 23 types of materials but the loader loads only 2 - black and yellow, you can see that glass, metal and others are missing. How do I map all textures and materials? Maybe it does not work because the model is too big? (over 160 meshes, around 30MB)

corashina
  • 1,757
  • 1
  • 13
  • 21
  • Is it possible for you to use `glTF` instead of `3DS`? One solution is to upload the file to sketchfab and export it to `glTF`. BTW: `TDSLoader` does load textures and also assigns them to materials. Only normal maps are not supported. – Mugen87 Sep 10 '18 at 17:51
  • @Mugen87 Yes I did that and it works fine. Problem is that the file is almost two times larger. – corashina Sep 10 '18 at 18:44
  • 1
    You can try to export with the A3dsViewer into three.js – Slider Sep 12 '18 at 02:20

0 Answers0