Moving UE4’s Foliage System in Unity
Events
Subscribe:  iCal  |  Google Calendar
Cologne DE   20, Aug — 25, Aug
Vienna AT   23, Aug — 25, Aug
Anaheim US   27, Aug — 30, Aug
SEATTLE US   30, Aug — 3, Sep
Vancouver CA   4, Sep — 7, Sep
Latest comments

Oh shit!

by S.K.O
7 hours ago

VUE without competition

by John
7 hours ago

Can you please give us a walkthrough how to implement this into Maya? would be super helpful. Thanks a lot.

Moving UE4's Foliage System in Unity
25 October, 2017
Interview

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

Introduction

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.

System

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…

Editor

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.

FPS

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. 

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 80.lv on FacebookTwitter and Instagram

Comments

2
Leave a Reply

avatar
2 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
2 Comment authors
Robytlarayen Recent comment authors
Robytla
Guest
Robytla

It is available in the Unity Asset Store: https://www.assetstore.unity3d.com/en/#!/content/99233

rayen
Guest
rayen

where we can buy his asset