简体   繁体   English

透视投影矩阵的通用公式

[英]General Formula for Perspective Projection Matrix

Can anyone please tell me what is the general formula to implement the Perspective Projection Matrix? 谁能告诉我实现“透视投影矩阵”的通用公式是什么? I'm trying to implement a way to generate this matrix in order to use it for a game engine I'm working on. 我正在尝试实现一种生成此矩阵的方法,以便将其用于我正在开发的游戏引擎。

Ok so basically with some help from @spektre and a friend of mine I was able to figure out how to really do this. 好的,基本上,在@spektre和我的一个朋友的帮助下,我能够弄清楚如何真正做到这一点。 Pretty much the formula I used was this: 我使用的公式几乎是这样的:

透视投影公式

So pretty much what you need to make this matrix is a function that receives 4 arguments which are the following: 因此,制作此矩阵所需的几乎是一个函数,该函数接收以下四个参数:

  • zFar zFar
  • zNear zNear
  • Aspect Ratio 长宽比
  • Field of View 视场

If you want to know more about these fields and the matrix itself my advice is to head over to WebGL 3D Perspective to actually see this working. 如果您想了解有关这些字段和矩阵本身的更多信息,我的建议是前往WebGL 3D Perspective实际查看此工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM