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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-10-22 21:34:06 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-10-22 21:34:06 +0400
commit3285d47842657161b2206ccb2b29f34ef51eab99 (patch)
treed57a4d3f4b24e875afacd8d82d6ff8ccf2d2f6cc /source/blender/nodes/shader/nodes/node_shader_tex_image.c
parent6e62491c5a101ee36ec48db97e4a4f4945f5eada (diff)
Fix #32930: texture colors in material nodes (blender internal) are brighter than normal
There was a missing byte buffer linearization for shader nodes. Also fixed incorrect image input color space refresh when image is packed.
Diffstat (limited to 'source/blender/nodes/shader/nodes/node_shader_tex_image.c')
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_image.c16
1 files changed, 13 insertions, 3 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 52f8c21fbb0..342e06ff050 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
@@ -27,6 +27,8 @@
#include "../node_shader_util.h"
+#include "IMB_colormanagement.h"
+
/* **************** OUTPUT ******************** */
static bNodeSocketTemplate sh_node_tex_image_in[] = {
@@ -60,6 +62,7 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, GPUNodeStack
ImageUser *iuser= NULL;
NodeTexImage *tex = node->storage;
int ncd = tex->color_space == SHD_COLORSPACE_NONE;
+ int ret;
if (!ima)
return GPU_stack_link(mat, "node_tex_image_empty", in, out);
@@ -69,10 +72,17 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, GPUNodeStack
node_shader_gpu_tex_mapping(mat, node, in, out);
- if (out[0].link && GPU_material_do_color_management(mat))
- GPU_link(mat, "srgb_to_linearrgb", out[0].link, &out[0].link);
+ ret = GPU_stack_link(mat, "node_tex_image", in, out, GPU_image(ima, iuser, ncd));
+
+ if (ret) {
+ if (GPU_material_do_color_management(mat) &&
+ IMB_colormanagement_colorspace_is_data(ima->colorspace_settings.name) == FALSE)
+ {
+ GPU_link(mat, "srgb_to_linearrgb", out[0].link, &out[0].link);
+ }
+ }
- return GPU_stack_link(mat, "node_tex_image", in, out, GPU_image(ima, iuser, ncd));
+ return ret;
}
/* node type definition */