[Feature Request] [Rendering] Update individual sides of a Scene Capture Cube (within Blueprint)

258378-capture-scene-cubemap.png

As far as I’ve been able to search the documentation/AnswerHub/internet, there’s no way to update individual sides of a Scene Capture Component Cube within Blueprint. Realtime cubemaps are an expensive feature, and the ability to update individual sides of the cube would be a boon to performance.

Description of Problem

I have a forward-rendered driving game where razor-sharp realtime cubemaps are an essential element of the visuals. The actual problem with Scene Capture Cubes is they are expensive due to them consisting of six individual captures that are all updated within a single frame no matter what.

258379-cubemap.png

(ProfileGPU screenshot – “Ultra” reflection preset for dramatic effect.)

The problem can be partially mitigated by reducing various reflection quality/resolution parameters, but there is a natural overhead to setting up six different perspectives regardless of what’s being rendered. (“ResolveSceneDepthTexture” takes a fixed amount of frametime for each side of the cube.) But even without the overhead, updating every side in one go is not ideal.

The average framerate can be improved by updating the cubemap every other (or every Nth) frame, but this results in uneven frametimes at the micro level. It would be better if it were possible to separate individual sides of the 6-sided capture and spread them out across multiple frames. It would also help for captures that are updated sparsely or even just once by preventing a performance spike that would otherwise happen.

Proposed Solution

I’ve seen driving games that use cubemap reflections update their cubemaps on a per-side basis. For example, in Forza Horizon 4, the forward-facing side of the cubemap is updated at a more rapid clip than the other sides, which seem to update in an alternating pattern. I would like to have this level of control over the Scene Capture Component Cube in Unreal Engine 4’s Blueprint scripting language.

Etc…

I’m going to anticipate a couple responses:

  1. “Wait for SSR in the forward renderer.” SSR would be a nice feature to have, but it’s not quite the same as a live cubemap as it’s limited to screen-space and its artifacts are often unsuitable for sharp reflections such as on “car paint” materials.
  2. “Wait for realtime raytracing to become ubiquitous.” That is the long-term solution for sure, but performant ubiquity may be half a decade out.

Thanks for listening. All things considered, I’m loving this game engine.

Many months later I’ve rolled my own solution to this problem with a material function, repurposing nodes from the built-in “InteriorCubemap” function. The important part is the left half, which un-distorts the reflection vector and allows one to position 2D textures into a reflection in a rectilinear fashion. The repetitive stuff on the right half simply builds the box with six texture inputs representing the six sides. The “If” nodes crop out the unwanted stuff from each side before the outputs are added up.

Plugging this function into an emissive channel of a material displays the reflection. And then one uses Blueprint to drive an actor’s CaptureComponent2D to generate the per-side 90° views into six RenderTarget2D textures that the material function uses. The result isn’t free of seam artifacts but that’s probably a solvable problem.