Why would it be beneficial to have a separate projection matrix, yet combine model and view matrix?

后端 未结 2 906
没有蜡笔的小新
没有蜡笔的小新 2021-01-30 10:32

When you are learning 3D programming, you are taught that it\'s easiest think in terms of 3 transformation matrices:

  1. The Model Matrix. This matrix is i

2条回答
  •  忘了有多久
    2021-01-30 11:17

    In most cases your shader will need the geometry in world or eye coordinates for shading so you have to seperate the projection matrix from the model and view matrices.

    Making your shader multiply the geometry with two matrices hurts performance. Assuming each model have thousends (or more) vertices it is more efficient to compute a model view matrix in the cpu once, and let the shader do one less mtrix-vector multiplication.

提交回复
热议问题