3

I have used Threejs to load FBX 3D model in scene. Due to different scale of the 3D model, it looks different in viewer.

See the photo: enter image description here

Proper FBX with scale 1 : Download FBX MODEL 1

Problematic FBX with scale 0.1 : Download FBX MODEL 2

Both models should look in same scale, dimension, position and rotation of 3D model?

  • How to handle Camera?
  • How to handle lights? (Currently, there are 2 lights in the viewer.)

Here is the demo link for code review:

      let fbxLoader = new FBXLoader();

      fbxLoader.load(
        objectUrl, //1
        object => {

          scene.add(object);
          object.traverse(it => {
            if (it.isMesh) {
              it.receiveShadow = true;
              it.castShadow = true;
              scope.os = object.scale;
              
            }
          })

          let boxHelper = new THREE.Box3Helper(new THREE.Box3());

          boxHelper.visible = true;
          boxHelper.box.setFromObject(object);

          plane.position.y = boxHelper.box.min.y;

        },
        xhr => {
//          console.log((xhr.loaded / xhr.total) * 100 + "% loaded");
        },
        // called when loading has errors
        error => {
          console.log("An error happened" + error);
        }
      );

My JsFiddle Link : https://jsfiddle.net/43eqnp2f/

0 Answers0