投影矩阵 [英] Projection Matrix

查看:72
本文介绍了投影矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解投影矩阵背后的数学原理,发现

I tried to understand the mathematics behind the projection matrix and I found this page. The matrix from this page:

我发现这个矩阵类似于Xna的矩阵.

I found this matrix is similar to the matrix of Xna.

我了解它们如何到达矩阵的m33和m44列,但是如何到达m11和m22?而且我不明白,如果我已经给出了视角,为什么必须给出纵横比.

I understood how they got to m33 and m44 columns of the matrix, but how they got to m11 and m22? And I didn't understand why I have to give the aspect ratio if I already give the field of view angle.

我最后想知道的是:从ndc空间转移到窗口空间的方程是什么,以及它们如何到达该方程?

The last thing I want to know is: what is the equation for transfaring from ndc space to window space and how they get to this equation?

推荐答案

您可以通过仅缩放生成的x和y坐标来更改视野:放大它们,将得到较小的视野(放大),按比例缩小它们,您将获得更大的视野(缩小).3D软件中使用的透视投影是直线的,因此,如果您的视场足够大,则边缘处的扭曲将很严重,并且您的视场不能超过180°.

You can change the field of view by just scaling the resulting x and y coordinates: you scale them up, you'll get smaller field of view (zoom in), you scale them down you'll get bigger field of view (zoom out). Perspective projection used in 3D software is rectilinear, so if your field of view is large enough the distortion at the edges will be severe, and you cannot have more than 180° field of view.

您需要长宽比,因为OpenGL和Direct3D中的剪辑坐标是从-1到1.在水平方向上-1是左边,1是右边.在垂直方向上-1是底部,1是顶部.因此,如果您希望正方形真正显示为正方形,则需要使用宽高比缩小X坐标.

You need the aspect ratio, because the clip coordinates in OpenGL and Direct3D run from -1 to 1. In horizontal direction -1 is the left, 1 is the right. On vertical direction -1 is the bottom, 1 is the top. So if you want your squares really appear as a square, you'll need to scale down the X coordinate with the aspect ratio.

这篇关于投影矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆