1
$\begingroup$

I have a rendered image (actually sequence of images) and want to 'fake' a depth of field in the compositor by using a blur, or a defocus. My preconceived notion was that I should produce a gradient texture and use either the blur node and a color mix to combine the unblurred and blurred versions according to a factor prescribed by the gradient texture, or use a defocus node with the Z factor prescribed by the gradient. However, this seems much harder than it should be for the following reasons:

  • Creating a texture for the compositor seems hard - the only way I could find to do it was switching off Cycles and into BI, creating a new texture, and then switching back.

  • When using a Blend texture in the defocus node, it seems very hard not to get a sharp 'edge' where the blur 'turns on'.

  • Most confusingly, it seems impossible to rotate a texture in the compositor. In the node editor for a material, this is trivial, but I can't see how to do it here.

Any advice regarding the above confusion, or on a better way to achieve my goal, would be greatly appreciated.

Thanks.

$\endgroup$
  • 1
    $\begingroup$ Use a mask instead ;-) $\endgroup$ – 3pointedit Sep 20 '18 at 9:07
  • $\begingroup$ To rotate, connect the texure to a rotate or transform node $\endgroup$ – sambler Sep 21 '18 at 9:03
  • $\begingroup$ @sambler Both of those methods end up clipping the texture to the dimensions of the image. Again, this is different to behaviour for material node. See here: imgur.com/a/2FINzvG $\endgroup$ – d401tq Sep 23 '18 at 6:50
1
$\begingroup$

Instead of using a gradient you can build a mask really quickly. Use the shift drag function to extrude a feathered edge from the shape. Invert the color of the mask using the little invert icon in the mask window.

defocus using a mask

$\endgroup$
  • $\begingroup$ Thank you. I will give that a try. It would (as always) be nice if there was a procedural way to do this. $\endgroup$ – d401tq Sep 23 '18 at 6:51
  • $\begingroup$ Well you can use the distort>lens distortion node, leave it in white, you'll get a fitted circle (circle edges touch all sides of the pros dimensions). Then apply a blur. $\endgroup$ – 3pointedit Sep 23 '18 at 11:49
0
$\begingroup$

Well you can use the distort>lens distortion node, leave it in white, you'll get a fitted circle (circle edges touch all sides of the pros dimensions). Then apply a blur.

distort node

Or for a perfect circle use a Bokeh Shape node with Rounding turned up to 1.000. Add a Scale node set to Fit, then blur or use Dilate/erode node set to feather

bokeh circle

And you can make variations of gradients using the texture Marble (in cycles or Blender internal), here I have made a rectangle that you can scale with the Less Than node.

marble square

Using this basic Marble texture

marble simple lines

$\endgroup$
0
$\begingroup$

As far as rotating a texture in the compositor goes, you can use the "Rotated Texture" node group from this file:

Explanation here: https://blender.stackexchange.com/a/131433/68997.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.