Hi,
thanks for reaching out. A more efficient alternative to mesh duplication and performing two depth stencil passes might be to create a custom render pass which replaces the two depth passes and only needs to be drawn once per skeletal mesh. This may help in keeping the number of draw calls to a minimum. It would require quite a bit of code, but might be worth the effort. The following links might be useful:
- Refactoring the Mesh Drawing Pipeline (Unreal Fest 2019): this talk by Epic shows an example of creating a depth pass (starting from 14:00) https://www.youtube.com/watch?v=UJ6f1pm_sdU
- https://thegraphicguysquall.wordpress.com/2021/11/15/unreal-4-custom-mesh-pass-in-deferred-shading/
Hopefully that helps. Please let me know if you have any further questions.
Best,
Sam