Ambient Occlusion mask not stored in Volumetric Lightmaps?


I have a hard time getting Lightmass to store the Ambient Occlusion mask in the volumetric lightmaps. It works perfectly for regular lightmaps however.
Is it a bug?

I need it in order to have consistent results for all the objects in the scene.

Do you mind giving some screenshots and a bit more info of what you’ve already tried?

It’s hard to diagnose what’s going on with the limited info


As far as I know, this is a limitation, unfortunately. Volumetric lightmaps encode directional irradiance as a small number spherical harmonic coefficients for each cell (which is important for memory and performance, given the number of voxels needed to light a whole scene). Adding AO information would probably be at best modestly annoying to implement, and I’m not sure it would be worth it from a performance/memory standpoint.

One workaround that I’ve used is using the “distance to nearest surface” material node (which samples the global distance field) and doing some arbitrary math to the result until it starts to resemble the static AO mask. Some times this works acceptably; sometimes it doesn’t. Naturally you’ll never be able to get fine details using this method (e.g. for staining some kind of wood carving) but the volumetric lightmap wouldn’t work for that either.

On a side-note, I’ve also noticed that virtual texture lightmaps also don’t seem to store the AO mask either.

I have an emissive shader that I want to mask out using precomputed AO. As you can see it works for “Surface” but not for “Volumetric”, when force overriding the setting for 2 selected objects.

edit: shader is default lit, but I have emissive component to simulate sunbounce that I do not want to have inside buildings.

Ok, thanks. I will see if I can expose either GetVolumetricLightmapSH3 or GetPrecomputedIndirectLightingAndSkyLight to use as a mask instead. Those would be present for both surface and volumetric I assume. I need the AO to work more like a proper sky occlusion, so distance field data would not be sufficient.

One more question, is your shading model set to unlit? If it is, I believe that it won’t get calculated in lightmass, and by that measure, that may be why you aren’t seeing this render out an AO mask. Also, is there a reason you don’t want to use the surface lightmap? I don’t think you’ll see much difference in quality if it’s all static and simple object such as what appears to comprise your scene.

Shading model is set to default lit.
I am using surface lightmaps for the most part. But the dynamic objects, such as the player character and other things (like the landscape and foliage/scattering) are not part of the bake and needs to use the volumetric lightmaps.

I really only need a way to tell if an object is outdoors or not (if it can see the sky). I assumed using the ambient occlusion mask as a sky visibility function would just work.

Are there any other ways, than using the Ambient Occlusion mask, to tell if an object is indoor or outdoor in Unreal?

How can I access sky visibility in a shader? For instance, If you have a global procedural rain shader, how do you usually prevent it from appearing under a roof?