Thank you for quick replay! I will built ue5-main and will check does nanite writing to stencil buffers work for me. If yes, we can mark your answer as a solution.
Did that not make it into the official 5.2 release?
I just came upon this after a bunch of troubleshooting, because stencil layers rendered only black in my level.
After setting the nanite actors to hidden in game OR disabling nanite on them, stencil layers rendered fine.
We’re having the same exact issue. Turning nanite off fixed it, but assets look really bad at that point. Is there any other work-around not involving turning nanite off??
Sadly, stencil layers and nanite still don´t seem to work with 5.2.
Our workaround is:
Try to put all assets you may want to separate on separate sublevels.
Animate everything in your main sequence.
Nest the main sequence as a subsequence/shot into another sequence (we add a prefix “RP_” for “Renderpass”.
Add Level visibility track in the RP sequence.
Use the visibility tracks for the sublevels to turn off all assets not wanted in a specific render pass, or needed as an extra layer (for color correction or fade in in post for example).
Create as many RP sequences as you need and add them all to a movie renderqueue, then save the Movie renderqueue.
Anytime you need to change the main sequence, it will automatically update in the RP sequences.
This is only a workaround, if you can easily separate assets like that and if you don´t need more complex compositing, as assets not rendered due to their visibility set will of course also not cast shadows etc.
You could also create a postprocesses material that makes everything invisible, that is NOT set to a specific stencil channel, but that has its own problems.