如何从投影矩阵中提取相机参数

bin*_*Rat 1 javascript projection-matrix three.js

我有一个具有一定投影矩阵的透视相机,我只想从中提取流、近平面和远平面。我知道 Three.js 中有一个函数:

.updateProjectionMatrix()
Run Code Online (Sandbox Code Playgroud)

它根据上面列出的参数创建一个投影矩阵,基本上我想要相反的过程。

bin*_*Rat 5

我用这3个公式解决了:

fov = 2 * atan(1/camera.projectionMatrix.elements[5]) * 180 / PI;

附近=camera.projectionMatrix.elements[14] / (camera.projectionMatrix.elements[10] - 1.0);

=camera.projectionMatrix.elements[14] / (camera.projectionMatrix.elements[10] + 1.0);

资料来源:

3D投影

分解OpenGL投影矩阵

视野 + 纵横比 + 投影矩阵的视图矩阵