0

We have a model loaded on Three JS Fiber and we see some projects that load a similar model but their camera looks more steady and looks like the they have and standard to make it look like its bigger in front like a build.

enter image description here

But on our model we have the next:

enter image description here

We use some calculations on a Perspective Camera for the near and far updating the matrix like:

// Creamos la cámara
        const fov = 75;
        const near = 0.1;
        const far = 1000;
        camera.position.z = 5;
        camera.aspect = gl.domElement.clientWidth / gl.domElement.clientHeight;
        camera.updateProjectionMatrix();

        // Establecemos el aspect ratio de la cámara para que coincida con el del renderizador
        const updateCameraAspect = () => {
          camera.aspect = gl.domElement.clientWidth / gl.domElement.clientHeight;
          camera.updateProjectionMatrix();
        };

        // Llamamos a la función updateCameraAspect cada vez que el tamaño del canvas cambia
        window.addEventListener("resize", updateCameraAspect);
        updateCameraAspect();

But as you see our camera looks to near and not as we desire as the first image.

Any advice?

Last comment update:

enter image description here

Ulises
  • 406
  • 7
  • 22

1 Answers1

1

You’re getting some unrealistic angles because your field-of-view is pretty wide. Try something between 30-45 degrees, and it’ll look closer to a regular camera lens.

Keep in mind that a narrower FOV will require you to move the camera back a bit to fit the barn in the frame. Also, I’m not sure why you’re declaring const fov = xx and then you don’t use that value anywhere. Try updating the camera property directly, like:

camera.fov = 40;
camera.near = 0.1;
camera.far = 100;
camera.position.z = 10;
M -
  • 26,908
  • 11
  • 49
  • 81
  • Thanks for your response Marq, that make sense let me try this – Ulises Apr 05 '23 at 20:31
  • As we added the change and set the parameters directly and it looks a little bit better but we feel the vertical fov still looks stretched – Ulises Apr 05 '23 at 20:46
  • There are many reasons why it could look vertically stretched. Could be the canvas, or the scale of the Mesh. I'd need to see a live example to give you a definitive reason. – M - Apr 05 '23 at 23:29