问题描述
谁能告诉我实现透视投影矩阵"的通用公式是什么?我正在尝试实现一种生成该矩阵的方法,以便将其用于我正在开发的游戏引擎.
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.
推荐答案
好吧,基本上,在@spektre和我的一个朋友的帮助下,我能够弄清楚如何真正做到这一点.我使用的公式几乎是这样:
Ok so basically with some help from @spektre and a friend of mine I was able to figure out how to really do this. Pretty much the formula I used was this:
制作该矩阵所需的几乎是一个函数,该函数接收以下4个参数:
So pretty much what you need to make this matrix is a function that receives 4 arguments which are the following:
- zFar
- zNear
- 纵横比
- 视场
如果您想进一步了解这些字段和矩阵本身,我的建议是转到"WebGL 3D透视" 才能真正看到此效果.
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.
这篇关于透视投影矩阵的通用公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!