Axel Paris - PhD Student in Computer Graphics

Home   Publications   Resume   Email   Twitter

Procedural Material Placement and PBR

June 24, 2017

Over the past two years, I have been working on a procedural system for material placement in the terrain engine. Here is the main page of the engine if you want to know more about it.
We wanted control over the placement in order to create biomes and realistic landscapes but we couldn’t do everything by hand since our terrain was realistically scaled. The solution we came up with is something we call the ‘Material Tree’.
Each node can be edited with a Unity-style inspector on the right of the editor window. We made a custom serialization system (txt files) for our trees because we couldn’t get the unity scriptable objects to work in game mode in our node editor. This also allow us to easily back up our material trees.

How it Works

The material tree is basically a hierarchical way of ordering the materials in our scenes. Only leaf nodes are actually placed on the terrain - intermediate nodes exists for decision making. Here is how it works for a single vertex:
With this process, we are able to determine vertex height as well as the ground material and the vegetation on it: bushes, grass or trees. It has proven to be a pretty solid solution for our needs: thanks to the GUI I developed, we can ‘easily’ modify the rules and see the results on the terrain.
The node editor I made was heavily inspired by this link: Seneral Node Editor. I ended up rewriting it to better fit our needs - but the idea is the same and this is a great open source tool.
The material tree allows us to create a hierarchy in the vegetation and leads to more realistic forests.



Integration with Unity Standard Shader

I have also been working on integrating our material tree with the standard shader in Unity in order to take advantage of the physically based rendering. I also took the time to integrate texture support (we used simple rgb colors). To achieve that, I had to modify Unity Shaders but to keep the part about the physically based rendering. I have to say it was fairly easy to do - the shaders are all well written and documented. In fact, I only had to modify two files: UnityStandardCore and UnityStandardInput. I removed all the reference to forward rendering since we use deferred, and then it was just calling our function to get the texture we want and pass it to the standard shader pipeline.
This series of article from the Blacksmith were helpful in that regard, firstly because they modified the standard shader too (and that proved it could be done in a reasonable amount of time) and also because they provided good calibration charts for natural materials.
On the left, without PBR and without textures. On the right, with PBR and textures. We use normal maps for rocky materials only.

Future Work