Itoo Software Forum

Author Topic: Problem with Random parameter and null segments?  (Read 577 times)

tonyinseattle

  • Newbie
  • *
  • Posts: 25
Problem with Random parameter and null segments?
« on: June 14, 2022, 12:22:38 AM »
Hello,

I have a simple Array 2S with X and Y splines across I would like to randomize a plane object and a null (empty) object. For example, I would like a plane object to appear once for every 200 segments on average.

To accomplish this, I have a Selector hooked up to Default and two segments -- one the plane (Index 1) and one the null object (Index 2) -- hooked up to the Selector. I exported the Index parameter to which I attached an Arithmetic operator, to which I attached a Random number parameter. My arithmetic expression is: return if(input1==1,1,2); Or, to spell it out in English, if the random number is 1, set the index to 1 (the plane), otherwise 2 (null). This will give me a plane segment roughly once out of every 200 segments, delivering a null segment the rest of the time.

This works fine.

The problem arises when I then run this array along a spline by adding a Linear 1S generator and nesting the array to give this a "stacked" effect. For some reason, especially when I set the Random parameter to something high (say, 1 out of 1000), Railclone stops generating ANY planes along the spline at a certain point in a way that can't be attributed to just randomness. Additionally, as I flip through the seed values, the distance along the spline that the planes appears varies but there's always a stopping point beyond which there will be no more planes.

When I get up around 1 in a 1000, I can barely get anything above the first or second array along the spline; the planes never appear further along the spline no matter how many times I flip the seed. Whereas around 1 in 20, the planes always extend all along the spline.

If I replace the null segment with actual geometry, then everything works just fine. I tried attaching an EditablePoly segment to which I removed all of the polys, and that didn't work. Also tried to attach a point to null segment. Also did not work.

I've given the null segment the same fixed size as the plane, but it's a no go.

Any ideas? Easier to understand in photos (attached). In the photos attached, I've set Random to 1 out of 200. Open the file and flip through the Random seed values and see how the behavior is very odd.

Also, want to add I'm using Railclone 5.2.3 and the newest 2023 Max.

Thanks,

Tony


Dragan

  • Hero Member
  • *****
  • Posts: 1419
Re: Problem with Random parameter and null segments?
« Reply #1 on: June 14, 2022, 06:08:17 AM »
Hi,
Please can you downgrade the file to a lower version so we can take a look?




Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2991
Re: Problem with Random parameter and null segments?
« Reply #2 on: June 14, 2022, 09:53:16 AM »
Hello Tony,

It looks like that is happening when the nested generator doesn't produce any geometry due to the low probability values. To get around it, you can wire the A2S Generator to the L1S Generator's Start and Evenly inputs instead (with an Evenly distance of 8'). Please take a look at the attached sample.

I hope that helps,
Paul
Paul Roberts
iToo Software

tonyinseattle

  • Newbie
  • *
  • Posts: 25
Re: Problem with Random parameter and null segments?
« Reply #3 on: June 28, 2022, 12:13:07 AM »
Thank you for this, and sorry for my delay in responding.

So, is the problem that caused this a bug? It seems like it must be. Unless I'm understanding the use of the Default segment.

Thanks!

Tony

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2991
Re: Problem with Random parameter and null segments?
« Reply #4 on: June 28, 2022, 09:35:38 AM »
Hi Tony,

In this case, it's the expected behaviour. Nested Generators are re-randomised each time they are used, and in many cases this is the desired behaviour (imagine for example a generator that creates a building wired to another that defines the path of a street, you'd probably want that to randomise each time). In this style, it's wired to two different generators, so each time it is used a different randomised version is created. If you need more control over when a random value is created then using the Selector operator with the Random Number node wire to its index input is the recommended way.

Cheers!
Paul
Paul Roberts
iToo Software