Creating depth of field from Beauty+Depth passes (rendered in another software) Creating DoF in the compositor is very easy if you have the scene rendered in Blender and the camera depth set right. But what if you rendered a beauty (raw render) and depth pass in another program?





This was rendered in Maya, the white is at the front and the black at the back. There is no "focal distance" value on the Defocus node, so I don't know how to tell it what distance is supposed to be in focus. 

I also tried using a regular blur node with "Variable Size" on (Gaussian Type) after putting the depth through a color ramp to remap the values, but this causes areas in focus to have the out-of-focus background blur "bleed" into them:





(The whole worm should be in focus, no blurred edges)

So how should I create depth of field using these two passes alone and no access to the scene itself (since it's in another software)?
The Defocus node works in conjunction with the settings for the active camera.

You can use this node setup:



You have to check "Use Z-Buffer" so your depth image is used. If you omit the Add node all parts of the image where the depth image is black are sharp independent of your focal settings. I don't know why, maybe that's a bug.

You also have to set the "Distance" to 1.0 with your active camera selected under Properties > Camera Data > Depth of Field.

This is the result: