SkyLight -> CubeMap <- CaptureScene, how to link any two of them?

Hello,

I use a SkyLight and I’d want to use a cubemap which it captures (if it is actually a cubemap) in materials. But the SkyLight’s captured contents are deeply hidden and expressed only in lighting. How do I access them?

Okay, I can input an external Cubemap for the SkyLight. I use CaptureSceneCube, set filtering flags, generate the map…

But alas, SkyLight does not accept Cubemap render targets, only static cubemaps. I can make a static texture out of a render target in editor, but I didn’t find any function to do it at runtime.

How can I solve any of these two paths?

I can capture both SkyLight for lighting and Scene Cubemap for materials, but it’s a duplication of a very expensive operation. Using dozens of precomputed cubemaps is also a bad idea, since my environment has more dimensions than mere day/night. A C++ solution is okay and even welcomed.

Okay, I’ve found ConstructTextureCube() method in UTextureRenderTargetCube, it is perfect for manually baking cubemap series, but I’m not sure if it’s efficient enough for runtime.

Digging deeper into SkyLight, seemingly it uses spherical harmonics, not cubemaps directly to affect lighting in some special pass of deferred rendering. I have no idea on how to use this rendered data in materials, so tricky unlit materials with custom use of lighting data stay impossible.

Finally, after some experiments, I’ve realized that using dozens of precomputed cubemaps seems not so bad idea since any ambient recapture (less frequent than every frame) causes abrupt changes in lighting.

Can you share your code?
I’m using ConstructTextureCube but the TextureCube I got is black.