在 THREE.js 中,我们使用以下函数构造一个摄像头
const camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000);
我们从光学中知道,相机的视场与焦距有关,公式如下:
FOV = arctan(d/2f)
在哪里
FOV
是以度为单位的垂直 FOV,d
是图像平面的高度,以 mm 为单位,f
是相机的焦距,单位为 mm。看完the documentation在这件事上,似乎
d
默认设置为 35mm / aspectRatio
.我们可以 express
FOV
像这样FOV = arctan((35/(width/height))/2f) = arctan(filmHeight / 2f)
作为健全性检查,我打印了以下值,以查看是否可以取回
75
的输入 FOV .Math.atan(camera.getFilmHeight()/(2 * camera.getFocalLength())) * 180 / Math.PI;
但是..这个值是
37.50000000000001
这恰好是
75
的预期焦距的一半.所以,我想知道我是否在某个地方做错了数学,或者我是否误解了 THREE.js 的报告值。
最佳答案
.fov
Angular 是
Camera frustum vertical field of view, from bottom to top of view, in degrees.
但是你计算的是, View 中心到顶部的 Angular :
Math.atan( (camera.getFilmHeight()/2) / camera.getFocalLength())) * 180 / Math.PI;
这确实是
.fov
的一半:fov = 2 * Math.atan( (camera.getFilmHeight()/2) / camera.getFocalLength())) * 180 / Math.PI;
关于javascript - THREE.js PerspectiveCamera focusLength 相差两倍,与 FOV 不一致,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53881693/