[Bf-blender-cvs] [1bede86] master: Fix T44880: transparency filter is only valid with raytransp, not ztransp.

Bastien Montagne noreply at git.blender.org
Fri May 29 12:28:19 CEST 2015


Commit: 1bede8644a762279119adafb6e1b5e03884601e6
Author: Bastien Montagne
Date:   Fri May 29 12:26:58 2015 +0200
Branches: master
https://developer.blender.org/rB1bede8644a762279119adafb6e1b5e03884601e6

Fix T44880: transparency filter is only valid with raytransp, not ztransp.

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

M	source/blender/render/intern/source/convertblender.c
M	source/blender/render/intern/source/rayshade.c

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

diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 0602887..1da1a81 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -3279,12 +3279,13 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 			for (a1=0; (a1<ob->totcol || (a1==0 && ob->totcol==0)); a1++) {
 
 				ma= give_render_material(re, ob, a1+1);
-				
+
 				/* test for 100% transparent */
 				ok = 1;
 				if ((ma->alpha == 0.0f) &&
 				    (ma->spectra == 0.0f) &&
-				    (ma->filter == 0.0f) &&
+				    /* No need to test filter here, it's only active with MA_RAYTRANSP and we check against it below. */
+				    /* (ma->filter == 0.0f) && */
 				    (ma->mode & MA_TRANSP) &&
 				    (ma->mode & (MA_RAYTRANSP | MA_RAYMIRROR)) == 0)
 				{
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index 88960b7..2b1d5b8 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -795,7 +795,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
 					traceray(origshi, origshr, depth-1, shi.co, shi.view, tracol, shi.obi, shi.vlr, 0);
 				
 				f= shr.alpha; f1= 1.0f-f;
-				nf= d * shi.mat->filter;
+				nf= (shi.mat->mode & MA_RAYTRANSP) ? d * shi.mat->filter : 0.0f;
 				fr= 1.0f+ nf*(shi.r-1.0f);
 				fg= 1.0f+ nf*(shi.g-1.0f);
 				fb= 1.0f+ nf*(shi.b-1.0f);
@@ -1629,9 +1629,9 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int
 
 		shade_ray(is, &shi, &shr);
 		if (shi.mat->material_type == MA_TYPE_SURFACE) {
-			const float d= (traflag & RAY_TRA) ?
-			            shade_by_transmission(is, &shi, &shr) :
-			            1.0f;
+			const float d = (shi.mat->mode & MA_RAYTRANSP) ?
+			                ((traflag & RAY_TRA) ? shade_by_transmission(is, &shi, &shr) : 1.0f) :
+			                0.0f;
 			/* mix colors based on shadfac (rgb + amount of light factor) */
 			addAlphaLight(col, shr.diff, shr.alpha, d*shi.mat->filter);
 		}




More information about the Bf-blender-cvs mailing list