This question is related to: http://blender.stackexchange.com/questions/67346/where-do-the-white-lines-come-from-in-my-composite
The solution in the above link solves for 2 render layers. I am trying to find a more generic solution that can be applied to any number of Render Layers. Below is the node structure of a shoe model that has 4 Render Layers. I have tried many variations and the closest that I could get is the one below:
To give a context, the above node structure renders masked images of shoe parts. These images are then used by a web application, which stitches and displays to the user.
The problem that I am facing is, when the images are stitched, a Halo / transparent line / border appears in between the stitched areas. For instance, I am getting a gray border inbetween 2 stitched images as shown below:
Is there a generic solution that can get rid of the border issue, which can be extended to any number of render layers.