From af26256da477025d95af5138809d5d07f124d37d Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Fri, 23 Nov 2007 14:48:26 +0000 Subject: [PATCH] Bugfix #7802 Fixed very old annoyance in alpha render: when using alpha textures images, nicely premulled as Blender wants it, you still got dark outlines at the edges. This because the blender shading pipeline also premultiplies. Solution: de-premul image texture colors after sampling. --- source/blender/render/intern/source/imagetexture.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index 82abab62637..ff0b5f3d3cb 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -968,5 +968,14 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *dxt, f texres->nor[2] = 2.f*(texres->tb - 0.5f); } + /* de-premul, this is being premulled in shade_input_do_shade() */ + if(texres->ta!=1.0f && texres->ta!=0.0f) { + fx= 1.0f/texres->ta; + texres->tr*= fx; + texres->tg*= fx; + texres->tb*= fx; + } + + return retval; }