JDee Posted September 4, 2017 Share Posted September 4, 2017 (edited) 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 September 4, 2017 by JDee Quote Link to comment Share on other sites More sharing options...
ikoon Posted September 4, 2017 Share Posted September 4, 2017 (edited) 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 Edited September 4, 2017 by ikoon 2 Quote Link to comment Share on other sites More sharing options...
JDee Posted September 4, 2017 Author Share Posted September 4, 2017 (edited) 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 September 4, 2017 by JDee Quote Link to comment Share on other sites More sharing options...
ikoon Posted September 4, 2017 Share Posted September 4, 2017 (edited) 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 September 4, 2017 by ikoon Quote Link to comment Share on other sites More sharing options...
JDee Posted September 5, 2017 Author Share Posted September 5, 2017 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 Quote Link to comment Share on other sites More sharing options...
Noobini Posted September 5, 2017 Share Posted September 5, 2017 (edited) like this ? (added Seed and Multiplier in CTRLS) FLoop_attribtransfer_Rand.hipnc Edited September 5, 2017 by Noobini 3 Quote Link to comment Share on other sites More sharing options...
ikoon Posted September 5, 2017 Share Posted September 5, 2017 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: Quote Link to comment Share on other sites More sharing options...
JDee Posted September 5, 2017 Author Share Posted September 5, 2017 It's really serious hip file goddamn! Thanks Noobini for that. Had to post the sample scene right away.Sorry. Quote Link to comment Share on other sites More sharing options...
Krion Posted March 19, 2019 Share Posted March 19, 2019 Hey i wonder why it isn't working with my transform. Help would really be appreciated. WhyNoRandomTransform.hipnc Quote Link to comment Share on other sites More sharing options...
Noobini Posted March 19, 2019 Share Posted March 19, 2019 01) you're missing a bracket in the transform, you have to get rid of the red warning signs !! 02) once you sorted out the brackets...it IS working but because the random rotation is between 0 and 1 (degrees) it is tiny for you to actually see. 03) to magnify the effect for you to see mult by 360, ie. 360*rand(detail(-1,"iteration",0)), so it means random rotation between 0 and 360 degrees. 04) you have to run the loop on each connected piece, ie. a box is treated as one...not 6 separate prims. vu_RandomTransform.hipnc 1 Quote Link to comment Share on other sites More sharing options...
Krion Posted March 20, 2019 Share Posted March 20, 2019 Nice. I was now playing around with combining this with $F and came as far as this: fit(rand(detail(-1,"iteration",0)+$F), 0, 1 , 0, 360) How could i make this go slower? when i divide it at the end, it's not from 0 to 360 anymore. I also want them to start at a totally random position. Quote Link to comment Share on other sites More sharing options...
Sadegh1366 Posted January 24, 2021 Share Posted January 24, 2021 Hello could someone please explain to me what is (-1) meaning in this: detail(-1,"iteration",0)? And what is the "spare input 0"? Thanks. Quote Link to comment Share on other sites More sharing options...
ftaswin Posted January 31, 2021 Share Posted January 31, 2021 in the parameter editor, if you click the cog icon - add spare input, it will add a string parameter where you can plug a node path you can reference to. So instead of detail(1,"iteration",0),detail(2,"iteration",0),detail(3,"iteration",0) referring to the node connected on input 2,3 and 4, You can use detail(-1,"iteration",0),detail(-2,"iteration",0) referring to the spare parm you just added (-1 is the first spare parm, -2 is the second and so on) 2 Quote Link to comment Share on other sites More sharing options...
lyansart Posted February 5, 2021 Share Posted February 5, 2021 On 3/20/2019 at 9:57 PM, Krion said: Nice. I was now playing around with combining this with $F and came as far as this: fit(rand(detail(-1,"iteration",0)+$F), 0, 1 , 0, 360) How could i make this go slower? when i divide it at the end, it's not from 0 to 360 anymore. I also want them to start at a totally random position. HI, to make it slower you need to divide only the $F, not the entire result, otherwise it won t keep anymore your fitted values. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.