Change focus on mist pass for getting DOF in composition I'm trying to get DOF in Compositing from an OpenEXR image with Combined/Alpha/Mist passes. This is the combined pass:



I can get DOF by a defocus node using the Mist pass (after a ColorRamp to define better), but I can't set which part of the image is focused and unfocused. (I want the character with the knife to be focused, and not the other character).



If I invert the Mist image I can achieve this but the borders aren't unfocused:



Is there any better way to achieve this? FYI I have an alpha pass

Thank you!
You can try inserting an add node between the mist pass and the color ramp, to "offset" the focused value. Tweaking the values, positive or negative, you should be able to set the knife pixels as focused and the rest unfocused. If you can post an image of your mist pass i can be more accurate on the answer.