Heightfield scatter node doesn't work with merged height volumes

   1983   5   0
User Avatar
Member
9 posts
Joined: 5月 2018
Offline
Hi,

We have an HDA using the landscape components in UE4 as input and it scatters objects using the heightfield scatter node.
When using multiple landscape components, it only scatters correctly on one of the volumes.

I first suspected the bug is with the UE4 plugin so I ran the scene in the houdini engine debugger, in there I verified that the output from the scatter node is incorrect. I've attached a screenshot from the debug scene, showing that the scattering only works on the left part of the HF.

So, is it an known issue that the scatter node doesn't work under this kind of setup?

Thanks
Edited by andcesaro - 2019年7月20日 09:38:33

Attachments:
ScatterBug.PNG (408.1 KB)

User Avatar
Member
900 posts
Joined: 2月 2016
Offline
I don't know, could you produce an example hip file?
Edited by Andr - 2019年7月20日 13:26:14
User Avatar
Member
9 posts
Joined: 5月 2018
Offline
Andr
I don't know, could you produce an example hip file?

Here's an example showing the scatter problem.

Attachments:
TerrainDebug.zip (124.2 KB)

User Avatar
Member
900 posts
Joined: 2月 2016
Offline
edit, double post
Edited by Andr - 2019年7月22日 04:03:29
User Avatar
Member
900 posts
Joined: 2月 2016
Offline
Hi, the problem seems to be that when you do the merge of the 2 heightfields you end up with 2 different ‘height’ volumes with the same name.

And later on in the “adjust_by_height1” wrangle node inside the ‘scatter’, the code is trying to sample from the ‘height’ volume. You have 2 of them, but only one would be sampled from.

This is the vex code:
vector updir = normalize(volumeindextopos(1, 'height', {0, 0, 1}) - volumeindextopos(1, 'height', {0, 0, 0}));
@P -= updir * dot(@P, updir);
@P += updir * dot(vector(point(1, 'P', primpoint(1, nametoprim(1, 'height'), 0))), updir);
@P += updir * volumesample(1, 'height', @P);


Solutions I can see:
1)you find a way to do an actual merge, so you end up with a single height volume.

2)Or you could rename to ‘height2’ the height volume of one of the heightfields. Then in the vex code you could put some conditionals to identify which volume to sample from (height or height2)
Given that you know the position and the size of the first volume you could replace the last line with something like:
if(@P.x < 100) // 100 in case of a heightfield centered in 0, and with width of 200
{
   @P += updir * volumesample(1, 'height', @P);
}
else
{
   @P += updir * volumesample(1, 'height2', @P);
}
3) There might be a even simpler way to fix your scene that I'm not aware of, since I'm not very practical with volumes handling
Edited by Andr - 2019年7月22日 04:06:23
User Avatar
Member
9 posts
Joined: 5月 2018
Offline
Hi,

Thanks for the explanation, it makes a lot of sense to me

I'll take a look of those options and see which one is the easiest to implement.
  • Quick Links