diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-08 20:14:56 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-08 20:14:56 +0400 |
commit | a1693168f24c818e3902bd95352aa0c5fb3b7d1c (patch) | |
tree | 53fa5f8eaaca9205e3fbd61551f28e7138354065 /source/blender/nodes | |
parent | c953ca11ac20fd90fea5a6235fc38d2aa9ec631c (diff) |
DOF node: clamp blurring the zdepth radius buffer by the blur max. This could doo easily blur very high depths and cause artifacts.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_defocus.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c index d9ee067efe3..45d070ba8d2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c @@ -166,17 +166,17 @@ static void IIR_gauss_single(CompBuf *buf, float sigma) // see "Recursive Gabor Filtering" by Young/VanVliet // all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200 if (sigma >= 3.556f) - q = 0.9804f*(sigma - 3.556f) + 2.5091f; + q = 0.9804f * (sigma - 3.556f) + 2.5091f; else // sigma >= 0.5 - q = (0.0561f*sigma + 0.5784f)*sigma - 0.2568f; - q2 = q*q; - sc = (1.1668 + q)*(3.203729649 + (2.21566 + q)*q); + q = (0.0561f * sigma + 0.5784f) * sigma - 0.2568f; + q2 = q * q; + sc = (1.1668 + q) * (3.203729649 + (2.21566 + q) * q); // no gabor filtering here, so no complex multiplies, just the regular coefs. // all negated here, so as not to have to recalc Triggs/Sdika matrix - cf[1] = q*(5.788961737 + (6.76492 + 3.0*q)*q)/ sc; - cf[2] = -q2*(3.38246 + 3.0*q)/sc; + cf[1] = q * (5.788961737 + (6.76492 + 3.0 * q) * q) / sc; + cf[2] = -q2 * (3.38246 + 3.0 * q) / sc; // 0 & 3 unchanged - cf[3] = q2*q/sc; + cf[3] = q2 * q / sc; cf[0] = 1.0 - cf[1] - cf[2] - cf[3]; // Triggs/Sdika border corrections, @@ -336,7 +336,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, // fast blur... // bug #6656 part 1, probably when previous node_composite.c was split into separate files, it was not properly updated // to include recent cvs commits (well, at least not defocus node), so this part was missing... - wt = aperture*128.f; + wt = minf(nqd->maxblur, aperture * 128.0f); IIR_gauss_single(crad, wt); IIR_gauss_single(wts, wt); |