diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-09-12 12:14:34 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-09-12 14:20:41 +0300 |
commit | 4aee701f0028fbf17103a5565d72e05bbfcc8d9f (patch) | |
tree | 9677881abbc63894eb25c9877920f684bb931f59 /source/blender/render | |
parent | de6ecc82ed2d881d7a827c453a6bb97ce4b84a0d (diff) |
Fix T52679: Hole in bake normal
In fact, any type of baking might have caused holes in mesh.
The issue was caused by zspan_scanconvert() attempting to get order of traversal
'a-priori', which might have failed if check happens at the "tip" of span where
`zspan->span1[sn1] == zspan->span2[sn1]`.
Didn't see anything bad on making it a check when iterating over scanlines and
pick minimal span based on current scanline. It's slower, but unlikely to cause
measurable difference. Quality should stay the same unless i'm missing something.
Reviewers: brecht, dfelinto
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D2837
Diffstat (limited to 'source/blender/render')
-rw-r--r-- | source/blender/render/intern/source/zbuf.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 68707f163af..0b6d31ef902 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -1564,20 +1564,13 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float * vy0= ((double)my2)*vyd + (double)xx1; /* correct span */ - sn1= (my0 + my2)/2; - if (zspan->span1[sn1] < zspan->span2[sn1]) { - span1= zspan->span1+my2; - span2= zspan->span2+my2; - } - else { - span1= zspan->span2+my2; - span2= zspan->span1+my2; - } + span1= zspan->span1+my2; + span2= zspan->span2+my2; for (i = 0, y = my2; y >= my0; i++, y--, span1--, span2--) { - sn1= floor(*span1); - sn2= floor(*span2); + sn1= floor(min_ff(*span1, *span2)); + sn2= floor(max_ff(*span1, *span2)); sn1++; if (sn2>=rectx) sn2= rectx-1; |