diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-05-22 18:12:13 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-05-22 18:15:45 +0300 |
commit | 8cc4c3da8cbe8da197928fa821e140f4b2615c4c (patch) | |
tree | cde2eb40138570d46f68cae8e10d5d5bb4103fd9 /source/blender/nodes | |
parent | 849e77b1f957b25ac9223a3dc510e234f4467fd1 (diff) |
Fix T51308: Bright/Contrast Doesn't respect Pre-multiplied Alpha
Brightness/contrast node was changing color but did not modify alpha
or ensured colors are premultiplied on the output. This was giving
artifacts later on unless alpha was manually converted.
Compositor is supposed to work in premultiplied alpha (except of
some really corner cases) so it makes sense to ensure premultiplied
alpha after brightness/contrast node.
This is now done as an option enabled by default, so we:
(a) Keep compatibility with old files.
(b) Have correct behavior for newly created files.
Later on we can get rid of this option.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/NOD_static_types.h | 2 | ||||
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_brightness.c | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index e754d063397..02422a8622a 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -179,7 +179,7 @@ DefNode( CompositorNode, CMP_NODE_DISPLACE, 0, "DISPL DefNode( CompositorNode, CMP_NODE_COMBHSVA, 0, "COMBHSVA", CombHSVA, "Combine HSVA", "" ) DefNode( CompositorNode, CMP_NODE_MATH, def_math, "MATH", Math, "Math", "" ) DefNode( CompositorNode, CMP_NODE_LUMA_MATTE, def_cmp_luma_matte, "LUMA_MATTE", LumaMatte, "Luminance Key", "" ) -DefNode( CompositorNode, CMP_NODE_BRIGHTCONTRAST, 0, "BRIGHTCONTRAST", BrightContrast, "Bright/Contrast", "" ) +DefNode( CompositorNode, CMP_NODE_BRIGHTCONTRAST, def_cmp_brightcontrast, "BRIGHTCONTRAST", BrightContrast, "Bright/Contrast", "" ) DefNode( CompositorNode, CMP_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" ) DefNode( CompositorNode, CMP_NODE_INVERT, def_cmp_invert, "INVERT", Invert, "Invert", "" ) DefNode( CompositorNode, CMP_NODE_NORMALIZE, 0, "NORMALIZE", Normalize, "Normalize", "" ) diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.c b/source/blender/nodes/composite/nodes/node_composite_brightness.c index 62f23f417b2..26e4d3a52c9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_brightness.c +++ b/source/blender/nodes/composite/nodes/node_composite_brightness.c @@ -46,6 +46,10 @@ static bNodeSocketTemplate cmp_node_brightcontrast_out[] = { { -1, 0, "" } }; +static void node_composit_init_brightcontrast(bNodeTree *UNUSED(ntree), bNode *node) +{ + node->custom1 = 1; +} void register_node_type_cmp_brightcontrast(void) { @@ -53,6 +57,7 @@ void register_node_type_cmp_brightcontrast(void) cmp_node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, 0); node_type_socket_templates(&ntype, cmp_node_brightcontrast_in, cmp_node_brightcontrast_out); + node_type_init(&ntype, node_composit_init_brightcontrast); nodeRegisterType(&ntype); } |