How to use the Skylight Env Map Sample node?

Has anyone used the “Skylight Environment Map Sample” node? (Or SkyLightEnvMapSample…)

Weirdly, the material preview in the content browser looks like I expected it to look, but not in the viewport (and in the editor it’s broken due to 5.1 being borked).

I hope I don’t have to calculate the bounce angle myself somehow?

I know this isn’t much help but… it works on my machine.

For what it is worth, because you’re using the normal as your sampling direction, testing on a cube won’t work, since all the pixels of each face are the same normal you will just get flat colors on all sides. So your in-game screenshot may actually be correct.

You would want to use ReflectionVector as the sampling direction to get a proper reflection on a cube.

1 Like

Fantastic, ReflectionVector worked great, thank you!

Unfortunately, I discovered that even though I plug this into basecolor, the cube is black in Lumen reflections… even though apparently a shiny material (sphere) can reflect the sky…

EDIT: Interesting… what I guess is the screen space portion of Lumen does reflect the node properly… (and weirdly in the screenshot below, the waterplane is basically the same as the cube now, yet still reflects grey instead of black)

1 Like

It may be that Lumen simply can’t sample the skylight texture when it is building the surface cache. I’m not sure, but you could try asking in the Lumen feedback thread, sometimes the Lumen devs respond to questions there.

1 Like

Lumen doesn’t support reflections inside other reflections (in other words, it’s single bounce only). So metals and highly reflective objects will appear black within reflections when using hit lighting. The only practical fix for this is to use the Raytracing Switch to revert to a less shiny material inside reflections.

Here’s a video that goes into how this can be done.

Nice video, unfortunately it doesn’t seem to have anything to do with the Skylight node, since I couldn’t see a difference with the “hit lighting” switch…

Right. It’s not about sky samples, but you’ve missed the point. Lumen doesn’t support all material features in the raytraced pass. The part that works is the screen trace, the part that doesn’t is the raytrace. Just like in the metals video, you will need a fallback option for when the environment sample fails during raytacing. It’s the exact same issue, just a different case.


Here’s an example like yours, half the cube is on screen so it can screen trace. The other half is raytraced. But instead of appearing black like in your scene, the quality switch reverts it to a cubemap. It could also revert to a solid color. It won’t be a perfect match because it can’t sample the actual light, but it will look much better than black.

1 Like

Thank you for the clarification!

I had already began experimenting with a SceneCaptureCube set to an empty ShowOnly list and I get the same result as you from that (without even having to hook up the RayTracingQualitySwitch).

This is promising, but holy smokes the performance tanks with the scene capture cube… I wish I could set it to capture every 2nd frame or ever 10th or something… :sweat_smile:

Yes you can just use a cubemap without any switch because the raytrace can sample textures. Surely you can use a blueprint to only periodically capture. Often its good enough to just capture one or a few static maps to blend between based on time of day and weather. Almost no one will notice that the clouds don’t line up perfectly in a reflection, especially if it isn’t a perfect mirror. If you’re going for realtime then the idea is just to get an approximation that will fool the eye. Right click the captured texture and you can save it as a static image.
I also assume they will eventually expand the sampling options for Lumen’s raytrace.
Another example that falls into the same failure state is attempting to sample distance fields in the reflection of Lumen.