Get Texture from RenderTarget

Hey everyone, I’m desperately trying to get day-night lighting to work in my project, but unreal seems to be blocking my attempts in every way.

I want to create a smooth and high performance lighting transition for a skylight, depending on the time of day. My latest effort (since simply recapturing the skylight causes performance to drop and updates to apply too rapidly) was to assign a custom cubemap to the skylight and just update the lighting via this cubemap. So, to make it more dynamic, I created a SceneCaptureCube and edited the showFlags so that only the sky would be drawn. With a 16 pixel CubeRenderTarget for the scene capture to draw into, I had a rendertarget with the proper sky representation at each time of day.

Now to the problem: In order to apply the lighting, my skylight needs the CubeRenderTarget as it’s specified cubemap. But in blueprint, setting the cubemap to my rendertarget is not possible:

68380-rendertarget.jpg

So, to the question, is there a way of retrieving a raw cubemap from the rendertarget to plug into the skylight, or, alternatively, is there any way at all to get decent dynamic skylight updates to work?

Hope you can help me out.

Hello Timothy,

There is actually a node within Blueprints called ‘Set Cubemap Blend’ which will allow you to blend smoothly between different cubemaps so you can avoid the hitching you experience when recapturing your Skylight.

68759-setcubemapblend.png

Cheers,

Hey ,

thanks for your answer. Sadly, I’m aware that there is a blend function, however this node doesn’t solve the fact that I can’t connect a rendertargetCube node to a Cubemap node. The only way to make this function work is if I would create dozens of custom cubemaps for every time of day, which would be a bit overkill. (Plus it doesn’t allow for weather changes, like cloudy days, which should change the lighting)
The actual problem right now is not really the hitching, but rather taking a dynamically created rendertargetCube and assigning it to a skylight in my scene.

Is something like that possible?

Well you are going to have to update your skylight every second which will be either costly, or tedious. And honestly, you would only need a handful of cubemaps to blend in between (i.e. morning, mid-morning, early afternoon, noon, mid-afternoon, early evening, evening, late evening, early morning). The blend will cleanly blend in between your cubemaps and you can avoid the hitching.

Thanks,