[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55960] trunk/blender/source/blender/ render/intern/source/imagetexture.c: Fix #34923 Images that have their alpha calculated should not get de-premultiplied .

Antony Riakiotakis kalast at gmail.com
Thu Apr 11 14:37:34 CEST 2013


Revision: 55960
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55960
Author:   psy-fi
Date:     2013-04-11 12:37:33 +0000 (Thu, 11 Apr 2013)
Log Message:
-----------
Fix #34923 Images that have their alpha calculated should not get de-premultiplied.

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

Modified: trunk/blender/source/blender/render/intern/source/imagetexture.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/imagetexture.c	2013-04-11 10:17:06 UTC (rev 55959)
+++ trunk/blender/source/blender/render/intern/source/imagetexture.c	2013-04-11 12:37:33 UTC (rev 55960)
@@ -307,8 +307,9 @@
 		texres->ta = 1.0f - texres->ta;
 	}
 
-	/* de-premul, this is being premulled in shade_input_do_shade() */
-	if (texres->ta!=1.0f && texres->ta>1e-4f) {
+	/* de-premul, this is being premulled in shade_input_do_shade()
+	 * do not de-premul for generated alpha, it is already in straight */
+	if (texres->ta!=1.0f && texres->ta>1e-4f && !(tex->imaflag & TEX_CALCALPHA)) {
 		fx= 1.0f/texres->ta;
 		texres->tr*= fx;
 		texres->tg*= fx;
@@ -1465,7 +1466,8 @@
 
 	/* brecht: tried to fix this, see "TXF alpha" comments */
 
-	if (texres->ta != 1.f && (texres->ta > 1e-4f)) {
+	/* do not de-premul for generated alpha, it is already in straight */
+	if (texres->ta!=1.0f && texres->ta>1e-4f && !(tex->imaflag & TEX_CALCALPHA)) {
 		fx = 1.f/texres->ta;
 		texres->tr *= fx;
 		texres->tg *= fx;
@@ -1872,7 +1874,8 @@
 	}
 
 	/* de-premul, this is being premulled in shade_input_do_shade() */
-	if (texres->ta != 1.0f && texres->ta > 1e-4f) {
+	/* do not de-premul for generated alpha, it is already in straight */
+	if (texres->ta!=1.0f && texres->ta>1e-4f && !(tex->imaflag & TEX_CALCALPHA)) {
 		mul_v3_fl(&texres->tr, 1.0f / texres->ta);
 	}
 




More information about the Bf-blender-cvs mailing list