Fix Octahedral encoding special case when computing vertex skinning

Signed-off-by: Gaktan <Gaktan@users.noreply.github.com>
(cherry picked from commit c05c85581eb236f224dd15a04feda2a8d80082cc)
This commit is contained in:
Gaktan
2026-03-13 20:18:46 +01:00
committed by Thaddeus Crews
parent f0502ec953
commit 424c4d30c1
@@ -110,6 +110,13 @@ uint encode_tang_to_uint_oct(vec4 base) {
// Encode binormal sign in y component
oct.y = oct.y * 0.5f + 0.5f;
oct.y = base.w >= 0.0f ? oct.y : 1 - oct.y;
if (oct.x == 0.0 && oct.y == 1.0) {
// (1, 1) and (0, 1) decode to the same value, but (0, 1) messes with our compression detection.
// So we sanitize here.
oct.x = 1.0;
}
return vec2_to_uint(oct);
}