I have a Perspective Camera with a certain projection matrix ,I just want to extract the fow , near plane and far plane from it. I know there is a function in Three.js :
.updateProjectionMatrix()
it creates a projection matrix based on parameters listed above, basically i want the reverse process.
I have a Perspective Camera with a certain projection matrix ,I just want to extract the fow , near plane and far plane from it. I know there is a function in Three.js :
.updateProjectionMatrix()
it creates a projection matrix based on parameters listed above, basically i want the reverse process.
Share edited Jun 3, 2019 at 15:17 binaryRat asked Jun 3, 2019 at 13:57 binaryRatbinaryRat 3162 silver badges12 bronze badges 3- 1 jsantell./3d-projection – ScieCode Commented Jun 3, 2019 at 14:30
- 1 Possible duplicate: stackoverflow./questions/46182845/… – WestLangley Commented Jun 3, 2019 at 14:45
- From what I read he does not say how to calculate the near and far plane @WestLangley – binaryRat Commented Jun 3, 2019 at 15:10
1 Answer
Reset to default 6I solved with this 3 formulas :
fov = 2 * atan(1/camera.projectionMatrix.elements[5]) * 180 / PI;
near = camera.projectionMatrix.elements[14] / (camera.projectionMatrix.elements[10] - 1.0);
far = camera.projectionMatrix.elements[14] / (camera.projectionMatrix.elements[10] + 1.0);
Sources :
3D Projection
Depose the OpenGL projection matrix
Field of view + Aspect Ratio + View Matrix from Projection Matrix