Skip to content

Commit

Permalink
bevy_pbr: Normalize skinned normals
Browse files Browse the repository at this point in the history
This was forgotten in bevyengine#5666 when normalization of normals was moved from the
fragment to vertex stage.
  • Loading branch information
superdump committed Nov 10, 2022
1 parent 1914a3f commit d6de3f4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions crates/bevy_pbr/src/render/skinning.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ fn skin_normals(
model: mat4x4<f32>,
normal: vec3<f32>,
) -> vec3<f32> {
return inverse_transpose_3x3(mat3x3<f32>(
model[0].xyz,
model[1].xyz,
model[2].xyz
)) * normal;
return normalize(
inverse_transpose_3x3(
mat3x3<f32>(
model[0].xyz,
model[1].xyz,
model[2].xyz
)
) * normal
);
}

0 comments on commit d6de3f4

Please sign in to comment.