Moving UE4’s Foliage System in Unity

Moving UE4’s Foliage System in Unity

A little talk from Ioan Lazu about his amazing new foliage system for Unity, which was inspired by some of the Unreal’s tech.

A little talk from Ioan Lazu about his amazing new foliage system for Unity, which was inspired by some of the Unreal’s tech.


My name is Ioan Lazu and I am a 24-year-old programmer from Timisoara, Romania. My first brief encounter with the game development industry was more than 10 years ago, with an old version the ‘GameMaker’ game creation software, and much earlier than that by using some game’s map editing possibilities. Since then I’ve developed my own small engine and used the very limited existing solutions, but I haven’t got seriously into game production until Unity and Unreal became free to use.


Developing an open world game, called ‘The Unwritten Critias’, we faced the problem of low-quality foliage and poor performance while using the standard Unity solution. Therefore we developed our own solution, the ‘Critias Foliage System’ that is, as the name implies, a vegetation panting and rendering mechanism. I’ve tried to make the workflow as close to Unreal’s foliage system, in order to help people that already had that technical background.

At the system’s core lies a spatial hash space partitioning method that is very good at rendering only the visible and close instances and skipping the far away or invisible batches. The system’s main functions are hand-painting, extracting, in case that you already have a populated terrain, and most important, the rendering of millions of foliage instances in a very optimal way, that your game’s FPS is kept withing good limits. 

Using this space partitioning method instead of a terrain grid is also beneficial for other uses where you do not want to use a terrain. Maybe you want to paint the foliage on a floating island or maybe you want to add vines to a building…


While the first version was developed for SpeedTree mostly, now you can throw in it any terrain detail that you might require, including but not limited to: trees, grass, small rocks, large rocks, metal scraps, objects with LOD’s etc… Your custom shaders are also supported, however you will have to tweak them a little if you want your instances to fade out nicely in the distance. And of course, keep everything within the limits that other engines or systems might expect, I really would not recommend adding mountains or huge cliffs.

Another very important part of the system is the tweaking of the settings for each individual foliage type, like if that type can cast shadows or what would it’s maximum draw distance be. It is an absolutely vital part if you want dense looking and optimized forests. Global density settings are also available.


The first part is the smartly batching of close instances in a single draw call using the ‘DrawMeshInstanced’ API, through the mentioned spatial hashing space partitioning method. The second part is the batching of distant tree billboards, in a single mesh and passing the rotation, scale and position as UV’s, with the setup taking place in the vertex shader. 

1 of 2

So you have a distant mountain and want to flood it with trees? No problem! You can have thousands of instances that when are billboards will probably get translated into 4 or 5 draw calls.

Ioan Lazu, Programmer 

Interview conducted by Kirill Tokarev

Follow on FacebookTwitter and Instagram

Join discussion

Comments 2

  • Robytla

    It is available in the Unity Asset Store:!/content/99233



    ·2 years ago·
  • rayen

    where we can buy his asset



    ·2 years ago·

You might also like

We need your consent

We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more