I’m trying to test using the compositor to add Depth of Field from previously rendered passes. I’m using Blender to render the layer passes now, but I would also like to be able to use this to composite layers rendered in other programs.
First, I created a scene and set the DOF at the green monkey. Using the Defocus node and compositing directly at render time, I get the expected result: green monkey in focus, softer focus on the others.
In order to test the compositor alone, I then render an OpenEXR RGBA with Z-buffer and a separate image with no DOF, no Z-buffer and no compositing (everything in focus).
From older tests and previous threads, I know that I can use Map Value and Color Ramp into Blur nodes and combine those for a DOF effect as described here:
What I’m wondering is if it’s possible to use the Z-buffer from the .exr (with or with Map Value) to go into the Defocus node Z input. Something like my attached node setup. It seems like this may not be possible, since there is no camera in the scene to send input to the Defocus node.
Can I use the Defocus node this way without the need for Color Ramp and Blur nodes when compositing pre-rendered images? What settings do I need in the Map Value to recreate the DOF of the original render time composite?
The .exr Z-buffer alone directly into the Defocus node just blurs the whole image. With the posted node setup (Map Values and Z Combine), I don’t get any DOF effect. Everything is sharp regardless of Offset or Size settings in the Map Values.
- render-time composite with Defocus, the desired result
- render-time composite nodes
- nodes attempting to composite previously rendered layer image and Z-buffer (not working)