Is there a way to get LDR Scene Color and Alpha in a Single SceneCapture pass?

Is there a way to get an LDR Scene Capture with Alpha, without paying the costs for two separate Scene Capture passes?

In our game, we use SceneCaptureComponents to capture dynamic in-game objects for use in the UI. To get an image that looks appropriate, we currently must do two SceneCaptures, one for the LDR color, and a second for the Alpha. This has both a significant CPU cost, as well as has memory costs for data we do not use (the color results of the Alpha capture)

We do this because to get a color result that looks correct, we must use one Component with Capture Source set to `Final Color (LDR) in RGB`. And to get an alpha that looks correct with things like VFX, we must capture again with `Scene Color (HDR) in RGB, Inv Opacity in A`. We could not find a built in Capture Source that provided both the LDR color and the Opacity.

We were hopeful that there would be a way to do this capture in a single pass to improve both CPU and Memory usage.

We were hopeful that some option such as these might exist:

  • A) A way, possibly through engine modification, that would allow a CaptureSource like `Final Color (LDR), Inv Opacity in A`
  • B) A way to reliably apply the tonemapping operations to take an HDR image down to LDR, so that we can use `Scene Color (HDR) in RGB, Inv Opacity in A` and apply that operation.
  • C) Alternate optimizations that might meet those goals, such as a way to optimize the Show Only list and not pay the memory for the unused color channels of the Alpha capture
    • In our earlier testing, it seemed that the ShowOnly list was applied as a filter on the whole scene, and Scene Captures still had significant CPU costs even when only one item was in the ShowOnly list if the main World was complex enough.
  • D) A canonical way to show a model in the UI without needing to use a SceneCapture
  • E) Some other recommendation?

We are highly motivated to take effort on our side to improve the performance issues we are seeing, but we are not sure what direction is most advisable. Is there a good way to for us to eliminate the extra overhead we are seeing?

Steps to Reproduce

  1. Open the attached project
  2. Open DemoMap
  3. Inspect BP_TwoPassCapture and note that `CaptureScene` must be called twice
  4. Hit Play In Editor
  5. Note that a sphere shows in the right side of the UI that looks approximately like the sphere scene in world

Ideally the final image in Step 5 would be possible without needing the two Captures in Step 3

Adding reply with demo project attached, for visibility for other UDN members browsing this question.

Thanks for such a detailed answer Jason!

It looks like we should be able to get everything working with this information. On first tests it looks like r.PostProcessing.PropagateAlpha will allow us to bring things down to a single pass.

We are not yet on Unreal 5.6, but once we are I will try the additional suggestions, they sound great, thank you!

Cheers!

-Rick