diff options
author | Alex Fraser <alex@phatcore.com> | 2013-01-18 13:19:43 +0400 |
---|---|---|
committer | Alex Fraser <alex@phatcore.com> | 2013-01-18 13:19:43 +0400 |
commit | 55030a4c1a9e96a0d497b476abad70b05db761a2 (patch) | |
tree | 6fa9325f01e3f524b6f75df4a2f0548f0724b54c /source/blender/render | |
parent | 6a5cdde89992b5872ae617231864768034121533 (diff) |
Applying sRGB color space transform when baking to vertex colors. Thanks to Campbell Barton and Sergey Sharybin for their help!
Diffstat (limited to 'source/blender/render')
-rw-r--r-- | source/blender/render/intern/source/rendercore.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 14586f16478..77445986355 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -2207,8 +2207,14 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua float rgb[3]; copy_v3_v3(rgb, shr.combined); - if (R.scene_color_manage) - IMB_colormanagement_scene_linear_to_colorspace_v3(rgb, bs->rect_colorspace); + if (R.scene_color_manage) { + /* Vertex colors have no way to specify color space, so they + * default to sRGB. */ + if (!bs->vcol) + IMB_colormanagement_scene_linear_to_colorspace_v3(rgb, bs->rect_colorspace); + else + linearrgb_to_srgb_v3_v3(rgb, rgb); + } rgb_float_to_uchar(col, rgb); } else { @@ -2223,7 +2229,7 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua } if (bs->vcol) { - /* Vertex colour baking. Vcol has no useful alpha channel (it exists + /* Vertex color baking. Vcol has no useful alpha channel (it exists * but is used only for vertex painting). */ bs->vcol->r = col[0]; bs->vcol->g = col[1]; @@ -2265,7 +2271,7 @@ static void bake_displacement(void *handle, ShadeInput *UNUSED(shi), float dist, col[3] = 255; if(bs->vcol) { - /* Vertex colour baking. Vcol has no useful alpha channel (it exists + /* Vertex color baking. Vcol has no useful alpha channel (it exists * but is used only for vertex painting). */ bs->vcol->r = col[0]; bs->vcol->g = col[1]; @@ -2511,7 +2517,7 @@ static int get_next_bake_face(BakeShade *bs) if ((bs->actob && bs->actob == obr->ob) || (!bs->actob && (obr->ob->flag & SELECT))) { if(R.r.bake_flag & R_BAKE_VCOL) { - /* Gather face data for vertex colour bake */ + /* Gather face data for vertex color bake */ Mesh *me; int *origindex, vcollayer; CustomDataLayer *cdl; |