1 | Introduction
Foliage and scattering has always been a challenge for gamedev, especially when you are an Indie Gamedev. PDG and Houdini gives us the power to handle this with ease. Throughout this section we are going to look at how to set up an HDA to scatter points that contain paths to foliage prefabs in Unity. We will then get it hooked up into our TOP network so the scattering of foliage is produced for us.
2 | File and Gather Foliage Prefabs
To kick off this section, we need to figure out a way to find all the prefabs that are of type foliage in our Unity project. We also need to make our TOP network flexible enough so that it can be used in any Unity project as well as scale when new foliage prefabs are added. This lecture will get us started with that task.
3 | Writing Foliage Paths to Csv
PDG and TOPs allow us to save out data in many different ways which provides us a ton of flexibility. Let’s take a look at one of the ways in which we can save out all the paths to our prefabs to a CSV file.
4 | Creating The Scatter HDA – PART 1
Let’s start our Scatter HDA by getting the basic tool setup hooked into our TOP network. We will also get a few items setup in the HDA’s Type Properties.
5 | Creating The Scatter HDA – PART 2
With our HDA all set up and ready to go let's fill in the guts of the scattering functionality. We will learn how to create some effective heightfield masks as well as how to scatter points onto the terrain in a more intelligent way.
6 | Creating The Scatter HDA – PART 3
With our points in place and our CSV file containing the paths to the prefabs we want to instantiate onto the points, let’s take a look at how we place a single path on each one of the points. This will give us the ability to attach a certain type of foliage to a certain type of point in our scatter points.
7 | Creating The Scatter HDA – PART 4
Let’s finish up our Scatter HDA and get some VEX code in place to handle the data on the points, so we are instantiating foliage in Unity.
8 | Test The Foliage Scatter In Unity
With our scattering HDA complete, lets promote some parameters to the HDA and give it a test inside Unity using the Houdini Engine!
9 | Review
Whew! That was a ton of stuff to cover! Let’s do a quick review to keep the info fresh in our minds.