Hi! tell me please how to render on different layers two objects where one object is inside another one (eyes on eyes holes). I want to render the head of the character in one layer and the eyes on another layer and after this I whant to combine two render pictures inside Blender compositor.
Here the example of what I whant to get:
Well, you will have to render a third time, now both objects together in their final position aka your final image to generate a mask that defines how much of the eyes are gong to be seen.
Dont know if thats the fastest option for that but you could just activate cryptomatte in the render layers and then the cryptomatte node in the compositor will give you the exact mask you need.
For your shown usecase you could also just delete the backside of suzanne so you get transparent eye sockets but thats ofc not really useful all that often
In the layer with the head put the eyes in their own collection and set the collection to “hold out”
(to see the hold out icons click the “funnel” icon and enable them (it is a rectangle with a round hole.)
That layer will give you the head and alpha where the eyes are.