Calculate the vertical FOV from focal length
To set the camera’s vertical field of view (FOV) using focal length, sensor width, and aspect ratio:
How to implement
Using npm :
npm install @a3d-viewer/viewer
Implementation :
import { focalToFov } from '@a3d-viewer/viewer'
const focal = 50 // mm
const sensorWidth = 36 // mm
const width = viewer.offsetWidth
const height = viewer.offsetHeight
const verticalFov = focalToFov(focal, sensorWidth, width, height)
viewer.viewerDetails.camera.fov = verticalFov
This allows you to set the camera FOV based on real-world lens parameters.
Last updated on