Copy and Transform with Random Numbers

   6344   6   2
User Avatar
Member
11 posts
Joined: May 2018
Offline
I'm trying to make an intractable pile of money that stacks up or down. I'm using a tubesop and a copysop. this piles the money, but its too uniform in its stacking so I want to add some random jitter in the X and Z axis. I thought I could just type "fit01(rand($PT),0,1) to give some randomness, but apperently $PT isn't an option. Can someone explain to me why it isn't an option?

I already achieved the effect using a linesop, copytopointssop and a boolean operation on the line, but it's very inelegant.

Attachments:
Question.png (534.9 KB)

User Avatar
Member
1007 posts
Joined: April 2017
Offline
When doing this type of work, I tend to:
1. copy simple points
2. randomize point positions
3. use copy to point to place a tube on each point.

Attachments:
coin_stacking.hip (91.0 KB)
coin_stacking.JPG (60.4 KB)

User Avatar
Member
1007 posts
Joined: April 2017
Offline
I ended up having lots of fun with it. Here's an example on how to make a coin pile.

If you select the “Master_controls” node at the top (yellow), you can tweak a bunch of settings.

-Olivier

Attachments:
Coin_pile_stacking.JPG (184.9 KB)
coin_stacking_03.hip (135.6 KB)

User Avatar
Member
11 posts
Joined: May 2018
Offline
This works really well, thanks so much. Still unsure why you can't put that expression in the transformsop, but I guess that's just how it is! Cheers ~
User Avatar
Member
1007 posts
Joined: April 2017
Offline
I think the example you are giving with the copy sop doesn't work because it doesn't work with points. By saying $PT (point number) it doesn't know where to find that info. Also, even if you would not get an error, your “fit01(rand($PT),0,1)” would probably get one value that's applied to all copies rather than finding one random value per copy.

If you want to have random translate per copy (could be different scale as well), you might want to use the copy stamp node. You can paste your “fit01(rand($PT),0,1)” in it. Here's a tutorial:

https://www.youtube.com/watch?v=gQuB87tm8GY
[www.youtube.com]

I said I prefer to copy points because it opens up a lot more possibilities and allows for very efficient/fast calculations when working with Wrangles but it's more advanced. For example, with points, if I want to end up with different sized coins, I can randomize the attribute called “pscale” on each point. Houdini already knows that “pscale” is for “proportional scale” and will scale the coins from that info.

If you are starting in houdini, learn the copy stamp method. You can do a ton of things with that!
Edited by olivierth - Dec. 11, 2018 21:30:06
User Avatar
Member
1 posts
Joined: Oct. 2018
Offline
And for the rotation of the pieces? How can we do it?
I'm a novice, but I understand that the points don't have attributes "rotation" even if I create it and randomize it how to transfer it to the parts?
User Avatar
Member
409 posts
Joined: March 2014
Online
From the top of my head; use "scatter and align" instead of "scatter". That way you’ll be able to randomize the rotation.
  • Quick Links