Distance fields performance question

Hello,

In the game me and my brother are creating we make heavy use of mesh distance fields. It’s a great tool to fix a lot of problems we would normally have such as water foam around objects, water culling, damage culling and more. But we have done some performance testing and have noticed that our gpu render times are through the roof (23ms and more) only because of the distance fields. If we turn them off, we get much higher frame rates and normal GPU profiler times (14ms and less), which is really really depressing news for us.

The thing is that we would be totally okay with having only a few object generate distance fields as we only use them on particular meshes where we need them anyway. But as far as we’ve researched it’s either all or nothing, which means that we can’t exclude any meshes that are generating them without actually needing their fields.

Now, we have regained a little bit of hope seeing the new update release of 4.16 which claims to improve distance fields generating with 2.5x times faster. This would definitely help. But we are wondering if any of you have any other tips (and tricks) to use distance fields as optimal as possible. Perhaps anyone knows of a way to exclude certain meshes from generating unneeded fields?

What we have tried so far is first of all select a whole bunch of objects and ticked off “affect mesh distance fields” under lighting, but this doesn’t change anything, as far as we tested the gpu profiler still shows 6ms generation time for the fields and it’s still very much slowing down our game.

We’ve then also tried reducing the distance field resolution scale down to 0, but again to no noticeable improvement on FPS.

The strange thing is that when we ticked off “affect mesh distance fields” under lighting and then go into visualize mode “show mesh distance fields” we don’t see the object’s distance fields in there, yet somehow they are still being generated and are still impacting performance. Does anyone know why this is?

Hope we get some replies, we really love distance fields and it would be really painful and a huge setback if we have to disable them completely. :frowning:

To give an example of the “real problem”… Our game runs pretty smooth even with the distance fields. But the performance issues arise when there a lot of small objects together in one place. Most likely due to the fact there are tons and tons of distance fields that are being generated and overlapping. (although I don’t know if overlapping of distance fields has any cost). Like we have a dock which consists of many wood planks and on this dock there are also a lot of props, such as barrels, ropes, … When I look at this “clutter” of objects that’s when the real performance issues arise. The distance fields cost goes so high the game becomes really stuttery and slow.

I was just about to post a similar question. We have been using mesh distance fields for water foam, and particle collision. The distance fields can take hours to generate for the whole project, and I would hate to waste resources on something that is only used in 2 small areas.

Yeah, the problem is we can’t turn them off because we use them on some very important stuff. Even gameplay related stuff. Our ships have water culling inside them, so you can go to the bottom of a ships hull without there being any water. If we had to turn off distance fields this effect would be gone, meaning there would be water inside our ships which is of course rediculous and an absolutely unacceptable compromise.

I really hope there are some ways to improve performance and or things that we don’t know about.

In any case we will be upgrading to 4.16 tomorrow to see how the new improved distance fields update is helping with the issue.

*4.16 said to be much faster on calculating DFAO but there is no visible affect on scene ! but its much more responsive in early build than 4.16.
*4.14 & 4.15 will show effect on scene according to parameter even the DFGI is working fine in 4.14 &.15 but there is very unresponsive DFGI in 4.16. Plus the 4.16 adds pretty good overhead on HARDWARE with droping FPS.
*May be EPIC should release the patch for this or 4.17 will be only hope for all the issues!

Should the engine even be updating the clip maps continuously? Is there something moving in the scene?

Have you tested 4.16? And are you saying that distance field generating in 4.16 isn’t faster, but in fact slower? Would love to have a dev report on this.

Also I’m sure 4.16 still has some bugs, hence why we are probably going to wait a bit longer before actually migrating.

Yes the ship is moving, everything else is stationairy.

The profilegpu is very helpful. The high UpdateGlobalDistanceFieldVolume is because there is a large moving object, so it has to update the cached global distance field in that area. This cost is proportional to the number of nearby objects.

In 4.16, there is now a separate global distance field for meshes with Mobility set to Static or Stationary, from the global distance field for meshes with Mobility set to Movable. So if you set most of your scene to Static or Stationary, you can reduce the UpdateGlobalDistanceFieldVolume cost from a large moving object by 10x. In Fortnite we had large windmills causing this same thing, and the UpdateGlobalDistanceFieldVolume cost is now .3ms on consoles.

Oh wow that is great news. We will definitely be migrating to 4.16 in that case. Right now most of the objects seen in the screenshot I posted are all set to static, only the boat and the parts on it like cannons, sails and so on are moveable. I don’t remember reading this seperate distance field for moveable objects update in the release notes, did you guys forget to put it in? Or is that basically what you meant with the overall performance increase?

And thanks for taking the time to post a reply. :slight_smile:

EDIT: NVM, appearantly I’m blind. It’s in the release notes, nice!