模型视图投影矩阵的目的 [英] The purpose of Model View Projection Matrix

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

问题描述

为了什么目的,我们都使用模型视图投影矩阵? 为什么着色器需要模型视图投影矩阵?

For what purposes we are using Model View Projection Matrix? Why do shaders require Model View Projection Matrix?

推荐答案

该模型,视图和投影矩阵三个独立的矩阵。从对象的局部坐标空间到世界空间模型图,从世界空间查看到摄像机空间,投影距离相机屏幕。

The model, view and projection matrices are three separate matrices. Model maps from an object's local coordinate space into world space, view from world space to camera space, projection from camera to screen.

如果您撰写的所有三个,你可以使用一个结果,从对象空间一路映射到屏幕空间,让你能制定出你需要传递给可编程管道的下一个阶段,从传入顶点位置。

If you compose all three, you can use the one result to map all the way from object space to screen space, making you able to work out what you need to pass on to the next stage of a programmable pipeline from the incoming vertex positions.

在旧的固定功能的管道,你会运用模型和视图在一起,然后用(有一些修复另一个结果从中获得这样如法线仍然即使你已经申请了一些缩放单位长度计算出照明到的对象),然后应用投影。你可以看到,反映在OpenGL中,从未分离模型和视图矩阵 - 让他们作为一个单一的模型视图矩阵堆栈。你因此有时也看到,反映在着色器。

In the fixed functionality pipelines of old, you'd apply model and view together, then work out lighting using another result derived from them (with some fixes so that e.g. normals are still unit length even if you've applied some scaling to the object), then apply projection. You can see that reflected in OpenGL, which never separates the model and view matrices — keeping them as a single modelview matrix stack. You therefore also sometimes see that reflected in shaders.

所以:该合成的模型视图投影矩阵通常被着色器来从您加载为每个模型到屏幕的顶点映射。它不是必需的,有很多实现同样的事情的方式,它只是平常,因为它允许所有可能的线性变换。正因为如此,它的一个较小的组成版本也是在叶奥尔德固定管道世界的常态。

So: the composed model view projection matrix is often used by shaders to map from the vertices you loaded for each model to the screen. It's not required, there are lots of ways of achieving the same thing, it's just usual because it allows all possible linear transforms. Because of that, a lesser composed version of it was also the norm in ye olde fixed pipeline world.

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

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