Search - User list
Full Version: noob: rand($PT*50)
Root » Houdini Learning Materials » noob: rand($PT*50)
marvalgames
I'm trying to understand the rand.
What exactly is the $PT (and where to find a list of the different variables)
I created a random color node. Values like rand($PT) * 50 didn't work but rand($PT * 50) did?
Thanks and I'm sorry if a tutorial explains this. Haven't seen it?
Doudini
rand() will give you a number between 0-1 so if you do (@ptnum *50) that will still be mapped to 0-1 adn the multiplier becomes like a seed. If you do (@ptnum) *50 that will multiply a random number between 0-1 by 50 therfor you will get values over 1 resulting in showing up white in the viewport.

you can use fit01 to range the random value you get between higher values.

fe: fit01(rand(@ptnum+12), 0, 10) which gives an output between 0-10

hope it helps.

edited to match @ptnum
Sean Rowe
$PT is the global variable for point number. Expressions seem to be switching over to vex terminology which for point number is @ptnum.

I can't seem to find a comprehensive list of the variables, i'll update if I find them
Cyzor
Sean Rowe
I can't seem to find a comprehensive list of the variables, i'll update if I find them
I thought something similar had been on Erwin Santacruz's Houdini Tricks [houdinitricks.com] site once, but only see an introduction to the concept:

http://houdinitricks.com/quicktip-new-attribute-syntax-in-houdini-15/ [houdinitricks.com]

$BBX	relbbox(@P).x
$BBY relbbox(@P).y
$BBZ relbbox(@p).z
$T @Time
$FF @Frame
$ST @SimTime
$SF @SimFrame
1/$FPS @TimeInc

From the internal help:

Geometry attributes

In HScript expressions on geometry you can reference the value of an attribute using `@attributename`. For example, you can use `@pscale` to get the value of the `pscale` (point scale) attribute on the current point.

For vector attributes such as `P` (position), you can use dot notation to grab a component, for example `@P.x`. You can use `.x/.y/.z` or `.1/.2/.3` or `.r/.g/.b`, whichever makes sense for the type of data.

Local variables

Nodes often provide variables that are useful for expressions on nodes of that type. For example, a node that operates over the points in a geometry will have a `@ptnum` variable representing the point number of the current point. The help for a node will list the local variables you can use in expressions on that type of node.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB