Fixed non-uniform scaling of normals

This commit is contained in:
Duarte David 2021-08-22 19:28:18 +01:00
parent fb176d5f6e
commit 7e94c583e0
2 changed files with 2 additions and 2 deletions

View file

@ -118,7 +118,7 @@ void main() {
mat3 world_normal_matrix;
if (bool(instances.data[instance_index].flags & INSTANCE_FLAGS_NON_UNIFORM_SCALE)) {
world_normal_matrix = inverse(mat3(world_matrix));
world_normal_matrix = transpose(inverse(mat3(world_matrix)));
} else {
world_normal_matrix = mat3(world_matrix);
}

View file

@ -124,7 +124,7 @@ void main() {
mat3 world_normal_matrix;
if (bool(draw_call.flags & INSTANCE_FLAGS_NON_UNIFORM_SCALE)) {
world_normal_matrix = inverse(mat3(world_matrix));
world_normal_matrix = transpose(inverse(mat3(world_matrix)));
} else {
world_normal_matrix = mat3(world_matrix);
}