[Bf-blender-cvs] [175c1382da4] master: Fix T87348: convert vertex colors to linear color space

Jacques Lucke noreply at git.blender.org
Mon Apr 12 09:19:18 CEST 2021


Commit: 175c1382da4d0079209d6e2adedc7c408f327a21
Author: Jacques Lucke
Date:   Mon Apr 12 09:18:35 2021 +0200
Branches: master
https://developer.blender.org/rB175c1382da4d0079209d6e2adedc7c408f327a21

Fix T87348: convert vertex colors to linear color space

Differential Revision: https://developer.blender.org/D10956

===================================================================

M	source/blender/blenkernel/intern/geometry_component_mesh.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc b/source/blender/blenkernel/intern/geometry_component_mesh.cc
index df451b5db1d..150cc4589c8 100644
--- a/source/blender/blenkernel/intern/geometry_component_mesh.cc
+++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc
@@ -814,14 +814,16 @@ static void set_loop_uv(MLoopUV &uv, const float2 &co)
 
 static Color4f get_loop_color(const MLoopCol &col)
 {
-  Color4f value;
-  rgba_uchar_to_float(value, &col.r);
-  return value;
+  Color4f srgb_color;
+  rgba_uchar_to_float(srgb_color, &col.r);
+  Color4f linear_color;
+  srgb_to_linearrgb_v4(linear_color, srgb_color);
+  return linear_color;
 }
 
-static void set_loop_color(MLoopCol &col, const Color4f &value)
+static void set_loop_color(MLoopCol &col, const Color4f &linear_color)
 {
-  rgba_float_to_uchar(&col.r, value);
+  linearrgb_to_srgb_uchar4(&col.r, linear_color);
 }
 
 static float get_crease(const MEdge &edge)



More information about the Bf-blender-cvs mailing list