Hello there!
I'm a Houdini beginner, and for a while now I've been struggling with developing and HDA for Unity that basically just gets a terrain input from within Unity, does scattering inside of Houdini and then outputs the final terrain with trees.
Everything's working well except the importing process. I'll attach a screenshot showing how I'm taking the terrain input from Unity.
The input system works, but it fails on some key points that I must have in order for this system to do exactly what I need from it. The thing is, the input system works perfectly if my Unity input terrain is at least 512x512 with a heightmap resolution of 513x513. That's great, however, I need my HDA system to work just as well with some very specific numbers, since that's how the game I'm working on has been developed so far.
I need my HDA system to work just as well when I'm feeding it a 100x100 Unity terrain with a heightmap of 1025x1025, and it doesn't. It's either not outputting anything, or it's outputting the terrain with artifacts.
I noticed that I'm able to output 100x100 terrains with a 1025 heightmap only if I'm creating the terrain from scratch inside Houdini. So if I create a Heightfield with size 100x100, and Grid Space of 0.09765625, then that's the equivalent of a 100x100m terrain with heightmap 1025, in Unity.
I came up with that uncommon Grid Space number by dividing the desired heightmap resolution (1024) by the terrain length (100) and using that result to divide 1 by it (1 / 10.24 = 0.09765625).
As I said, if I create a Heightmap inside Houdini with those settings, then my HDA outputs a perfectly nice 100x100 terrain with Heightmap resolution of 1025x1025, which is what I need.
The only thing is, I need my HDA to do the exact same thing but using an input instead of a normal Heightfield node. The reason for that is that I already have my terrain tiles done inside of World Machine and have brought these into Unity. I want to be able to feed my HDA with a specific terrain tile, have it do the splatmapping and scattering and then have that HDA output the final terrain correctly.
Below is a screenshot of my import system. And I'm using the "Object 1" parameter from Object Merge as a public input in my HDA, so I can add a Unity terrain into that slot from within Unity itself.
Can anyone point me towards the right direction with this one? Thank you so much!
Taking terrain input from Unity through HDA
2414 2 1- radumitroi95
- Member
- 7 posts
- Joined: Dec. 2021
- Offline
- Jake6
- Member
- 5 posts
- Joined: Sept. 2021
- Offline
I had a similar problem in my project and I was struggling for a long time.Finally I gave in.
If any heightfield needs to be imported into unity from houdini,I will always use power of 2 starting at 64 to decide its size.
I think you may read following link for details especially chapter Terrain(Height Fields),hope it useful:
https://www.sidefx.com/docs/unity/_terrain.html [www.sidefx.com]
If any heightfield needs to be imported into unity from houdini,I will always use power of 2 starting at 64 to decide its size.
I think you may read following link for details especially chapter Terrain(Height Fields),hope it useful:
https://www.sidefx.com/docs/unity/_terrain.html [www.sidefx.com]
- radumitroi95
- Member
- 7 posts
- Joined: Dec. 2021
- Offline
I managed to get it my way in the end. I couldn't use the proper sizes of power of 2 since I was already deep in production when we implemented Houdini and our terrain was already made out of 100x100 terrain tiles. Changing the size of those was a big no from the start.
The way I ended up doing it was to create a heightfield with a size of power of 2, so 128x128 for instance, and then use a Heightfield transform node to resize it so that it would be 100x100. I found this way to work properly and bypass that limitation.
You can do it with any size you want. For instance, we needed our terrain tiles to have a heightmap resolution of 1024x1024 and you can only get that by creating a heightfield of 1024x1024 with a Grid Spacing value of 1. Then just use a transform node to resize that whole thing until it's 100x100. And that way you end up with a proper terrain that's 100x100 and has a 1024x1024 heightmap resolution.
The way I ended up doing it was to create a heightfield with a size of power of 2, so 128x128 for instance, and then use a Heightfield transform node to resize it so that it would be 100x100. I found this way to work properly and bypass that limitation.
You can do it with any size you want. For instance, we needed our terrain tiles to have a heightmap resolution of 1024x1024 and you can only get that by creating a heightfield of 1024x1024 with a Grid Spacing value of 1. Then just use a transform node to resize that whole thing until it's 100x100. And that way you end up with a proper terrain that's 100x100 and has a 1024x1024 heightmap resolution.
-
- Quick Links