Rendering Layers while compositing showing overlaping Problem! I have an Animation, at the 1st  frame, the green box is behind the Red Box. At the end of my animation, the red box in front of the green box. I want to each box is rendered as separated layers. My Problem is overlapping is going on at the last frames while at compositing.  How can I get out of here?
Thank you...enter image description here
You have enabled masking option for layer with red box, but forgot to enable it for layer with green box.