Scene Capture 2D overhead vs ordinary rendering

SceneCapture2D rendering in Unreal Engine can have additional overhead because of the following reasons:

  • The engine has to allocate a new render target and set it up, which takes time and memory.
  • The SceneCapture2D has to render the scene from its perspective, which can include additional rendering calculations and data transfer between CPU and GPU.
  • The engine has to do additional post-processing on the render target, such as filtering or encoding, which adds extra cost.

In your case, the reason the SceneCapture2D is slower than just rendering the skeletal mesh to the viewport multiple times could be due to the overhead of the additional calculations and data transfer required for the SceneCapture2D. The engine might not be optimized for the specific use case of only capturing the depth information of a skeletal mesh.

One thing you can try to optimize the performance is to adjust the Render Target settings to minimize the overhead. For example, try using a smaller render target size or lowering the depth precision. Additionally, you could try to minimize the number of SceneCapture2D instances in the scene, and pool the render targets to reduce the overhead of allocating new ones.