mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-03 06:35:21 +01:00
fix(render): EU07M review of #541: the skinning kernel moves normals as the cpu does
skin.comp moves the normals by the cofactors of the blended rotation with the sign of its determinant, as skinning::skin_vertices() now does (#539), so a joint scaled unevenly lights its part the same on both paths.
This commit is contained in:
@@ -64,7 +64,12 @@ void main()
|
||||
}
|
||||
vec3 position = (blended * vec4(source.position_u.xyz, 1.0)).xyz;
|
||||
mat3 rotation = mat3(blended);
|
||||
vec3 normal = skin_direction(rotation, source.normal_v.xyz);
|
||||
// the normals by the cofactors of the rotation (the direction of its inverse transpose), with the sign of its determinant,
|
||||
// as skinning::skin_vertices() moves them on the cpu
|
||||
mat3 cofactors = mat3(cross(rotation[1], rotation[2]), cross(rotation[2], rotation[0]), cross(rotation[0], rotation[1]));
|
||||
if (dot(rotation[0], cofactors[0]) < 0.0)
|
||||
cofactors = -cofactors;
|
||||
vec3 normal = skin_direction(cofactors, source.normal_v.xyz);
|
||||
vec3 tangent = skin_direction(rotation, source.tangent.xyz);
|
||||
uint target = (skin_counts.y + index) * 12u;
|
||||
skin_output[target + 0u] = position.x;
|
||||
|
||||
Reference in New Issue
Block a user