diff options
author | Robert Holcomb <bob_holcomb@hotmail.com> | 2006-11-19 22:17:32 +0300 |
---|---|---|
committer | Robert Holcomb <bob_holcomb@hotmail.com> | 2006-11-19 22:17:32 +0300 |
commit | 0a7c43c6e5fc7d5d75a4645eca1164cede2d03a6 (patch) | |
tree | 939b69ddcfe3d6bd875aa384d04cfc3c5728d811 /source/blender | |
parent | 4ebf5223ba7147680d2b0561ae85c51327ae93e3 (diff) |
Updated tooltips in matte nodes to better explain their use. Made the names of the matte nodes more consistent.
Minor change to to how luminance detail is added to alpha channel in chroma key node.
Removed unused inputs in chroma key and luminance key nodes.
Changed chroma key controls back to sliders because I think they offer the user a more intuitive interface to the node.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/node_composite.c | 55 | ||||
-rw-r--r-- | source/blender/src/drawnode.c | 34 | ||||
-rw-r--r-- | source/blender/src/header_node.c | 2 | ||||
-rw-r--r-- | source/blender/src/toolbox.c | 4 |
4 files changed, 47 insertions, 48 deletions
diff --git a/source/blender/blenkernel/intern/node_composite.c b/source/blender/blenkernel/intern/node_composite.c index 1139ceabd43..37ca94c2b64 100644 --- a/source/blender/blenkernel/intern/node_composite.c +++ b/source/blender/blenkernel/intern/node_composite.c @@ -3647,7 +3647,7 @@ static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack ** static bNodeType cmp_node_diff_matte={ /* type code */ CMP_NODE_DIFF_MATTE, - /* name */ "Channel Difference Matte", + /* name */ "Difference Key", /* width+range */ 200, 80, 250, /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, /* input sock */ cmp_node_diff_matte_in, @@ -3756,7 +3756,6 @@ static bNodeType cmp_node_color_spill={ /* ******************* Chroma Key ********************************************************** */ static bNodeSocketType cmp_node_chroma_in[]={ {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_RGBA,1,"Key Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, {-1,0,""} }; @@ -3788,8 +3787,6 @@ static void do_chroma_key(bNode *node, float *out, float *in) { /* Algorithm of my own design-Bob Holcomb */ - /* alpha value is written to in[3] because it is done "in place" so that the value gets copied to the rgbbuffer in - the second pixel processor opertation */ NodeChroma *c; float x, z, alpha; @@ -3814,14 +3811,18 @@ static void do_chroma_key(bNode *node, float *out, float *in) break; } - /*is chroma values (added) less than strenght?*/ + /*clamp to zero so that negative values don' affect the other channels input */ + if(x<0.0) x=0.0; + if(z<0.0) z=0.0; + + /*if chroma values (addes are less than strength then it is a key value */ if((x+z) < c->fstrength) { - alpha=ABS(c->key[0]-in[0]); /*differnce in luminence*/ - if(alpha > c->falpha) alpha=0; - in[3]=alpha; - } - else { - in[3]=1.0; + alpha=(x+z); + alpha=in[0]+alpha; /*add in the luminence for detail */ + if(alpha > c->falpha) alpha=0; /* if below the threshold */ + if(alpha < in[3]) { /* is it less than the previous alpha */ + out[3]=alpha; + } } } @@ -3841,18 +3842,15 @@ static void node_composit_exec_chroma(void *data, bNode *node, bNodeStack **in, chromabuf= dupalloc_compbuf(rgbbuf); c=node->storage; - c->key[0]= in[1]->vec[0]; - c->key[1]= in[1]->vec[1]; - c->key[2]= in[1]->vec[2]; /*convert rgbbuf to normalized chroma space*/ - composit1_pixel_processor(node, chromabuf, inbuf, in[1]->vec, do_rgba_to_ycca_normalized, CB_RGBA); + composit1_pixel_processor(node, chromabuf, inbuf, in[0]->vec, do_rgba_to_ycca_normalized, CB_RGBA); /*per pixel chroma key*/ - composit1_pixel_processor(node, rgbbuf, chromabuf, in[1]->vec, do_chroma_key, CB_RGBA); + composit1_pixel_processor(node, chromabuf, chromabuf, in[0]->vec, do_chroma_key, CB_RGBA); /*convert back*/ - composit1_pixel_processor(node, rgbbuf, chromabuf, in[1]->vec, do_normalized_ycca_to_rgba, CB_RGBA); + composit1_pixel_processor(node, rgbbuf, chromabuf, in[0]->vec, do_normalized_ycca_to_rgba, CB_RGBA); /*cleanup */ free_compbuf(chromabuf); @@ -3878,7 +3876,6 @@ static bNodeType cmp_node_chroma={ /* ******************* Luminence Key ********************************************************** */ static bNodeSocketType cmp_node_luma_in[]={ {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_RGBA,1,"Key Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, {-1,0,""} }; @@ -3892,18 +3889,16 @@ static void do_luma_key(bNode *node, float *out, float *in) { /* Algorithm from Video Demistified */ - /* alpha value is written to in[3] because it is done in place for the conversion back to rgb space in - second pixel processor */ - NodeChroma *c; + float alpha; c=node->storage; if(in[0] > c->t1) { /*Luminence is greater than high, then foreground */ - in[3]=1.0; + out[3]=in[3]; /* or whatever it was prior */ } else if(in[0] <c->t2) {/*Luminence is less than low, then background */ - in[3]=0.0; + out[3]=0.0; } else { /*key value from mix*/ @@ -3913,7 +3908,11 @@ static void do_luma_key(bNode *node, float *out, float *in) } /*mix*/ - in[3]=(in[0]-c->t2)/(c->t1-c->t2); + alpha=(in[0]-c->t2)/(c->t1-c->t2); + if(alpha < in[3]) /*if less thatn previous value */ + { + out[3]=alpha; + } } } @@ -3932,13 +3931,13 @@ static void node_composit_exec_luma(void *data, bNode *node, bNodeStack **in, bN chromabuf= dupalloc_compbuf(rgbbuf); /*convert rgbbuf to normalized chroma space*/ - composit1_pixel_processor(node, chromabuf, inbuf, in[1]->vec, do_rgba_to_ycca_normalized, CB_RGBA); + composit1_pixel_processor(node, chromabuf, inbuf, in[0]->vec, do_rgba_to_ycca_normalized, CB_RGBA); - /*per pixel chroma key*/ - composit1_pixel_processor(node, rgbbuf, chromabuf, in[1]->vec, do_luma_key, CB_RGBA); + /*per pixel luma key*/ + composit1_pixel_processor(node, chromabuf, chromabuf, in[0]->vec, do_luma_key, CB_RGBA); /*convert back*/ - composit1_pixel_processor(node, rgbbuf, chromabuf, in[1]->vec, do_normalized_ycca_to_rgba, CB_RGBA); + composit1_pixel_processor(node, rgbbuf, chromabuf, in[0]->vec, do_normalized_ycca_to_rgba, CB_RGBA); /*cleanup */ free_compbuf(chromabuf); diff --git a/source/blender/src/drawnode.c b/source/blender/src/drawnode.c index 8d4b44a0039..a42ae4e722d 100644 --- a/source/blender/src/drawnode.c +++ b/source/blender/src/drawnode.c @@ -1094,7 +1094,7 @@ static int node_composit_buts_color_spill(uiBlock *block, bNodeTree *ntree, bNod uiBlockBeginAlign(block); uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Enhance: ", butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20, - &c->t1, 0.0f, 0.5f, 100, 2, ""); + &c->t1, 0.0f, 0.5f, 100, 2, "Adjusts how much selected channel is affected by color spill algorithm"); uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "R", butr->xmin,butr->ymin,dx,20, &node->custom1,1,1, 0, 0, "Red Spill Suppression"); @@ -1119,33 +1119,33 @@ static int node_composit_buts_chroma_matte(uiBlock *block, bNodeTree *ntree, bNo uiDefButS(block, ROW, B_NODE_EXEC+node->nr,"Green", butr->xmin,butr->ymin+80,dx,20, - &node->custom1,1,1, 0, 0, "Green Background"); + &node->custom1,1,1, 0, 0, "Select if using a green background"); uiDefButS(block, ROW, B_NODE_EXEC+node->nr,"Blue", butr->xmin+dx,butr->ymin+80,dx,20, - &node->custom1,1,2, 0, 0, "Blue Background"); + &node->custom1,1,2, 0, 0, "Select if using a blue background"); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Cb Slope ", + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Cb Slope ", butr->xmin, butr->ymin+60, dx, 20, - &c->t1, 0.0f, 20.0f, 100, 0, " "); + &c->t1, 0.0f, 20.0f, 100, 0, "Adjusts the weight a pixel's value has in determining if it is a key color"); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Cr slope ", + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Cr slope ", butr->xmin+dx, butr->ymin+60, dx, 20, - &c->t3, 0.0f, 20.0f, 100, 0, " "); + &c->t3, 0.0f, 20.0f, 100, 0, "Adjusts the weight a pixel's value has in determining if it is a key color"); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Cb Pos ", + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Cb Pos ", butr->xmin, butr->ymin+40, dx, 20, - &c->t2, 0.0f, 1.0f, 100, 0, " "); + &c->t2, 0.0f, 1.0f, 100, 0, "Pixel values less than this setting are considered a key color"); - uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Cr pos ", + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Cr pos ", butr->xmin+dx, butr->ymin+40, dx, 20, - &c->fsize, 0.0f, 1.0f, 100, 0, " "); + &c->fsize, 0.0f, 1.0f, 100, 0, "Pixel values less than this setting are considered a key color"); - uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Threshold ", - butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, - &c->fstrength, 0.0f, 0.25f, 100, 0, " "); uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Alpha Threshold ", + butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, + &c->fstrength, 0.0f, 0.25f, 100, 0, "Key colored pixels below this setting are considered transparent"); + uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Detail Threshold ", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, - &c->falpha, 0.0f, 1.0f, 100, 0, " "); + &c->falpha, 0.0f, 1.0f, 100, 0, "Keyed pixels below this setting are not processed for detail alpha adjustment"); } return 100; } @@ -1157,10 +1157,10 @@ static int node_composit_buts_luma_matte(uiBlock *block, bNodeTree *ntree, bNode uiBlockBeginAlign(block); uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "High ", butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20, - &c->t1, 0.0f, 1.0f, 100, 0, ""); + &c->t1, 0.0f, 1.0f, 100, 0, "Luminance values higher than this setting are 100% opaque"); uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Low ", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, - &c->t2, 0.0f, 1.0f, 100, 0, ""); + &c->t2, 0.0f, 1.0f, 100, 0, "Luminance values lower than this setting are 100% keyed"); uiBlockEndAlign(block); /*keep t2 (low) less than t1 (high) */ diff --git a/source/blender/src/header_node.c b/source/blender/src/header_node.c index 5ee9a7c1dcf..a29c94cf45d 100644 --- a/source/blender/src/header_node.c +++ b/source/blender/src/header_node.c @@ -414,7 +414,7 @@ static uiBlock *node_addmenu(void *arg_unused) uiDefIconTextBlockBut(block, node_add_filtermenu, NULL, ICON_RIGHTARROW_THIN, "Filter", 0, yco-=20, 120, 19, ""); uiDefIconTextBlockBut(block, node_add_convertermenu, NULL, ICON_RIGHTARROW_THIN, "Convertor", 0, yco-=20, 120, 19, ""); uiDefIconTextBlockBut(block, node_add_groupmenu, NULL, ICON_RIGHTARROW_THIN, "Group", 0, yco-=20, 120, 19, ""); - uiDefIconTextBlockBut(block, node_add_mattemenu, NULL, ICON_RIGHTARROW_THIN, "Matte", 0, yco-=20, 120, 19, ""); + uiDefIconTextBlockBut(block, node_add_mattemenu, NULL, ICON_RIGHTARROW_THIN, "Mattes", 0, yco-=20, 120, 19, ""); } else uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index eefba19b718..fe75b7e0e0c 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -1558,8 +1558,8 @@ static TBitem tb_node_addcomp[]= { { 0, "Filters", 5, NULL}, { 0, "Convertors", 6, NULL}, { 0, "Groups", 7, NULL}, - { 0, "Mattes", 8, NULL}, - { -1, "", 0, NULL}}; + { 0, "Mattes", 8, NULL}, + { -1, "", 0, NULL}}; /* do_node_addmenu() in header_node.c, prototype in BSE_headerbuttons.h */ |