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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user