Fix T42106: Box image mapping shows black triangles if they point to a corner and blend is 0

After discussion with cambo here we decided it's better to choose arbitrary side of the box
(in this case it's X-axis) and use image from it. That's better than doing a blackness.

P.S. This is literally a corner case anyway.
This commit is contained in:
Sergey Sharybin 2014-10-07 15:48:39 +02:00
parent 9789d19648
commit 70eea8fcc8
Notes: blender-bot 2023-02-14 10:00:03 +01:00
Referenced by issue #42106, issue with rendering 'Generated'-mapped textures with Cycles
2 changed files with 8 additions and 0 deletions

View File

@ -113,6 +113,10 @@ shader node_image_texture(
weight[2] = ((2.0 - limit) * Nob[2] + (limit - 1.0)) / (2.0 * limit - 1.0);
}
}
else {
/* Desperate mode, no valid choice anyway, fallback to one side.*/
weight[0] = 1.0;
}
Color = color(0.0, 0.0, 0.0);
Alpha = 0.0;

View File

@ -435,6 +435,10 @@ ccl_device void svm_node_tex_image_box(KernelGlobals *kg, ShaderData *sd, float
weight.z = ((2.0f - limit)*N.z + (limit - 1.0f))/(2.0f*limit - 1.0f);
}
}
else {
/* Desperate mode, no valid choice anyway, fallback to one side.*/
weight.x = 1.0f;
}
/* now fetch textures */
uint co_offset, out_offset, alpha_offset, srgb;