The state of Distance Field GI in 4.8

Any progress on DFGI will likely have to wait until 4.9. Though I wish some features from 4.9 could make it into 4.8.5 or something :wink:

I imagine the Kite Demo project settings are going to have a lot of these enabled/tweaked by default when it releases(tomorrow hopefully).

Is there any way to let a landscape generate distance fields so that I can get DFAO between objects and a landscape?

Another thing I wonder about is how can we enable Heightfield GI but disable DFGI? If I don’t specify r.DistanceFieldGI = 1 in the ConsoleVariables.ini then DFGI is disabled but HeightfieldGI also is disabled.

I’ve been hoping to replicate the Kite Demo’s settings, though I know I probably won’t be getting the free bounce light from ticking off “Lower Hemisphere is Black” on the Skylight(Would be cool if we could set the color right there). However I’m having issues with Heightfield GI. It is definitely on, but I’m getting flickering/shimmering on static meshes as I move/look around, the flickering goes away when I turn off Heightfield GI. It almost looks like water caustics on the rock from the Starter Content.

HFGI also doesn’t seem quite like the earlier example photos in this thread(with the white landscape pictured).

Yeah, I’m confused by this as well.

Yes. There are three cvars:
r.DistanceFieldGI - must be enabled for either feature to work, defaults to off
r.VPLMeshGlobalIllumination - must be enabled for surfel GI, defaults to on
r.HeightfieldGlobalIllumination - must be enabled for heightfield GI, defaults to on

So you can get heightfield GI but not surfel GI by using

Landscape is represented by a heightfield, and it already causes occlusion on other objects. You can use ‘r.AOHeightfieldOcclusion 0’ on the console to disable occlusion from heightfields to see the impact it makes. It tends to be hard to notice as sky lighting is mostly coming from above anyway.

Objects with a distance field representation (static meshes) cause occlusion on the landscape as well.

These are the settings the Kite demo uses, you can find these in its DefaultEngine.ini

; Expands DFAO / heightfield GI view distance up to the maximum
; Enable heightfield GI
; Disable surfel GI

Thanks for the explanations! Heightfield GI is really nice, it’s everything I need in my game, could not look better!

However, the performance seems to be not too nice. I use:


And it takes ~8.3ms on my Radeon HD 7850 in Full HD and standalone.

But if I set r.HeightfieldGlobalIllumination=0 to disable all GI, then the “Distance Field Lighting” in the GPU Profiler still takes ~5.6ms. What is happening there? Heightfield GI is disabled and DFGI is disabled but it’s still using 5.6ms of the GPU?


I guess I found what’s causing the 5.6ms, it’s the DFAO! But how can I disable DFAO and still have heightfield GI enabled? DFAO seems to be too expensive for the slightly better look it provides at the moment (for me), guess this is solved with the optimizations which are in 4.9, but heightfield GI is really nice with less than 3ms on my GPU. The problem is, if I set r.DistanceFieldAO=0 then automatically the heightfield GI is disabled.

Also, I posted a thread about the state of HFGI, DFGI, and DFAO on console, but Tim Hobson linked me here and said I should just ask here, so I’ll repost my question here:

What is the state in terms of implementation and performance for DFAO, HFGI, and DFGI on PS4 and Xbox One? Also, what are the plans for those techniques in terms of improving their performance and implementation on PS4, Xbox One, and PC? I saw that DFAO got a nice performance increase and quality improvement in 4.8, but what is the actual performance on PS4 and Xbox One? Is it similar to the performance on a mid-spec PC, like ~5ms for DFAO and HFGI?

And John Alcatraz, I am not 100% certain (and I’ll let an Epic dev confirm/deny this), but I am pretty sure that HFGI and DFGI use the information from DFAO in their calculations. That is, if I am understanding the techniques properly.

DFAO and heightfield GI are coupled. This is partly because they use the same shading framework (very low res, interpolated to high resolution with a bunch of filtering) but also because DFAO provides local occlusion to the heightfield GI.

Yes, Heightfield GI is currently a high end feature. In the Kite demo it was 2.8ms on a 980GTX (on top of the DFAO cost). A 980 GTX is about 2.5x faster than your AMD 7850. There’s a lot of potential for optimization here so I think it can be made to run well on mid spec cards like the AMD 7850 you have.

So far DFAO has been optimized significantly in 4.9, but we haven’t gotten around to optimizing heightfield GI yet, in fact it has gotten a bit slower as a side effect of the DFAO optimizations.

Actual measurement of DFAO in 4.9 in a Fortnite level on PS4 is
[2015.05.11-19.50.45:764] 57]LogRHI:Warning: 15.5% 3.71ms DistanceFieldLighting 0 draws 0 prims 0 verts

Kite demo on an AMD 7870 (close to PS4 specs) in 4.9
[2015.05.01-03.00.51:137] 81]LogRHI:Warning: 6.8% 4.89ms DistanceFieldLighting 0 draws 0 prims 0 verts

I would consider DFAO to be usable on PS4 in 4.9, the rest of the features are not. We have not gotten a chance to test on Xbox One yet, but I expect DFAO will be too slow to use there as the Xbox one GPU is very weak. However with lowering the resolution enough, it can potentially run the same features as PS4.

Thanks! I guess HFGI is 3ms for me because I have very few geometry in the scene at the moment… And even if HFGI got a bit slower in 4.9, with DFAO getting faster I guess at all HFGI will also run faster because DFAO takes 2/3 and HFGI only 1/3 of the frametime :smiley:

Thanks for the answers Daniel! Considering the GPU difference between both consoles, when you do run tests on Xbox One (and I hope you do so soon), you should probably run tests at a lower resolution than PS4, aka 1080p on PS4 and 1600x900 on Xbox One or 1600x900 on PS4 and 720p on Xbox One. I’m really looking forward to seeing the differences.

Also, do you have any ideas on when we’ll see HFGI optimizations get put into UE4? Are you thinking it may be possible to get some in 4.9 or are we probably waiting till 4.10?

Thanks again!!

cant work help me

To help you, we need some info:

What did you do already exactly?
Does DFAO work?

startup not a 1.

where write console variables.ini

You have to add the variables in the ini, and if the ini is read-only, then you have to turn that off. Can you please put questions like this in the Rendering sub-forum as a whole and not in this thread, as it distracts from this thread’s intended purpose of informing users of the state that DFAO, DFGI, and HFGI are in for the 4.8 release of UE4 and potentially for later releases as well.

Also, my eariler question still stands.

Sorry I don’t know that yet, depends on when I get a chance and if it actually works out. It’s looking unlikely for 4.9 as the branch date is coming up.

Wait, so you are the main developer behind DFAO, HFGI, and DFGI? Awesome!! Also, maybe this is obvious, but are DFGI and Surfel GI the same thing? If not, what is the difference/can you define them both?