Random values for material inputs

   3842   3   1
User Avatar
Member
25 posts
Joined: May 2015
Offline
I am trying my hand at random values.

My expression here fit(rand($PT), 0, 1, 0.7, 1) is meant to input a random number into saturation between 0.7 and 1.0.

But as the render shows, it seems to just input 0 into saturation.

What am I doing wrong here?

Attachments:
Houdini_img_shader2.jpeg (197.1 KB)

User Avatar
Member
7805 posts
Joined: Sept. 2011
Offline
$PT doesn't mean anything in shading context, and furthermore, points don't have any sort of enumeration that is available to materials. However, you can store that saturation, or any sort of arbitrary value as an attribute on your geometry, and use a parameter node to access the attribute by name in your material.
User Avatar
Member
25 posts
Joined: May 2015
Offline
Thanks for the explanation jsmack. All I want is a random number inside a set range to drive my shader. The geo is part of a HDA, so I just want random variation on certain shader parameters every time another instance of the HDA is created. How do I do that then?
User Avatar
Member
24 posts
Joined: Oct. 2015
Offline
make an id integer attrib on the pts. though because they're trees you'll likely want to group them by tree, so id by tree, connectivity will only work if each tree is unique. if you're copying the tree to points you can id the points then have the copies inherit the attrib

i@id = @ptnum;

make a material builder

bind in id -> rand -> fit -> saturation -> shader

Tighe Rzankowski

trzankofx@gmail.com
  • Quick Links