[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14404] trunk/blender/source/blender/ render/intern/source/rendercore.c:

Brecht Van Lommel brechtvanlommel at pandora.be
Sat Apr 12 23:44:08 CEST 2008


Revision: 14404
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14404
Author:   blendix
Date:     2008-04-12 23:44:08 +0200 (Sat, 12 Apr 2008)

Log Message:
-----------

Fix for bug #8927: halo blending with solid has poor antialiasing,
which as far as I can see is an old issue, but with FSA it is quite
simple to do better.

Modified Paths:
--------------
    trunk/blender/source/blender/render/intern/source/rendercore.c

Modified: trunk/blender/source/blender/render/intern/source/rendercore.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/rendercore.c	2008-04-12 21:18:58 UTC (rev 14403)
+++ trunk/blender/source/blender/render/intern/source/rendercore.c	2008-04-12 21:44:08 UTC (rev 14404)
@@ -168,8 +168,9 @@
 static void halo_pixelstruct(HaloRen *har, RenderLayer **rlpp, int totsample, int od, float dist, float xn, float yn, PixStr *ps)
 {
 	float col[4], accol[4];
-	int amount, amountm, zz, flarec, sample;
+	int amount, amountm, zz, flarec, sample, fullsample, mask=0;
 	
+	fullsample= (totsample > 1);
 	amount= 0;
 	accol[0]=accol[1]=accol[2]=accol[3]= 0.0f;
 	flarec= har->flarec;
@@ -183,35 +184,56 @@
 			float fac;
 			
 			shadeHaloFloat(har, col, zz, dist, xn, yn, flarec);
-			fac= ((float)amountm)/(float)R.osa;
-			accol[0]+= fac*col[0];
-			accol[1]+= fac*col[1];
-			accol[2]+= fac*col[2];
-			accol[3]+= fac*col[3];
 			flarec= 0;
+
+			if(fullsample) {
+				for(sample=0; sample<totsample; sample++)
+					if(ps->mask & (1 << sample))
+						addalphaAddfacFloat(rlpp[sample]->rectf + od*4, col, har->add);
+			}
+			else {
+				fac= ((float)amountm)/(float)R.osa;
+				accol[0]+= fac*col[0];
+				accol[1]+= fac*col[1];
+				accol[2]+= fac*col[2];
+				accol[3]+= fac*col[3];
+			}
 		}
 		
+		mask |= ps->mask;
 		ps= ps->next;
 	}
+
 	/* now do the sky sub-pixels */
 	amount= R.osa-amount;
 	if(amount) {
 		float fac;
 
 		shadeHaloFloat(har, col, 0x7FFFFF, dist, xn, yn, flarec);
-		fac= ((float)amount)/(float)R.osa;
-		accol[0]+= fac*col[0];
-		accol[1]+= fac*col[1];
-		accol[2]+= fac*col[2];
-		accol[3]+= fac*col[3];
+
+		if(!fullsample) {
+			fac= ((float)amount)/(float)R.osa;
+			accol[0]+= fac*col[0];
+			accol[1]+= fac*col[1];
+			accol[2]+= fac*col[2];
+			accol[3]+= fac*col[3];
+		}
 	}
-	col[0]= accol[0];
-	col[1]= accol[1];
-	col[2]= accol[2];
-	col[3]= accol[3];
-	
-	for(sample=0; sample<totsample; sample++)
-		addalphaAddfacFloat(rlpp[sample]->rectf + od*4, col, har->add);
+
+	if(fullsample) {
+		for(sample=0; sample<totsample; sample++)
+			if(!(mask & (1 << sample)))
+				addalphaAddfacFloat(rlpp[sample]->rectf + od*4, col, har->add);
+	}
+	else {
+		col[0]= accol[0];
+		col[1]= accol[1];
+		col[2]= accol[2];
+		col[3]= accol[3];
+		
+		for(sample=0; sample<totsample; sample++)
+			addalphaAddfacFloat(rlpp[sample]->rectf + od*4, col, har->add);
+	}
 }
 
 static void halo_tile(RenderPart *pa, RenderLayer *rl)





More information about the Bf-blender-cvs mailing list