Skip to content

Fix fragPosition using wrong matrix in lighting_instancing.vs #4056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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