How can I access a camera's color/depth targets for offscreen processing?

Preferably through C++.

It’s easy enough to make a custom post-processing material, but what if I want to get SceneColor and SceneDepth, for more complex offscreen uses? The only options I could figure out are:

  1. Create a Scene Capture Component that mimics the camera, rendering the entire scene a second time.
  2. Create a UAV and add a dummy post-process Material which copies the color and/or depth into this UAV.
  3. Iterate through all views in the scene (myActor->GetWorld()->Scene->GetRenderScene()->ViewStates) and somehow find the one that represents my player camera.

.

  1. and 2. are incredibly inefficient, and I can’t figure out if 3 is even really possible.

EDIT: I’ve also found this, which is very hacky, but maybe would work? GetWorld()->GetGameViewport()->Viewport->GetRenderTargetTexture() However it probably includes the UI and other stuff.