Would anybody be able to tell me the appropriate workflow to separate my scene in different render layers? I cannot seem to find what I'm looking for anywhere.
My goal is to save render time by only rendering one frame of the background/foreground and then render all the frame of only the animated elements (or subject) and its contribution on the background.
In the most simple conditions (the subject is not casting a visible shadow or visible reflection on the environnement), I'm able to do it :
- You create a render layer with only the environnement and you render only one frame.
- You then create a render layer with everything, but the environnement's primary visibility is turned off.
That way, you can easily merge(over) the animated subject on the environnement and that's it.
But I start having problems when, in the frame, the subject is casting visible shadows and/or reflections on the environnement. So I'm having two problems : the shadows and the reflections.
For the shadows, I need to render the shadows it's casting on the environnement and that I can do :
- You create a render layer with everything, but you turn off the environnement's ability to cast shadows.
- You apply a aiShadowMatte shader override on the environnement.
- You turn off the subject's primary visibility.
That gives you a black image but with the subject's shadow in the alpha channel. The problem is that when I try to composite that shadow over the environnement (that has its own shadows on it), I get double shadows where the subject's shadow overlaps the environnement's shadows.
So I though of a solution : I need to also render separately the environnement's shadows so I can appropriately merge them with my subject's shadow. That's where I'm having a lot of trouble.
If I create a render layer with my light's "cast shadows" turn off and another with only the environnement's shadows (the same way I did for my subject's shadows), the result is not the same as the beauty. The colors are not the same, the shadows are different and my windows are not casting appropriate specular highlights on the floor.
I tried the different albedo AOVs and the shadow_matte one, but I guess I don't know how to appropriately use them for what I want.
As for the reflections, I'm able to isolate my subject's reflections, but I don't know how to composite them on the environnement because I don't end up with a useful alpha channel to merge(over) them. And to merge(plus) them would be wrong.
So would anybody be able to help me? Or tell me where my reasonning is wrong at least. I'm I way out of my league? Or is it simply impossible to do what I want to do? How would you do it?