Defocus node with EXR Multilayer problem


Okay, so what I want to be able to do is to use the defocus node to create depth of field in post production using my EXR multilayer files.

A simple test image of my issue:

It works great if I do it in compositing on render, just setting a focuspoint for the camera with no native blur and then just using a defocus node. The blur is both in front of and behind the camera focus point.

The problem is that I can’t get this to work when I composite my EXR files later. Everything gets blurred with no focus.

I have tried to use map value to modify the depth map to at least create a focus point myself but I just can’t get it to work.

I hope someone knows how this can be achieved :slight_smile:

Thanks in advance!

Well, it looks like I found my own answer after all. Glad I didn’t give up!

What I did was that I simply set a focus distance on the camera in the empty scene I am doing the compositing. It seems the node fetches the camera data right away from the scene. So just put in your values in the active camera of the scene. And if you want it to be like the camera from the other file you rendered from you can just link it and make it active.

(Not to complain on the developers, they are awesome, but it seems kind of weird and against the point of nodes that they pull data from places you can’t control. Wouldn’t it be better with an input with a focus distance and then an input node with that data from your camera of choice? Just in my humble opinion :slight_smile: It would be easier to understand why the node behaved like it did if every parameter had an input in the node)

You have ‘Use Z-Buffer’ checked on the defocus node. Disable it when using an image as depth input.

Having it checked takes the depth from the scene camera, which is why it works after you set focus distance on the camera.