How can I Z-combine multiple render layers I have a problem while compositing my render layers. There is a butterfly that goes through a jungle (images as plane). It appears on the foreground, and goes to the background followed by a camera.
So I created a render layer for the butterfly alone, and other render layers for the jungle in order to color grade elements separately.
The problem is that my butterfly moves in depth. I don't know what is the best way to composite my render layers ( I am new to compositing in blender).
I tried to do that with the Z-combine node but it gives me strange result, see the images below:


It may be the wrong method? What about masking the butterfly with the alpha channel of foreground render-layers? I don't know how to do that.
I think that I found out the solution. I thought that the order you plug render layers didn't matter, but I was wrong.

Here are two screenshots : one in the right order (foreground render to background render-layers)


Another in the wrong order (butterfly still plugged first, but followed by background render-layers and and at last foreground render layers).