Scene Capture Component not capturing Lumen Global Illumination

As the title states, I can’t seem to get a Scence Capture component to work with Lumen. It seems to only capture Screen Space global illumination (which i can toggle on / off).

Isn’t that how it’s supposed to be?

Lumen already handles reflections, you shouldn’t be using scene capture components while lumen is your GI solution from what I know.

Scene capture isn’t a reflection capture. Typically it is used for visual effects like portals, security cameras, and scopes. Sometimes it’s also used for UI elements (such as character equipment screens)

I am doing a 5 camera 2d capture to a material that warps the UVs for equirectangular fisheye output.

If the 2d capture component would just see the Lumen GI.

Have you found an answer for this by chance? I’m having the same issue.

I have the same issue, I can’t use Lumen for the GI in a Scene Capture Component …

Same issue here unfortunately

Same issue in UE5 preview 2…
Do you guys think it will be fixed when UE5 is finally released?

Same issue, but there should be an easy way to solve this because the camera preview window in the corner should use the same render to texture functionality to achieve the rendering of the image, and it is clearly has lumen and everything. I also looking forward to the solution, I did not check the source code yet, how the camera preview doing it.

1 Like

Still not fixed in UE5… It really sucks because I’m using composure (the cg element uses the scene capture component), so I can’t transition to the long-awaited UE5:(

2 Likes

I looked into this and it appears that the camera preview uses seperate viewports. So no scene capture involved unfortunately.

It is possible to copy the frame data from a viewport to a texture using FFrameGrabber but that might not be the best solution since copies everything from the source viewport, including UI widgets. Creating a secondary, invisible viewport to use as the source might work but I’ll have to look into it. In case it’s helpful, here’s my UE5 FrameGrabberSample fork:

In my case I just need a picture-in-picture display of the frame. Using FFrameGrabber would also capture any UI so I’ll try using a WindowOverlay instead since that’ should be above the SceneViewport on the widget hierarchy.

I’ll continue looking into it and keep you all updated on what I find.

2 Likes

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.

11 Likes

Thanks a lot for this write up! I will have to try it all out as I hope to use lumen in the future but really need scene captures to work with it! Just wanted to reply here as I really appreciate what you’ve done!

1 Like


Hi. I did everything as you wrote here, BUT unfortunately, it doesn’t work. Skylight GI calculates as before. What could be wrong, any ideas? Thanks =)

1 Like

I have the same issue, I’m wondering if its possible to create a custom scene capture component with these changes and store it within my project. It would be nice to be able to commit that to my team project vs having to update everyone’s engine.

Hello @DesART and @jmleach1987

You can apply my pull request to your own fork. Read this if you’re not sure how.

To be clear, you’ll have to fork the engine and build from source to get it to work. Modifying the source files of a binary installation will not work.

This makes me happy to read. I’m glad you found it helpful!

thank you for the response. I will try to understand and implement it then will write about what happened. :slightly_smiling_face:

1 Like

Still no reply from Epic about that?

When Click on your pull request link, it takes me to a blank GitHub page that says “page not found”. Is there a different link?