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.
COMMENTS
3clipse 5 years, 7 months ago |
Great tutorial... unfortunately cannot get the scatter nodes to cook... tried debuggin and it gave me a cygwin\prism error... not sure where to go from that or why I am getting it as i didn't have Prism installed...
shoria 5 years, 6 months ago |
Hi,
How did you fixed the problem because I have the same problem with the cygwin\prism error. Thank you.
shoria 5 years, 6 months ago |
failure at c:\cygwin\home\prisms\builder-new\nightly17.5.173cmake\dev\src\houdini\custom\pdg\hdaprocessor\hdaprocessor.c:872
3clipse 5 years, 7 months ago |
Oh everything cooks fine in Houdini but fails in Unity
wtrebella 5 years, 7 months ago |
Looks like I'm also getting this problem. Everything cooks fine in Houdini but in Unity the terrain_scatter node fails. I've tried debugging it by opening up the version from Unity, but that one fails at project_terrain, which is weird. It seems like it might have something to do with the Table Import node?
wtrebella 5 years, 7 months ago |
I figured out the problem. For some reason in Unity the path to the csv file has to be relative to the Assets folder. I'm not sure why, and maybe Kenny could enlighten us, or explain a better way to do this. But for now, I dropped the foliage.csv file into my Assets folder and pointed the file there (instead of the absolute path where the csv was located in the Houdini project folder). It then worked!
2523279049 5 years, 6 months ago |
I also have this problem, but it has not been resolved.
Always complaining about such an error:
Getting Instance Transforms : Invalid argument given: Geometry is not an instancer.
If session is invalid, try restarting Unity.
Higashibashi 5 years, 5 months ago |
Same issue here. Tried moving the csv to the assets and repointing but still cook failed on the scatter. Not sure where to go.
yanglucaicai 2 years, 9 months ago |
Same issue here.
yanglucaicai 2 years, 9 months ago |
Do you find way to fix it ? Getting Instance Transforms : Invalid argument given: Geometry is not an instancer.
wtrebella 5 years, 7 months ago |
I've been following this tutorial series and they're wonderful. Only problem is that none of the assets are available for download (textures for terrain, prefabs for foliage, etc.) I can't find them in any of the project material zips. Am I missing something?
Thanks!
3clipse 5 years, 7 months ago |
They aren't supplied... a simple google search will get you some .tgas and some .prefabs... (there are enough just on the unity store)... they are good enough to get through the tutorials.
deroomaarten 5 years, 6 months ago |
When I re-open my project, the whole Geometry file goes wrong and has problems with finding and updating the `@pdg_output`.
Does someone know a fix?
deroomaarten 5 years, 6 months ago |
*file node
deroomaarten 5 years, 6 months ago |
Found a solution for the people with the same problem.
Delete all the .bgeo files in the geo folder and dirty and cook again
Higashibashi 5 years, 5 months ago |
Damn I was looking for days to figure out what this kept happening from Section 3 glad I read Section 4.
Is this the only way to fix it each time? Seems bizarre to keep getting red exclamations every reboot.
seelan 5 years, 5 months ago |
Please submit any issues you find to our support so we can properly address them.
https://www.sidefx.com/support-programs/
javadgholami1369 4 years, 4 months ago |
I'm really curious about that is how to make seamless terrain for big map environment ( like so we have a map with the size of 48 km * 48 km
I see in one the Houdini showcase ( https://www.youtube.com/watch?v=NfizT369g60&t=707s) for the FarCry game (in the 5:00)
I don't understand what they do so the terrain intersection match together so please tell me ( if anyone know) how I can make this kind of feature
ZReeder 3 years, 6 months ago |
I don't know if it was mentioned, or if it was even possible at the time these videos were made, but it might be good to make use of Unity's tree instances. (See: https://www.sidefx.com/docs/unity/_terrain.html#Terrain_Scattering_Tree_Instances)
I found it was fairly simple to add the tree prototypes to the terrain and then basically just use unity_hf_treeinstance_prototypeindex instead of unity_instance for adding the trees to the points.
Some guy posted an example that I thought was helpful: https://www.sidefx.com/forum/topic/66749/#post-336427
yanglucaicai 2 years, 9 months ago |
get error when cook foliage scatter in Unity :
Getting Face Counts : Invalid argument given: vertex_list is null!
Please log in to leave a comment.