[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53891] trunk/blender/source/blender/ render/intern/source/rendercore.c: Applying sRGB color space transform when baking to vertex colors.

Alex Fraser alex at phatcore.com
Fri Jan 18 10:19:43 CET 2013


Revision: 53891
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53891
Author:   z0r
Date:     2013-01-18 09:19:43 +0000 (Fri, 18 Jan 2013)
Log Message:
-----------
Applying sRGB color space transform when baking to vertex colors. Thanks to Campbell Barton and Sergey Sharybin for their help!

Modified Paths:
--------------
    trunk/blender/source/blender/render/intern/source/rendercore.c

Modified: trunk/blender/source/blender/render/intern/source/rendercore.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/rendercore.c	2013-01-18 08:44:55 UTC (rev 53890)
+++ trunk/blender/source/blender/render/intern/source/rendercore.c	2013-01-18 09:19:43 UTC (rev 53891)
@@ -2207,8 +2207,14 @@
 			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 @@
 		}
 
 		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 @@
 		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 @@
 
 			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;




More information about the Bf-blender-cvs mailing list