正交投影矩阵的公式? [英] Formula for a orthogonal projection matrix?

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

问题描述

我一直在寻找一些东西,似乎无法找到我正在寻找的东西,我找到了规范公式,但是使用这些公式的最佳方法是什么?我必须缩放每个东西单顶点向下?还是有更好的方法?



一个公式可以帮助我,但我也在寻找关于近z和远z平面的解释相对观看者的位置

解决方案

这是一个合理的来源,派生一个 orthogonal project matrix b

考虑以下几点:首先,在眼睛
空间中,您的相机定位在
原点处,并直接在
的z轴上查看;第二,您通常是
希望您的视野范围扩大到
左边的位置,就像右边的
一样,同样远高于
的z轴,如下所示: se,
z轴直接通过您的视图体积的
中心,因此您
具有r = -l和t = -b。在其他
字中,你可以忘记r,l,t,
和b,并且简单地定义
的视图体积,宽度为
w,高度为h ,以及您的
其他裁剪平面f和n。如果你的
将这些替换变成上面的
正交投影矩阵
,你可以得到这个简单的
版本:

以上所有内容都为您提供了一个看起来像这样的矩阵(如果您希望生成的变换矩阵可以处理任意相机的位置和方向,请适当添加旋转和平移)。



LaTeX呈现的正射投影矩阵http://www.codeguru.com/images/article/10123/3dproj20.gif

I've been looking around a bit and can't seem to find just what I"m looking for. I've found "canonical formulas," but what's the best way to use these? Do I have to scale every single vertex down? Or is there a better way?

A formula would really help me out, but I'm also looking for an explanation about the near and far z planes relative the viewer's position

解决方案

Here is a reasonable source that derives an orthogonal project matrix:

Consider a few points: First, in eye space, your camera is positioned at the origin and looking directly down the z-axis. And second, you usually want your field of view to extend equally far to the left as it does to the right, and equally far above the z-axis as below. If that is the case, the z-axis passes directly through the center of your view volume, and so you have r = –l and t = –b. In other words, you can forget about r, l, t, and b altogether, and simply define your view volume in terms of a width w, and a height h, along with your other clipping planes f and n. If you make those substitutions into the orthographic projection matrix above, you get this rather simplified version:

All of the above gives you a matrix that looks like this (add rotation and translation as appropriate if you'd like your resulting transformation matrix to treat an arbitrary camera position and orientation).

A LaTeX rendering of the orthographic projection matrix http://www.codeguru.com/images/article/10123/3dproj20.gif

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

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