[Bf-blender-cvs] [4aee701f002] master: Fix T52679: Hole in bake normal

Sergey Sharybin noreply at git.blender.org
Tue Sep 12 13:22:19 CEST 2017


Commit: 4aee701f0028fbf17103a5565d72e05bbfcc8d9f
Author: Sergey Sharybin
Date:   Tue Sep 12 14:14:34 2017 +0500
Branches: master
https://developer.blender.org/rB4aee701f0028fbf17103a5565d72e05bbfcc8d9f

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

===================================================================

M	source/blender/render/intern/source/zbuf.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list