Three.js Camera Fit

Fit a Three.js camera to your GLB model. Compare desktop and mobile framing, then copy the camera code into your scene.

Viewport comparison

Survey Wing · Sample model

Desktop

16:9

Mobile

9:16
Drag either view to orbit Shared camera distance

How to fit a Three.js camera to a GLB model

  1. Open a model. Try the wide sample or choose a self-contained .glb file. Your file is processed in your browser.
  2. Compare and fit. Both views start at the same camera distance, so the sides of a wide model can be cut off in portrait. Select Fit both views to calculate a distance for each aspect ratio using the current vertical field of view.
  3. Copy the matching camera. Pick Desktop for 16:9 or Mobile for 9:16. The generated code includes the camera position, target, field of view, and clipping planes. Use it with the model in its original scene coordinates.

When your live canvas changes size, set camera.aspect from its current width and height, then call camera.updateProjectionMatrix(). Read the Three.js responsive rendering guide.