diff options
author | Ton Roosendaal <ton@blender.org> | 2006-12-21 21:11:07 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-12-21 21:11:07 +0300 |
commit | e61dec07670956c2a35774d2aca368772c2817b8 (patch) | |
tree | 54c2e57f0a7ec9ff3f947e67ee2d2c01cfc9afa1 /source/blender/src | |
parent | 5329e0d035b58cbedc66aa24e17efa9972c15375 (diff) |
Defocus Composite Node, by Alfredo de Greef
Log:
http://www.blender3d.org/cms/Composite__Defocus.836.0.html
An incredible quality composite effect, might be slow but worth waiting
for!
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/buttons_editing.c | 22 | ||||
-rw-r--r-- | source/blender/src/drawnode.c | 58 | ||||
-rw-r--r-- | source/blender/src/drawobject.c | 5 | ||||
-rw-r--r-- | source/blender/src/editipo.c | 3 | ||||
-rw-r--r-- | source/blender/src/toets.c | 4 |
5 files changed, 80 insertions, 12 deletions
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 114f97bec67..ba3cc54ecc2 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -2770,36 +2770,40 @@ static void editing_panel_camera_type(Object *ob, Camera *cam) uiDefBut(block, LABEL, 10, "Lens:", 10, 180, 150, 20, 0, 0.0, 0.0, 0, 0, ""); -if(cam->type==CAM_ORTHO) { + if(cam->type==CAM_ORTHO) { uiDefButF(block, NUM,REDRAWVIEW3D, "Scale:", 10, 160, 150, 20, &cam->ortho_scale, 0.01, 1000.0, 50, 0, "Specify the ortho scaling of the used camera"); } else { uiDefButF(block, NUM,REDRAWVIEW3D, "Lens:", 10, 160, 150, 20, &cam->lens, 1.0, 250.0, 100, 0, "Specify the lens of the camera"); } - + +/* qdn: focal dist. param. from yafray now enabled for Blender as well, to use with defocus composit node */ + uiDefButF(block, NUM, REDRAWVIEW3D, "DoFDist:", 10, 140, 150, 20 /*0, 125, 150, 20*/, &cam->YF_dofdist, 0.0, 5000.0, 50, 0, "Sets distance to point of focus (enable 'Limits' to make visible in 3Dview)"); + uiDefButS(block, TOG, REDRAWVIEW3D, "Orthographic", - 10, 135, 150, 20, &cam->type, 0, 0, 0, 0, "Render orthogonally"); + 10, 115, 150, 20, &cam->type, 0, 0, 0, 0, "Render orthogonally"); + //10, 135, 150, 20, &cam->type, 0, 0, 0, 0, "Render orthogonally"); - uiDefBut(block, LABEL, 0, "Clipping:", 10, 110, 150, 20, 0, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, LABEL, 0, "Clipping:", 10, 90, 150, 20, 0, 0.0, 0.0, 0, 0, ""); uiBlockBeginAlign(block); uiDefButF(block, NUM,REDRAWVIEW3D, "Start:", - 10, 90, 150, 20, &cam->clipsta, 0.001*grid, 100.0*grid, 10, 0, "Specify the startvalue of the the field of view"); + 10, 70, 150, 20, &cam->clipsta, 0.001*grid, 100.0*grid, 10, 0, "Specify the startvalue of the the field of view"); uiDefButF(block, NUM,REDRAWVIEW3D, "End:", - 10, 70, 150, 20, &cam->clipend, 1.0, 5000.0*grid, 100, 0, "Specify the endvalue of the the field of view"); + 10, 50, 150, 20, &cam->clipend, 1.0, 5000.0*grid, 100, 0, "Specify the endvalue of the the field of view"); uiBlockEndAlign(block); uiDefButF(block, NUM,REDRAWVIEW3D, "Size:", 170, 25, 150, 20, &cam->drawsize, 0.1*grid, 10.0, 10, 0, "The size that the camera is displayed in the 3D View (different to the object's scale)"); - uiDefBut(block, LABEL, 0, "Shift:", 10, 45, 150, 20, 0, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, LABEL, 0, "Shift:", 10, 25, 150, 20, 0, 0.0, 0.0, 0, 0, ""); uiBlockBeginAlign(block); uiDefButF(block, NUM,REDRAWVIEW3D, "X:", - 10, 25, 75, 20, &cam->shiftx, -2.0, 2.0, 1, 2, "Horizontally shifts the camera view, without changing the perspective"); + 10, 5, 75, 20, &cam->shiftx, -2.0, 2.0, 1, 2, "Horizontally shifts the camera view, without changing the perspective"); uiDefButF(block, NUM,REDRAWVIEW3D, "Y:", - 85, 25, 75, 20, &cam->shifty, -2.0, 2.0, 1, 2, "Vertically shifts the camera view, without changing the perspective"); + 85, 5, 75, 20, &cam->shifty, -2.0, 2.0, 1, 2, "Vertically shifts the camera view, without changing the perspective"); uiBlockEndAlign(block); uiDefBut(block, LABEL, 0, "Show:", 170, 180, 150, 20, 0, 0.0, 0.0, 0, 0, ""); diff --git a/source/blender/src/drawnode.c b/source/blender/src/drawnode.c index b6af394b9f4..d0b47023a63 100644 --- a/source/blender/src/drawnode.c +++ b/source/blender/src/drawnode.c @@ -996,6 +996,60 @@ static int node_composit_buts_blur(uiBlock *block, bNodeTree *ntree, bNode *node return 38; } +/* qdn: defocus node */ +static int node_composit_buts_defocus(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) +{ + if(block) { + NodeDefocus *nqd = node->storage; + short dy = butr->ymin + 209; + short dx = butr->xmax - butr->xmin; + char* mstr1 = "Bokeh Type%t|Octagon %x8|Heptagon %x7|Hexagon %x6|Pentagon %x5|Square %x4|Triangle %x3|Disk %x0"; + + uiDefBut(block, LABEL, B_NOP, "Bokeh Type", butr->xmin, dy, dx, 19, NULL, 0, 0, 0, 0, ""); + uiDefButC(block, MENU, B_NODE_EXEC+node->nr, mstr1, + butr->xmin, dy-19, dx, 19, + &nqd->bktype, 0, 0, 0, 0, "Bokeh type"); + if (nqd->bktype) { /* for some reason rotating a disk doesn't seem to work... ;) */ + uiDefButC(block, NUM, B_NODE_EXEC+node->nr, "Rotate:", + butr->xmin, dy-38, dx, 19, + &nqd->rotation, 0, 90, 0, 0, "Bokeh shape rotation offset in degrees"); + } + uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Gamma Correct", + butr->xmin, dy-57, dx, 19, + &nqd->gamco, 0, 0, 0, 0, "Enable gamma correction before and after main process"); + if (nqd->no_zbuf==0) { + // only needed for zbuffer input + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "fStop:", + butr->xmin, dy-76, dx, 19, + &nqd->fstop, 0.5, 128, 10, 0, "Amount of focal blur, 128=infinity=perfect focus, half the value doubles the blur radius"); + } + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Maxblur:", + butr->xmin, dy-95, dx, 19, + &nqd->maxblur, 0, 10000, 1000, 0, "blur limit, maximum CoC radius, 0=no limit"); + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "BThreshold:", + butr->xmin, dy-114, dx, 19, + &nqd->bthresh, 0, 100, 100, 0, "CoC radius threshold, prevents background bleed on in-focus midground, 0=off"); + uiDefButC(block, TOG, B_NODE_EXEC+node->nr, "Preview", + butr->xmin, dy-142, dx, 19, + &nqd->preview, 0, 0, 0, 0, "Enable sampling mode, useful for preview when using low samplecounts"); + if (nqd->preview) { + /* only visible when sampling mode enabled */ + uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Samples:", + butr->xmin, dy-161, dx, 19, + &nqd->samples, 16, 256, 0, 0, "Number of samples (16=grainy, higher=less noise)"); + } + uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "No zbuffer", + butr->xmin, dy-190, dx, 19, + &nqd->no_zbuf, 0, 0, 0, 0, "Enable when using an image as input instead of actual zbuffer (auto enabled if node not image based, eg. time node)"); + if (nqd->no_zbuf) { + uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "Zscale:", + butr->xmin, dy-209, dx, 19, + &nqd->scale, 0, 1000, 100, 0, "Scales the Z input when not using a zbuffer, controls maximum blur designated by the color white or input value 1"); + } + } + return 228; +} + static int node_composit_buts_vecblur(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) { if(block) { @@ -1423,6 +1477,10 @@ static void node_composit_set_butfunc(bNodeType *ntype) case CMP_NODE_BLUR: ntype->butfunc= node_composit_buts_blur; break; + /* qdn: defocus node */ + case CMP_NODE_DEFOCUS: + ntype->butfunc = node_composit_buts_defocus; + break; case CMP_NODE_VECBLUR: ntype->butfunc= node_composit_buts_vecblur; break; diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index 567e4a7bab2..d322b2cf0b7 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -873,6 +873,7 @@ static void draw_limit_line(float sta, float end, unsigned int col) /* yafray: draw camera focus point (cross, similar to aqsis code in tuhopuu) */ +/* qdn: now also enabled for Blender to set focus point for defocus composit node */ static void draw_focus_cross(float dist, float size) { glBegin(GL_LINES); @@ -976,8 +977,8 @@ static void drawcamera(Object *ob, int flag) if(cam->flag & CAM_SHOWLIMITS) { draw_limit_line(cam->clipsta, cam->clipend, 0x77FFFF); - /* yafray: dof focus point */ - if (G.scene->r.renderer==R_YAFRAY) draw_focus_cross(cam->YF_dofdist, cam->drawsize); + /* qdn: was yafray only, now also enabled for Blender to be used with defocus composit node */ + draw_focus_cross(cam->YF_dofdist, cam->drawsize); } wrld= G.scene->world; diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c index 1f8fdf0f981..04d44d157ea 100644 --- a/source/blender/src/editipo.c +++ b/source/blender/src/editipo.c @@ -2635,8 +2635,9 @@ void common_insertkey(void) id= G.buts->lockpoin; if(id) { /* yafray: insert key extended with aperture and focal distance */ + /* qdn: FocalDistance now enabled for Blender as wel, for use with defocus node */ if (G.scene->r.renderer==R_INTERN) - event= pupmenu("Insert Key %t|Lens%x0|Clipping%x1"); + event= pupmenu("Insert Key %t|Lens%x0|Clipping%x1|FocalDistance%x3"); else event= pupmenu("Insert Key %t|Lens%x0|Clipping%x1|Aperture%x2|FocalDistance%x3"); if(event== -1) return; diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c index 51c54cf6661..ffa7fe218f5 100644 --- a/source/blender/src/toets.c +++ b/source/blender/src/toets.c @@ -459,6 +459,10 @@ int blenderqread(unsigned short event, short val) BIF_save_rendered_image_fs(); return 0; } + else if(G.qual==LR_SHIFTKEY) { + newspace(curarea, SPACE_NODE); + return 0; + } else if(G.qual & LR_CTRLKEY) { BIF_screendump(0); } |