2 custom stencil passes for the same mesh without duplicating skeleton.

Is there an efficient way to doing 2 depth stencil passes for a skeletal mesh without duplicating the mesh and copying the pose everyframe between the 2.

We have some custom stencil code that writes to different parts of 8 bits different information. One with depth enabled and another with it off. So we can make use of that in the shader.

We tested it working by duplicating the mesh and having it follow the original skeleton with only rendering to the depth pass . This works well. But copying poses between 2 meshes just after extra info seems extensive. Is there another way this is possible to do.

We modified FCustomDepthPassMeshProcessor::AddMeshBatch( , to duplicate the draw commands directly based on information in the primitiveproxy. That works but that fails multiple checks in place that are checking if the drawcommands number match the actual number of dynamic mesh elements gathered.

Steps to Reproduce

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:

Hopefully that helps. Please let me know if you have any further questions.

Best,

Sam