pscale

   36555   6   3
User Avatar
Member
6 posts
Joined: 4月 2012
Offline
Hi,

I'm trying to copy a teapot to each point on a grid with different random sizes.

The tutorial I am following uses a vopsop to fit a random number between .1 and 1 and applies that to a created pscale attribute.

In Houdini 14 vopsops are a thing of the past. I have tried to use attibute vop as well as point vop. The pscale attribute gets added but all the values are the same.

Anyone know a workaround/solution?

Attachments:
pscale_fail.hipnc (91.7 KB)

User Avatar
Member
1268 posts
Joined: 3月 2014
Offline
Why don't you use an ‘Attribute Randomize’ SOP instead of the attribVOP. It can be done with the VOPSOP, but Atrribute randomize makes this very easy.

Change the attribute name to pscale and play with the min max settings.

To get your method to work, you need to use the bind export vop, instead of the Add attribute in side the ArrtibVOP. Just set the attribute name to pscale in the bind export.
Werner Ziemerink
Head of 3D
www.luma.co.za
User Avatar
Member
258 posts
Joined:
Offline
How about just an attribute wrangle with some simple vex..

@pscale = fit(rand($PT * 635), 0, 1, 0.1, 0.25);

I think in this kind of case, a wrangle node will be faster than a vop or a point sop.
User Avatar
Member
41 posts
Joined: 6月 2010
Offline
You needed to create the attribute “pscale” first. You could have created a “point”, use “attribcreate” or “addattribute” inside attribvop. All would work the same.

In this case, I used an addattribute and parameter inside attribvop.

Attachments:
pscale_works.hipnc (95.7 KB)

~t.goat
User Avatar
Member
6 posts
Joined: 4月 2012
Offline
cool, thanks I will have a look at your method.
User Avatar
Member
49 posts
Joined: 9月 2013
Offline
Hey stinkylando,

I just looked at your file, you have almost the right idea.

Just instead of addattribute inside your attrvop node , use bind_export and name the attribute pscale and then you should be fine.

You can also add a power node after your fit range node to get more fine control over your sizing.

The other method is really simple too,

Just drop down a point wrangle node below your grid object

type in the following snippet:

@pscale = fit01(pow(rand(@ptnum),1,0.1,0.8);

like all other nodes you can add parameters to this too:

so you can go to edit parameter interface and add 3 parameters namely, “power”, “pscale_min”, “pscale_max”

then the above expression will become:

@pscale = fit01(pow(rand(@ptnum), ch(“power”), ch(“pscale_min”), ch(“pscale_max”)));

Now you have control over all parameters and you adjust your pscale the way you want to!

Cheers!

-Yash
User Avatar
Member
6 posts
Joined: 4月 2011
Offline
@MrReedSmith,
welcome back to life super old thread!

I am trying this now and am able to get rotation and uniform scale to randomize in an attribute wrangle.
Using this:

@pscale = rand(@ptnum);
@orient = rand(@ptnum);

Here @ptnum variable is storing the point numbers being used as a seed through which the key term “rand” is generating random/sudo random values.

However I am missing something when it comes to using your example above. I get a syntax error..

–Just figured it out!
I just tried this and it works:

@pscale = fit01(pow(rand(@ptnum), 2), 0.1, 0.8);

The difference seems to be that I am defining a value of (2 in this case) for the power to be with in the bounds of the parentheses that include the pow function. I found this to also be and issue with the above example where channels sliders are used instead of fixed values also for some reason the quotes where not being recognized as valid quote characters in houdini (pasting font problem or something) :

This does not work:
@pscale = fit01(pow(rand(@ptnum), ch(“power”), ch(“pscale_min”), ch(“pscale_max”)));

This does:
@pscale = fit01(pow(rand(@ptnum), ch(“power”)), ch(“pscale_min”), ch(“pscale_max”));

Hopes this helps other folks who are confused by this!
Thanks!
-James

Attachments:
copyTest_v001.hiplc (81.3 KB)

  • Quick Links