Fix T49393: Baking ignores backfaces

For some reason (which I can't recall), backing was doing backface
culling. Since Cycles itself doesn't ignore them (nor does Blender
Internal), they should be visible.
This commit is contained in:
Dalai Felinto 2016-09-20 23:26:59 +00:00
parent 166286e6de
commit 8ced4417f9
Notes: blender-bot 2023-02-14 07:35:09 +01:00
Referenced by issue #49393, Baking overlapping geometry into a texture does not work with back-facing polygons
1 changed files with 8 additions and 12 deletions

View File

@ -298,20 +298,16 @@ static bool cast_ray_highpoly(
}
if (hits[i].index != -1) {
/* cull backface */
const float dot = dot_v3v3(dir_high, hits[i].no);
if (dot < 0.0f) {
float distance;
float hit_world[3];
float distance;
float hit_world[3];
/* distance comparison in world space */
mul_v3_m4v3(hit_world, highpoly[i].obmat, hits[i].co);
distance = len_squared_v3v3(hit_world, co);
/* distance comparison in world space */
mul_v3_m4v3(hit_world, highpoly[i].obmat, hits[i].co);
distance = len_squared_v3v3(hit_world, co);
if (distance < hit_distance) {
hit_mesh = i;
hit_distance = distance;
}
if (distance < hit_distance) {
hit_mesh = i;
hit_distance = distance;
}
}
}