Fix #118547: LineArt: Handle shadow segments with 0 length
Line art shadow projection will cut lines indefinitely when it encounters a edge segment with 0 length. In the case of #118547, it was caused by the combination bevel modifier and the view angle. This fix ensures that no such edge is worked on further. Pull Request: https://projects.blender.org/blender/blender/pulls/118613
This commit is contained in:
parent
5db2a842c0
commit
0a339231ec
@ -242,6 +242,12 @@ static bool lineart_do_closest_segment(bool is_persp,
|
||||
{
|
||||
int side = 0;
|
||||
int z_index = is_persp ? 3 : 2;
|
||||
|
||||
/* No need to do anything if the segment has no length. */
|
||||
if (s2_fb_co_1[z_index] == s2_fb_co_2[z_index]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Always use the closest point to the light camera. */
|
||||
if (s1_fb_co_1[z_index] >= s2_fb_co_1[z_index]) {
|
||||
copy_v4_v4_db(r_fb_co_1, s2_fb_co_1);
|
||||
@ -758,8 +764,7 @@ static bool lineart_shadow_cast_onto_triangle(LineartData *ld,
|
||||
* the edge
|
||||
*/
|
||||
if (!(pi && LRT_DOUBLE_CLOSE_ENOUGH(ratio[0], 1.0f) &&
|
||||
LRT_DOUBLE_CLOSE_ENOUGH(ratio[1], 0.0f)))
|
||||
{
|
||||
LRT_DOUBLE_CLOSE_ENOUGH(ratio[1], 0.0f))) {
|
||||
trie[pi] = 1;
|
||||
pi++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user