Jump to content
JDee

Random value every iteration in ForEachLoop

Recommended Posts

JDee    7

Hi
Is there a way to get a random value in ForEachLoop (say between 1 and 0) using iteration number in the loop as a seed for it ?

Edited by JDee

Share this post


Link to post
Share on other sites
ikoon    103

On the Block Begin node, click "Create Meta Import Node", lets name it "meta". Then refer to it like this:

- in the wrangle:
 

int seed = detail(1,"iteration");

- If you don't want VEX, but you want expression, then use it like this:
 

detail(1,"iteration",0)

- or expression anywhere, relative path:

detail("../meta","iteration",0)

I have attached the file.

 

 

forseed.hiplc

forseed.PNG

Edited by ikoon
  • Like 1

Share this post


Link to post
Share on other sites
JDee    7

It's much appreciated ikoon!
I'm trying to feed that value to distance value in attribute transfer (thresholddist parameter) with no luck, how to properly hook it up in that approach ?
So every iteration the distance is randomly different in that range.
Thanks.

Edited by JDee

Share this post


Link to post
Share on other sites
ikoon    103

I see... for loop doesn't seem to fetch/accumulate each attribute iteration separately. Could you use Point Cloud then? Instead of the Attribute Transfer. If you send the scene file, maybe somebody could look at it. (I will be busy next days)

Edit: Btw the "SOP Solver" approach may be helpful now.

Edited by ikoon

Share this post


Link to post
Share on other sites
JDee    7

Thanks for this! Yes this is what I'm struggling with now.
I have more complex scene, but I made a simple scheme in this hip file, just in case if there is any tricky thing to work it out.
All I want to get is random distance on every iteration for the attribtransfer.

FLoop_attribtransfer.hip

FL.jpg

Share this post


Link to post
Share on other sites
ikoon    103

I thought, that we have multiple "from" nodes, each having different thresholddist and that we are transfering to all the "to" points :). From circle points to grid. That wasn't working for me in the For Loop:

grid.PNG

Share this post


Link to post
Share on other sites
JDee    7

It's really serious hip file goddamn! Thanks Noobini for that.
Had to post the sample scene right away.Sorry.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×