graphics - 你如何确定俯视向量?

标签 graphics linear-algebra

这是摘自 计算机图形学基础 通过彼得雪莉。在第 114 页(在第 3 版中它写道:

We'd like to be able to change the viewpoint in 3D and look in any direction. There are a multitude of conventions for specifying viewer position and orientation. We will use the following one:

  • the eye position e
  • the gaze direction g
  • the view-up vector t

The eye position is a location that the eye "sees from". If you think of graphics as a photographic process, it is the center of the lens. The gaze direction is any vector in the direction that the viewer is looking. The view-up vector is any vector in the plane that both bisects the viewer's head into right and left halves and points "to the sky" for a person standing on the ground. These vectors provide us with enough information to set up a coordinate system with origin e and uvw basis.....



粗体的句子是最让我困惑的句子。不幸的是,这本书只提供了非常基本和粗略的图表,并没有提供任何示例。

这句话是否意味着所有的向上 View 向量都只是 (0, 1, 0) ?

我在一些示例上尝试过,但它与给定的解决方案不太匹配(尽管有时很接近)。

最佳答案

简短回答:向上 View 向量不是从其他组件派生的:相反,它是用户输入,选择以确保相机正面朝上。或者,换句话说,向上 View 向量是您如何告诉您的相机系统“向上”的方向是什么,以便为相机定位。

你需要一个向上观察向量的原因是相机的位置和凝视方向不足以完全确定它的姿势:你仍然可以围绕位置/凝视轴旋转相机。完成锁定相机需要向上看向量;并且因为人们通常更喜欢正面朝上看东西,所以向上看向量通常是一个固定的方向,由场景在您的坐标空间中的定向方式决定。

理论上,向上看向量可以是任何方向,但实际上“向上”通常是一个坐标方向。哪个坐标“向上”是一个约定问题:在您的情况下,Y 轴似乎是“向上”,但有些系统更喜欢 Z 轴。

也就是说,我要重申:您几乎可以选择任何您想要的方向。如果您希望您的第一人称 POV“倾斜”(例如,环顾角落,或表示醉酒),您可以调整您的向上看向量来实现这一点。另外,考虑在像 super 马里奥银河这样的游戏中控制相机......

关于graphics - 你如何确定俯视向量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21467225/

相关文章:

java - 使用 java swing 从一个点移动到另一个点

java - 从一点到另一点绘制拱形

c++ - 使用CGAL存储多边形的顶点、半边、邻接表

java - 使用 Jama 数学库的 sigmoid 函数在 sigmoidfunction 中没有输出

graphics - 光线行进相对于光栅化的优势

java - BufferedImage 未作为图像返回

machine-learning - 为什么 `sklearn.manifold.MDS` 是随机的,而 `skbio' s pcoa` 不是随机的?

javascript - 用欧拉 Angular 或旋转矩阵平均旋转

c++ - 调用 numDeriv :hessian() with multiple-parameter-objective-function in Rcpp

c++ - C++中的线性方程组?