1 vote Vote

Split node with "random" layer selection interacts poorly with multi-prefab Objects node

The Split node uses the same random selection based on the Transition hash value that the Objects node uses to randomly select between multiple prefabs. Depending on the weights of the split and the number of prefabs, you can get a filtering effect where only one of the prefabs is placed.

For example, if we Scatter, then Split into two streams so that the first stream going to an Objects node has a weight of 25% of the total. Then if the Objects node has 4 prefabs defined, you will only ever get the first prefab placed in the world.

A "fix" (but maybe not the best) for the issue is to modify this line in the Split node:

ObjectsModifiers.cs line 326: float randomVal = random.Random(trs.hash);

to
float randomVal = random.Random(trs.hash + 1);

David Satnik , 08.10.2020, 03:15
Idea status: completed

Comments

Wraith, 09.10.2020, 00:26
Split node distribution should depend on the Seed value. Changing it will instantiate absolutely different noise (random) object. Isn't it working?
David Satnik, 10.10.2020, 01:31
Good point. I had changed the graph's seed number and since the Objects node doesn't have a Seed field I was assuming it was using the graph's seed value. I didn't change the Split seed default and got these results. If I do change the Split Seed value I get better results.

Maybe the default seed value for Split shouldn't be the hidden seed value for the Objects node (or maybe the Objects node is supposed to be using the graph's seed value?). I spent quite a few hours trying to figure out why only one of the prefabs was being selected.

Thanks for your response. Now that I know I should always change the Seed value for Split it's working for me!

Leave a comment