What is the difference between mvpmatrix and those that are set separately and should they be connected (separately) and in what cases?

  • 0
    What is the difference between mvpmatrix (m_shaderProgramm.setUniformValue ("MVPMatrix", m_projectionMatrix * modelViewMatrix);) from those that are set separately and should they be connected (separately) and in what cases?
    vertex shader
    attribute vec4 a_position;
    attribute vec2 a_textcoord;
    
    
    uniform mat4 MVPMatrix;
    uniform mat4 ModelMatrix;
    uniform mat4 ViewMatrix;
    uniform mat4 Projectionmatrix;
    
    
    varying vec2 TexCoord;
    
    void main(void)
    {
        gl_Position = MVPMatrix * a_position;
        TexCoord = a_textcoord;
    }
    C++ Anonymous, May 23, 2020

  • 1 Answers
  • 0
    For a better understanding of the material, you should study at least this article .

    In short
    ModelMatrix is the geometry local space transformation matrix of a particular object.

    Within this local space, the geometry of the object is located relative to the center of the space. To map the geometry of the model to any target space, you must map the local model space to the target space. The ModelMatrix is just such a mapping.



    ViewMatrix - matrix of displaying any external space into view space - the observer's gaze space. The observer (camera) perceives objects only within its own local space. In order for the observer to see the object, the object must be displayed from its native space into the camera view space, where it will either fall into the projection area, or not.



    Projectionmatrix - matrix for mapping the view space to the projection space of the view. In fact, this mapping performs the projection of some portion of the view space onto a plane. It is the geometry displayed in this way that becomes visible when the frame is presented.



    Each scene object is located and animated within its local space. To make an object in the scene fall into its proper place, its geometry is mapped from its local space to the global scene space using its ModelMatrix .

    For the scene to be visible to the camera, all its geometry must be mapped into the camera view space using the ViewMatrix matrix.

    In order for a part of the camera view space to fall into the frame presentation area, all view space geometry must be mapped into projection space using the Projectionmatrix matrix.

    It is important to note that the Projectionmatrix and ViewMatrix matrices are unique for the camera, but the ModelMatrix matrices are unique for each object separately.
    Isla Church

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!