diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-11-09 19:23:32 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-11-09 19:30:34 +0300 |
commit | ec6a9322e8723b906089f02ff76b04a7bb7d136f (patch) | |
tree | 9b5882a10cc69d524e6c08f6a3bf9e15b9c59f81 /intern/cycles/blender/blender_mesh.cpp | |
parent | dfe50ef2d84263c3470011eaba60ca45e4684b67 (diff) |
Fix T78956: banding artifacts of vertex colors in Cycles
Byte colors must be encoded in sRGB and converted to linear on lookup,
to avoid precision loss.
Diffstat (limited to 'intern/cycles/blender/blender_mesh.cpp')
-rw-r--r-- | intern/cycles/blender/blender_mesh.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index e40e1f5f001..b78a2c30b5e 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -346,7 +346,7 @@ static void attr_create_vertex_color(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, for (int i = 0; i < n; i++) { float4 color = get_float4(l->data[p->loop_start() + i].color()); /* Compress/encode vertex color using the sRGB curve. */ - *(cdata++) = color_float4_to_uchar4(color_srgb_to_linear_v4(color)); + *(cdata++) = color_float4_to_uchar4(color); } } } @@ -368,9 +368,10 @@ static void attr_create_vertex_color(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, float4 c3 = get_float4(l->data[li[2]].color()); /* Compress/encode vertex color using the sRGB curve. */ - cdata[0] = color_float4_to_uchar4(color_srgb_to_linear_v4(c1)); - cdata[1] = color_float4_to_uchar4(color_srgb_to_linear_v4(c2)); - cdata[2] = color_float4_to_uchar4(color_srgb_to_linear_v4(c3)); + cdata[0] = color_float4_to_uchar4(c1); + cdata[1] = color_float4_to_uchar4(c2); + cdata[2] = color_float4_to_uchar4(c3); + cdata += 3; } } |