Fix T44512: Cycles fails normal bake /w scale flip

This commit is contained in:
Campbell Barton 2015-04-27 22:43:01 +10:00
parent 9dadc8f599
commit e1ed47eb5b
Notes: blender-bot 2023-10-04 09:42:55 +02:00
Referenced by issue #44512, Cycles fails to bake normal map to a non-manifold mesh
3 changed files with 3 additions and 7 deletions

View File

@ -775,11 +775,7 @@ static int bake(
copy_m4_m4(highpoly[i].obmat, highpoly[i].ob->obmat);
invert_m4_m4(highpoly[i].imat, highpoly[i].obmat);
/* rotation */
normalize_m4_m4(highpoly[i].rotmat, highpoly[i].imat);
zero_v3(highpoly[i].rotmat[3]);
if (is_negative_m4(highpoly[i].rotmat))
negate_mat3_m4(highpoly[i].rotmat);
highpoly[i].is_flip_object = is_negative_m4(highpoly[i].ob->obmat);
i++;
}

View File

@ -61,10 +61,10 @@ typedef struct BakeHighPolyData {
struct ModifierData *tri_mod;
struct Mesh *me;
char restrict_flag;
bool is_flip_object;
float obmat[4][4];
float imat[4][4];
float rotmat[4][4];
} BakeHighPolyData;
/* external_engine.c */

View File

@ -300,7 +300,7 @@ static bool cast_ray_highpoly(
mul_v3_m4v3(co_high, highpoly[i].imat, co);
/* rotates */
mul_v3_m4v3(dir_high, highpoly[i].rotmat, dir);
mul_v3_mat3_m4v3(dir_high, highpoly[i].imat, dir);
normalize_v3(dir_high);
/* cast ray */