I'm trying to render with Cycles on a photo background using Blender Guru's compositor nodes:
[ Here, the foreground objects are obId=1 and are on layer 1 (rendered in RenderLayer); reconstructed background objects are obId=2 and are on both layer 1 and 2. Layer 2 is rendered as "ground". ]
However, in the current frame the main subject is supposed to be out of focus. As a result, both the ObIndex=1 pass (foreground) and the ObIndex=2 pass (reconstructed background objects, i.e. shadow catchers) are blurry. See the first two panels below:
As you can see, the blurriness doesn't consist in a smooth ramp of fractional intensities; it is instead a random cloud of blacks and whites, which will give an unusable result in terms of foreground/background separation (see the third panel).
I guess this is because the ObIndex pass only contains one integer per pixel, that can be either one of the "Pass Index" values assigned to the objects in the scene, but not anything in between.
So, my question: is there a better way to blend a rendered foreground onto a photo background that works well with blurred objects?
Here's a blend file with the scene described above.