在使用openGL透视图时,我不太确定如何从fovy计算fovx。我在不同的地方阅读不同的东西,在使用我发现的任何一种方法时,我都得不到正确的行为。那么,有没有人可以告诉我,考虑到相机的凹陷和纵横比,我如何计算相机的fovx?如果需要任何其他数据,请让我知道我需要什么。提前谢谢你!
发布于 2011-04-01 02:46:56
正确:
fieldOfViewX = 2 * atan(tan(fieldOfViewY * 0.5) * aspect)
错误,特别是对于大的方面,请参阅@gman的以下评论:
Aspect ratio === width/height
fovy ~= "height"
==> fovx = fovy * aspect
测试:
Fovy = 60 degs
Aspect = 4:3 ~= 1.33
Fovx = 60*1.33 = 80
80/60 = 4:3 (fovs match, yay)
对于“合理的”For /方面,简单的方法是“合理的”接近事实,但如果你有极端的方面,你会得到fovx > 180度,这是你不想要的。
发布于 2013-01-02 10:50:50
发布于 2011-11-04 19:12:46
Java:
double d = (viewportHeight * 0.5) / Math.tan(Math.toRadians(fovY * 0.5));
fovX = (float) (2 * Math.toDegrees(Math.atan((viewportWidth * 0.5) / d)));
https://stackoverflow.com/questions/5504635
复制相似问题