Why there is a model-view matrix, but not a view-projection matrix?
A view-projection matrix would make much more sense to me, since every entity in the scene has his own position and therefore its own model-matrix, but there is only one camera, so you could just precalculate the view-projection matrix and then use this matrix to multiply it with every models model-matrix to get every models MVP-matrix. Am I wrong?
Answer
The graphics pipeline (typically) involves transformation from model space to world space, from world space to view space, and from view space to clip space. There is a transformation matrix associated with each of these (the world, view and projection transformations, respectively). There are of course stages of the pipeline after geometry reaches clip space, but they are not relevant to your question.
Because each transformation is a matrix, you can combine them: you can create a "model-view" matrix or a "view-projection" matrix or even a single combined "model-view-projection" matrix. They're all perfectly reasonable and are in fact used fairly commonly, when appropriate.
The reason that the term "modelview matrix" is so prevalent is because of classical graphics pipeline theory and OpenGL, where it was considered standard practice to combine the model-to-world and world-to-view transformations. This was done because there was a very common reason to have geometry in view space: it simplified the computation of lighting effects.
There wasn't a particularly common reason to have geometry in world space, particularly since the pipeline was not programmable the way it is today. Consequently, there was not really a common need to go from world space directly to clip space, and thus a "viewprojection matrix" was not a common thing and did not gain a foothold in the vernacular of the industry.
If you have a good reason to have your geometry in world space for some intermediate computations during the pipeline, but have no reason to have your geometry in view space, then it is perfectly acceptable to use a combined view-projection matrix.
No comments:
Post a Comment