When I rotate model-view matrix should my light position preserve and only the model will rotate?

251 views Asked by At

Here is my code snippet how I rotate the model-view matrix:

mat4 modelViewMatrix;
vec3 eyePosition = vec3(0, 0, 6);
vec3 centerPosition = vec3(0, 0, 0);
vec3 upVector = vec3(0, 1, 0);
modelViewMatrix = glm::lookAt(eyePosition, centerPosition, upVector);

vec3 axis = vec3(0, 1, 0);
modelViewMatrix = glm::rotate(modelViewMatrix, rotation, axis);

As much as I know model-view matrix is the transformation matrix that is responsible for going from model coordinate from to eye/camera coordinate frame.

So if I have two uniforms such as:

vec4 lightPosition = vec4(15.0f, 0.0f, 0.0f, 1.0f);
vec3 lightIntensity = vec3(1.0f, 0.0f, 0.0f);

that I use to calculate ADS Phong shading using GLSL my model should rotate but the light should stay at the same position, right?

Sorry the code is not compile-able, but I am asking about general concept and hope this gives you enough info to be able to advice me. Thanks!

0

There are 0 answers