Fix fragPosition using wrong matrix in lighting_instancing.vs (#4056)
fragPosition was multiplied by mvp*instanceTransform, but it should only be multiplied by instanceTransform. Compare to lighting.vs, there we only use mvp for gl_Position, but matModel for the fragPosition.
This commit is contained in:
parent
2609211207
commit
fffae1a975
@ -22,15 +22,12 @@ out vec3 fragNormal;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Compute MVP for current instance
|
||||
mat4 mvpi = mvp*instanceTransform;
|
||||
|
||||
// Send vertex attributes to fragment shader
|
||||
fragPosition = vec3(mvpi*vec4(vertexPosition, 1.0));
|
||||
fragPosition = vec3(instanceTransform*vec4(vertexPosition, 1.0));
|
||||
fragTexCoord = vertexTexCoord;
|
||||
//fragColor = vertexColor;
|
||||
fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
|
||||
|
||||
// Calculate final vertex position
|
||||
gl_Position = mvpi*vec4(vertexPosition, 1.0);
|
||||
// Calculate final vertex position, note that we multiply mvp by instanceTransform
|
||||
gl_Position = mvp*instanceTransform*vec4(vertexPosition, 1.0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user