最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to extract camera parameters from Projection matrix - Stack Overflow

programmeradmin0浏览0评论

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
Add a ment  | 

1 Answer 1

Reset to default 6

I 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

发布评论

评论列表(0)

  1. 暂无评论