Distance Field Ambient Occlusion (Movable Skylight shadowing)

There’s a new feature which will be in 4.3 that provides Ambient Occlusion from SkyLights set to have the Movable mobility setting. I’ve gotten some questions about it so I made this thread. In the future the information will be in the UDN docs, but they have some latency so I’m going to post the information here.

Edit: Real doc is now up!

Let me know if you have any questions or comments

Well the results look really, really good!

Great work !



I said it before and i’ll say it again, this looks awesome! But i’m wondering if skeletal meshes will stand out too much in shadowed areas since this takes only static geometry into account?

It shadows onto, but not from, dynamic meshes. So anything dynamic will receive shadowing and look fine. Besides, most dynamic meshes tend to be smaller (in many cases) and thus SSAO should be fine for shadowing from them.

A lot of runtime taken up for a totally nondirectional and low res ambient occlusion solution I must say. But supporting some form of dynamics is still pretty good. Plus its smooth and has no popping sampling issues like probes can get.

Atm, only objects which have a distance field representation (aka shadow casting static meshes) can receive the Distance Field AO. That’s not a limitation of the technique though, just something that hasn’t been implemented yet.

Skeletal meshes casting area shadows / AO will have to be handled by a different feature.

Yep. That’s the price paid by supporting fully dynamic scenes. This is why we try to provide multiple lighting paths in UE4, so games can pick whichever are the best tradeoff for them.

Most other methods have better runtime cost but very poor quality. Distance Field AO operates on surfaces instead of volumes like LPV (another method to compute sky occlusion) so it can achieve much higher quality, it’s not limited to some volume texture resolution.

Hm. I enabled it in latest preview build, setup sample scene, and I can’t see it working. I mean, the scene is flat as usual. For testing I just enabled Skylight, and disabled directional light.

For reference, I had setup scene similar to the one on screenshot. Just composed from default meshes in architecture folder.


Here the same scene with Skylight + DirectionalLight


Did you follow all the directions above? Specifically “AllowMeshDistanceFieldRepresentations must be enabled for the project”

Yes it is enabled:


In DefaultEngine.ini in my game project folder.

Hmm ok. Some other things to check:

  • DX11 video card?
  • Are the meshes mostly closed? For example a box will work, a plane will not.
  • Meshes have CastShadow enabled?

After a day of confusion i found out something. In 4.2 when we set Allow Static Lighting to 0 in Project Settings > Rendering it disables Skylight as well. Will this option exclude Skylight in 4.3 since it is also going to be movable?

Will the DFAO have any effect on canceling out reflections on materials? Cause i had an issue in one setup where a room lit only by skylight coming though windows using baked skylight shadows. The wall reflections where only visible in areas that where lit(not in complete shadow).

For all three yes.
I’m using Wall_400x400 from architecture folder. Default content, to test it. Is it possible that this mesh is not thick enough ?

I hope that this feature will have a toggle to make it static so that you can use it as a fast AO, sort of like how Crytek bake theirs into a volumetric texture surrounding the whole level.

The skylight will have a toggle so that it can bake in the shadows as it does already. And using a Light Importance Volume adds baked in volumetric lighting samples for the skylight shadow.

All Movable light types work with Allow Static Lighting set to 0. No Stationary or Static ones do. Previously there was only a Stationary version of the SkyLight.

No, it only provides shadowing for diffuse lighting. For reflections you need to use local reflection captures to override the sky. The issue where reflections disappear completely in shadowed areas means you need more bounce lighting there. We mix the diffuse GI together with the specular GI (reflections) to get better local shadowing on the reflections. In 4.3 Stationary Skylights will have one bounce of diffuse GI so this should help that case.

You mean like a fast baking method right? It can’t be baked into a volume texture because a volume texture would not have enough resolution. It could be baked onto surfaces, but Lightmass does a much higher quality job of that with the Stationary Skylight.

But the whole point is to use it in fully dynamic scenes, and then “bake” it for dynamically generated geometry which won’t move afterwards.

Gotcha. That can be done, although it hasn’t been implemented. It would not be too hard, just have to render into the lightmap of the mesh, and do the same Distance Field AO shading computations. I don’t see us implementing it soon though.

I found the problem, someone had broken the project setting for this feature! Thanks so much for finding this, otherwise it probably would have been broken in the 4.3 release. Fixed in cl 2125165.

I did a test in the Destruction showcase project. Here are the steps I had to do:

  • Load once, enable the AllowMeshDistanceFieldRepresentations setting under Edit->Project Settings->Rendering, reload editor
  • Delete directional light
  • Change skylight to Movable
  • Delete all non-static meshes (brushes, destructible meshes), they aren’t supported yet
  • Delete all the meshes that weren’t closed and so are 50% grey (mostly arches)
  • Duplicate some of the remaining meshes and build something of them. Change scale to be uniform.

This doesn’t seem to work. If I enable it and close the editor, it will be set to true in DefaultEngine.ini, and if I then start the editor again and open the project settings, it will be disabled.