问题描述
我开始学习3D渲染,并且取得了不错的进步.关于矩阵以及可以对它们执行的一般操作,我学到了很多东西.
I'm starting to learn about 3D rendering and I've been making good progress. I've picked up a lot regarding matrices and the general operations that can be performed on them.
我仍然不太了解的一件事是OpenGL对矩阵的使用.我看到了很多(和类似的东西):
One thing I'm still not quite following is OpenGL's use of matrices. I see this (and things like it) quite a lot:
x y z n
-------
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
所以我最好的理解是,它是一个归一化的(无大小)4维列主矩阵.另外,该矩阵尤其被称为恒等矩阵".
So my best understanding, is that it is a normalized (no magnitude) 4 dimensional, column-major matrix. Also that this matrix in particular is called the "identity matrix".
一些问题:
- 第n个维度是什么?
- 这些方法以及何时应用?
我最大的困惑来自OpenGL如何利用这种数据.
My biggest confusion arises from how OpenGL makes use of this kind of data.
推荐答案
可以帮助您入门的简短答案是,第n个维度(如您所说)不代表任何可可视化的数量.它是作为实用工具添加的,可以实现引起平移和透视投影的矩阵乘法.直观的3x3矩阵无法做到这些.
The short answer that might help you get started is that the 'nth' dimension, as you call it, does not represent any visualizable quantity. It is added as a practical tool to enable matrix multiplications that cause translation and perspective projection. An intuitive 3x3 matrix cannot do those things.
代表空间点的3d值总是添加1作为第四个值,以使该技巧起作用.表示方向的3d值(即法线,如果您熟悉该术语的话)会在第4个位置附加0.
A 3d value representing a point in space always gets 1 appended as the fourth value to make this trick work. A 3d value representing a direction (i.e. a normal, if you are familiar with that term) gets 0 appended in the fourth spot.
这篇关于了解OpenGL矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!