投影矩阵 [英] Projection Matrix

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

问题描述

我试图理解投影矩阵背后的数学,我发现 本页.此页面的矩阵:

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天全站免登陆