Multilayer, compositing, DOF and camera focus


I have found it useful to render out scenes as multilayer, in case of any errors or future changes required in the composite. The EXR files can be used as inputs and put through the compositor in the normal way.

However, with animations or DOF using the defocus and camera distance, the distance value of the camera is not stored in the multilayer. A camera has to be added to the scene with the same distance settings.

I know that this wouldn’t be a problem if you had the original .blend file, but to my mind it would be more convenient if the geometry file could be kept seperate from the composite file. Is there any way of storing the camera distance information in the multilayer file?

I have z passes enabled.

Many thanks,

Andy Curry

Hi Andy.

One thing you can do is use the “Map Value” node to tweak your Z-Depth as desired, and then use the result as the “Size” input for a “Blur” node of your image, which will give you DOF. You can animate the Map Value’s “Offset” value for things like rack focusing, etc. Here’s an example blend:

zDepth_MapValue.blend (595 KB)

Of course, this doesn’t do anything to save what the distance is of your camera’s focus point – you reengineer all that in the new .blend file. You could use drivers in the compositor, connecting them to the distance between your camera and a focus object, then another for the camera’s near- and far-clip values… you could then input each of those values into Red, Green, and Blue channels of a single image (EXR is helpful, as you’ll probably need 32-bit imagery to hold it all), and voila: I believe that’s all you need to make sense of the z-depth info, though I’m not quite sure how you’d manage to extract all that in the compositor to actually create the final image. You probably can’t use the defocus node, as there aren’t any inputs for these things. It would be cool if you could somehow extract the number again, and then use a driver on the camera’s distance, near- and far-clip values in the new .blend file, and then you can set something up with the defocus node. Okay, I’m rambling now; over and out.