[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10766] trunk/blender/source/blender/ render/intern/source/zbuf.c: Bugfix #6739

Ton Roosendaal ton at blender.org
Wed May 23 17:28:00 CEST 2007


Revision: 10766
          https://svn.blender.org//revision/?rev=10766&view=rev
Author:   ton
Date:     2007-05-23 17:27:34 +0200 (Wed, 23 May 2007)

Log Message:
-----------
Bugfix #6739

Vector blur error in Ztransp: sometimes black lines (on edges) appeared,
which didn't get blurred away. Caused by zero-init of speed vectors in
sample buffers. (Zero speed -> no motion).

Error in Blender since vblur was added.

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

Modified: trunk/blender/source/blender/render/intern/source/zbuf.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/zbuf.c	2007-05-23 09:21:32 UTC (rev 10765)
+++ trunk/blender/source/blender/render/intern/source/zbuf.c	2007-05-23 15:27:34 UTC (rev 10766)
@@ -2916,6 +2916,31 @@
 			case SCE_PASS_NORMAL:
 				col= shr->nor;
 				break;
+			case SCE_PASS_VECTOR:
+				
+				{
+					ShadeResult *shr_t= shr+1;
+					float *fp= shr->winspeed;	/* was initialized */
+					int samp;
+					
+					/* add minimum speed in pixel */
+					for(samp= 1; samp<R.osa; samp++, shr_t++) {
+						
+						if(shr_t->combined[3] > 0.0f) {
+							float *speed= shr_t->winspeed;
+							
+							if( (ABS(speed[0]) + ABS(speed[1]))< (ABS(fp[0]) + ABS(fp[1])) ) {
+								fp[0]= speed[0];
+								fp[1]= speed[1];
+							}
+							if( (ABS(speed[2]) + ABS(speed[3]))< (ABS(fp[2]) + ABS(fp[3])) ) {
+								fp[2]= speed[2];
+								fp[3]= speed[3];
+							}
+						}
+					}
+				}
+				break;
 		}
 		if(col) {
 			float *fp= col+delta;
@@ -3315,7 +3340,11 @@
 					
 					/* for each mask-sample we alpha-under colors. then in end it's added using filter */
 					memset(samp_shr, 0, sizeof(ShadeResult)*R.osa);
-
+					
+					/* nice this memset, but speed vectors are not initialized OK then. it is sufficient to only clear 1 (see merge_transp_passes) */
+					if(addpassflag & SCE_PASS_VECTOR)
+						samp_shr->winspeed[0]= samp_shr->winspeed[1]= samp_shr->winspeed[2]= samp_shr->winspeed[3]= PASS_VECTOR_MAX;
+					
 					while(totface>0) {
 						totface--;
 						





More information about the Bf-blender-cvs mailing list