can't randomize scale factor within foreach node

   4013   9   2
User Avatar
Member
479 posts
Joined: Dec. 2009
Offline
I want to randomize the scale factors for faces within a foreach node, somehow all the surfaces are scaling in the same way, even if I use an attribute unique to each face for the rand() function.

your advice are greatly appreciated!f

Attachments:
room_surface_exploded_v002.hipnc (66.0 KB)
01.PNG (237.4 KB)
02.PNG (83.5 KB)

User Avatar
Member
606 posts
Joined: May 2007
Offline
Works, if you use something like rand(prim(“../each1”, 0, “a”, 0)*7.771)

I don't think Transform SOP usually works with per-primitive attributes like that, it applies the same transformation to the whole input. That's why you're using a ForEach SOP in the first place, right..

In fact, you could do this with a Primitive SOP - without a ForEach.
User Avatar
Member
443 posts
Joined: Sept. 2012
Offline
Is this you are looking for??????????

Attachments:
room_surface_exploded_v002_830.hipnc (73.8 KB)

User Avatar
Member
443 posts
Joined: Sept. 2012
Offline
I didn't refresh page to see eetu's post.
Definitely this can be done using primitive sop or attribwrangle sop.
User Avatar
Member
606 posts
Joined: May 2007
Offline
PradeepBarua
Is this you are looking for??????????

Your hip still exhibits the same problem - each part is scaled with the same amount, rand(0) in this case.
User Avatar
Member
443 posts
Joined: Sept. 2012
Offline
eetu
Your hip still exhibits the same problem - each part is scaled with the same amount, rand(0) in this case.

If you want to randomize then multiply rand($PN) by forvalue

rand($PN*125.5614)*rand(stamp(“..”, “FORVALUE”, 0))

put this in uniform scale.
User Avatar
Member
443 posts
Joined: Sept. 2012
Offline
for more randomization you can also use perimeter of primitive:

rand($PN*125.5614)*rand(stamp(“..”, “FORVALUE”, 0)*468.56165)*rand(prim(“../measure1”, $PR, “perimeter”, 0)*53.26)

Attachments:
room_surface_exploded_v002_830_153.hipnc (75.1 KB)

User Avatar
Member
606 posts
Joined: May 2007
Offline
PradeepBarua
If you want to randomize then multiply rand($PN) by forvalue

rand($PN*125.5614)*rand(stamp(“..”, “FORVALUE”, 0))

put this in uniform scale.

Sorry to nitpick, but in that case you should remove the rand($PN*125.5614) part, as that is constant, and it will actually limit the return value of the whole expression to between 0 and rand(0) ..
User Avatar
Member
443 posts
Joined: Sept. 2012
Offline
eetu
Sorry to nitpick, but in that case you should remove the rand($PN*125.5614) part, as that is constant, and it will actually limit the return value of the whole expression to between 0 and rand(0) ..

Oops!!! nice catch, Master.
User Avatar
Member
479 posts
Joined: Dec. 2009
Offline
Thank you all very much for all the good advice!

Here's the summary of all the approaches so far …

Attachments:
room_surface_exploded_v003.hipnc (85.7 KB)
Capture.PNG (158.5 KB)
01.PNG (54.1 KB)
02.PNG (44.9 KB)
03.PNG (47.1 KB)
04.PNG (48.5 KB)

  • Quick Links