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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-19 03:56:12 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-19 15:36:42 +0300
commit3b23b5c638feae0ad6319440771b83a64a1f9ebe (patch)
tree16fbedd83ffa6a02904d3f93576c1de1674a0584 /source/blender/nodes
parent7c78c20b6bf6f7dd00397c456fb9e2116febfca7 (diff)
Images: don't (un)premultipy non-color data
The previous behavior here was wrong for some specific combinations of settings, non-color RGB channels should never be affected by the alpha channel.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_image.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
index a9183cd10ef..8086bb2e15d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
@@ -180,6 +180,9 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat,
}
if (out[0].hasoutput) {
+ /* When the alpha socket is used, unpremultiply alpha. This makes it so
+ * that if we blend the color with a transparent shader using alpha as
+ * a factor, we don't multiply alpha into the color twice. */
if (out[1].hasoutput &&
!IMB_colormanagement_space_name_is_data(ima->colorspace_settings.name)) {
GPU_link(mat, "tex_color_alpha_unpremultiply", out[0].link, &out[0].link);