Fix T48002: Wrong behavior with "RGB to Intensity" in Image textures

There was some extra linearization happening in such cases.
This commit is contained in:
Sergey Sharybin 2016-04-04 11:28:14 +02:00
parent f4875bed89
commit 2f08d5f761
Notes: blender-bot 2023-02-14 11:18:07 +01:00
Referenced by issue #48002, Wrong behaviour with "RGB to Intensity" in Image textures. Wrong color
1 changed files with 18 additions and 3 deletions

View File

@ -1270,8 +1270,13 @@ static int multitex_nodes_intern(Tex *tex,
ImBuf *ibuf = BKE_image_pool_acquire_ibuf(tex->ima, &tex->iuser, pool);
/* don't linearize float buffers, assumed to be linear */
if (ibuf && !(ibuf->rect_float) && scene_color_manage)
if (ibuf != NULL &&
ibuf->rect_float == NULL &&
(rgbnor & TEX_RGB) &&
scene_color_manage)
{
IMB_colormanagement_colorspace_to_scene_linear_v3(&texres->tr, ibuf->rect_colorspace);
}
BKE_image_pool_release_ibuf(tex->ima, ibuf, pool);
}
@ -1312,8 +1317,13 @@ static int multitex_nodes_intern(Tex *tex,
ImBuf *ibuf = BKE_image_pool_acquire_ibuf(tex->ima, &tex->iuser, pool);
/* don't linearize float buffers, assumed to be linear */
if (ibuf && !(ibuf->rect_float) && scene_color_manage)
if (ibuf != NULL &&
ibuf->rect_float == NULL &&
(rgbnor & TEX_RGB) &&
scene_color_manage)
{
IMB_colormanagement_colorspace_to_scene_linear_v3(&texres->tr, ibuf->rect_colorspace);
}
BKE_image_pool_release_ibuf(tex->ima, ibuf, pool);
}
@ -2501,8 +2511,13 @@ void do_material_tex(ShadeInput *shi, Render *re)
ImBuf *ibuf = BKE_image_pool_acquire_ibuf(ima, &tex->iuser, re->pool);
/* don't linearize float buffers, assumed to be linear */
if (ibuf && !(ibuf->rect_float) && R.scene_color_manage)
if (ibuf != NULL &&
ibuf->rect_float == NULL &&
(rgbnor & TEX_RGB) &&
R.scene_color_manage)
{
IMB_colormanagement_colorspace_to_scene_linear_v3(tcol, ibuf->rect_colorspace);
}
BKE_image_pool_release_ibuf(ima, ibuf, re->pool);
}