[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53239] trunk/blender/source/blender: Bug fix #33639

Ton Roosendaal ton at blender.org
Fri Dec 21 11:15:15 CET 2012


Revision: 53239
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53239
Author:   ton
Date:     2012-12-21 10:15:12 +0000 (Fri, 21 Dec 2012)
Log Message:
-----------
Bug fix #33639

Material Texture blend modes Screen, Overlay and Multiply didn't respect
the alpha for textures... an error I could trace back to 2004 even.

Obviously the fix should be done, but it might change the appearance of
renders somewhat. Will keep an eye open if this is worth ugly 
version-patching.

Now: image textures with alpha, will only apply the blend modes
respecting the alpha values.

Modified Paths:
--------------
    trunk/blender/source/blender/gpu/shaders/gpu_shader_material.glsl
    trunk/blender/source/blender/render/intern/source/render_texture.c

Modified: trunk/blender/source/blender/gpu/shaders/gpu_shader_material.glsl
===================================================================
--- trunk/blender/source/blender/gpu/shaders/gpu_shader_material.glsl	2012-12-21 09:37:43 UTC (rev 53238)
+++ trunk/blender/source/blender/gpu/shaders/gpu_shader_material.glsl	2012-12-21 10:15:12 UTC (rev 53239)
@@ -811,7 +811,7 @@
 	float facm;
 
 	fact *= facg;
-	facm = 1.0-facg;
+	facm = 1.0-fact;
 
 	incol = (facm + fact*texcol)*outcol;
 }
@@ -821,7 +821,7 @@
 	float facm;
 
 	fact *= facg;
-	facm = 1.0-facg;
+	facm = 1.0-fact;
 
 	incol = vec3(1.0) - (vec3(facm) + fact*(vec3(1.0) - texcol))*(vec3(1.0) - outcol);
 }
@@ -831,7 +831,7 @@
 	float facm;
 
 	fact *= facg;
-	facm = 1.0-facg;
+	facm = 1.0-fact;
 
 	if(outcol.r < 0.5)
 		incol.r = outcol.r*(facm + 2.0*fact*texcol.r);

Modified: trunk/blender/source/blender/render/intern/source/render_texture.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/render_texture.c	2012-12-21 09:37:43 UTC (rev 53238)
+++ trunk/blender/source/blender/render/intern/source/render_texture.c	2012-12-21 10:15:12 UTC (rev 53239)
@@ -1339,7 +1339,7 @@
 		
 	case MTEX_MUL:
 		fact*= facg;
-		facm= 1.0f-facg;
+		facm= 1.0f-fact;
 		in[0]= (facm+fact*tex[0])*out[0];
 		in[1]= (facm+fact*tex[1])*out[1];
 		in[2]= (facm+fact*tex[2])*out[2];
@@ -1347,7 +1347,7 @@
 
 	case MTEX_SCREEN:
 		fact*= facg;
-		facm= 1.0f-facg;
+		facm= 1.0f-fact;
 		in[0]= 1.0f - (facm+fact*(1.0f-tex[0])) * (1.0f-out[0]);
 		in[1]= 1.0f - (facm+fact*(1.0f-tex[1])) * (1.0f-out[1]);
 		in[2]= 1.0f - (facm+fact*(1.0f-tex[2])) * (1.0f-out[2]);
@@ -1355,7 +1355,7 @@
 
 	case MTEX_OVERLAY:
 		fact*= facg;
-		facm= 1.0f-facg;
+		facm= 1.0f-fact;
 		
 		if (out[0] < 0.5f)
 			in[0] = out[0] * (facm + 2.0f*fact*tex[0]);




More information about the Bf-blender-cvs mailing list