Unreal Foliage Tool, Scalability Settings & disappearing objects (density setting)

MarkBlog

Anyone who has used Unreal Engine’s foliage tool within the editor will know just how incredibly powerful it is and how easy we can populate some terrain or a map with trees, bushes and the like.

I’m usually someone who is building tools for artists or designers, extending the editor through plugins, modules or C++ extensions to help with Blueprints… so when working on my own projects and how vast Unreal is in both the Engine and the Editor, it’s really easy to miss or overlook something that already exists.

I develop on an ultra-high-end machine, so I can experiment and throw all the polys, materials, lights and content I want into a level, without a care in the world. But when it comes to having that same game run on the widest hardware available, any game dev can attest that optimization and scalability are key areas. Within Unreal, we can profile using stat files (help isolate whether CPU or GPU bound), Unreal Insights (to provide greater detail on GPU usage) and other external tools. And once we’ve isolated what needs adjusting and where, there are a number of ways we can improve performance.

The one I’m focusing on right now is the Scalability options.

By default, this is in the top right corner of the Editor window under Settings, Engine Scalability Settings and should see a box like this. I’m sure many are familiar with it and how you can change the various scalability options to see what you game would look like at lower settings.

You can also change these at runtime in Development or Debug builds via console commands such as sg.FoliageQuality with values ranging from 0 to 3.
These can also be changed in a Shipping build either through some code (C++ or Blueprints) or by opening the GameUserSettings.ini (check the default location on your platform) and adding/modifying the lines below the section [ScalabilityGroups]. Again, as we’re focusing on Foliage, something like the following will adjust a few settings to give you different scalability outputs:

[ScalabilityGroups] sg.FoliageQuality=3

In the game I’m currently working on, Walkies, I needed to have a build that run on a Laptop with a GTX1070 GPU. This is a far cry from the RTX3080Ti I use on my development machine. After already profiling using the methods mentioned above and fixing a few glaring issues, I found that dropping the FoliageQuality lower than 3 would make some important meshes disappear!
Their collisions were still in the world, just the visual mesh was not being rendered.

As with many things in Unreal, there is always a way… and it’s usually a check box!

When in Foliage Mode, select the mesh that is disappearing, then scroll down until you find the Scalability area. Make sure you untick “Enable Density Scaling” on the meshes you want to keep. Of course, keep in mind this line from the tooltip text:

“Enable for detail meshes that don’t really effect the game. Disable for anything important.”

Now when we adjust the FoliageQuality, other meshes such as grass or bushes that “don’t really effect the game” are reduced or removed, but large objects that are key, will stick around.

As with many of the projects I’ve worked on in the past, I will be adding the “Run Hardware Benchmark” node and use the results from that to populate the initial settings and when I can add more of the UI to enable an Options menu with adjustable Video settings, I can find the best individual settings for each of my machines, but all of that is for a future update.