Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2013-04-11 16:37:33 +0400
committerAntony Riakiotakis <kalast@gmail.com>2013-04-11 16:37:33 +0400
commitfa3770eb669ab5a1794cc1b9f874c3f0428b487c (patch)
tree81f0a435effdd1d81def202c47e6011406eaa44f /source/blender/render
parent94c9010e245a464012d2c0dcc14b6a7891565e58 (diff)
Fix #34923 Images that have their alpha calculated should not get de-premultiplied.
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/intern/source/imagetexture.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index d822439ed16..f38d1d88fc7 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -307,8 +307,9 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
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 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
/* 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 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
}
/* 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);
}