Scene Capture Component not capturing Lumen Global Illumination

I continued looking around in the source and found that Lumen is explicitly disallowed for scene captures.

I made some changes and was able to get it working pretty quickly:

I submitted a pull request today that allows scene captures to explicitly opt into Lumen (You’ll have to sign in to view the pull request). Hopefully they’ll approve it. I’ll keep this thread updated on its status.

In the meantime, I’ll detail what I learned below for those who are interested. Feel free to reach out if I wasn’t clear about something or if you have any questions.


Lumen is disabled for all secondary views, which includes scene captures, planar reflections, and reflection captures.

A ‘view’ refers to the FSceneView structure, which contains the details on how a frame should be rendered. A new view is created for every frame that is to be rendered.

Both primary and secondary views create instances of this same structure in their rendering pipelines, but FSceneView contains some properties to help the renderer distinguish between different types of views. bIsSceneCapture is the one we want to pay attention to.

In Engine\Source\Runtime\Renderer\Private\Lumen\LumenSceneRendering.cpp, there are two methods responsible for disabling Lumen for secondary views: FDeferredShadingSceneRenderer::UpdateLumenScene() and Lumen::IsLumenFeatureAllowedForView(). Both methods use FSceneView::bIsSceneCapture to tell whether or not a given view is being rendered for a scene capture, and disables Lumen if the value is true.

Both occurrances of bIsSceneCapture in LumenSceneRendering.cpp look like this:

&& !View.bIsSceneCapture

You can simply comment both out if you don’t mind scene captures always doing their own Lumen updates. That’s it.

If you want scene captures to need to explicitly opt into Lumen, you can pass a bool property from USceneCaptureComponent (eg. bAllowsLumen) and pass the value through FSceneView (eg. bSceneCaptureAllowsLumen). This is what my pull request does.

Views for scene captures are created in Engine\Source\Runtime\Renderer\Private\SceneCaptureRendering.cpp. Add a line to SetupViewFamilyForSceneCapture() within the for loop to pass the value to the view being created:

View->bSceneCaptureAllowsLumen = SceneCaptureComponent->bAllowsLumen;

Then all you need to do is reference FSceneView::bSceneCaptureAllowsLumen in LumenSceneRendering.cpp like this:

&& (!View.bIsSceneCapture || View.bSceneCaptureAllowsLumen

Do this for both occurrances of FSceneView::bIsSceneCapture in LumenSceneRendering.cpp. Easy enough.

It’s important to note, though, that enabling Lumen for scene captures in this way comes at a cost to performance. It gives the scene capture its own Lumen scene and does its own updates separate from the primary view’s Lumen scene. In total, it adds ~2-3ms to each frame. There’s likely also a cost in VRAM, but I haven’t measured it yet. I’m not sure if there’s a better way but I’m hoping the pull request will give me some more info to work with. Either way, I think this solution works well for now.

20 Likes