As per subject - if I drop a few instances of my HDA into a scene, what's the simplest way of generating a different seed value to use within it?
I could just put a “parm_seed” parameter on the HDA's interface, but knowing me I'll forget to change it on each instance.
I suppose I could hash the node name somehow to generate a seed, given that Houdini will automatically give each instance a new name (by appending 1, 2, 3 etc on the end), but if anyone has a cheeky expression I can use it'd save me reinventing the wheel…
Quickest / simplest way to give each instance of my HDA a different seed value?
3380 7 1- howiem
- Member
- 146 posts
- Joined: 9月 2011
- Offline
- Andr
- Member
- 899 posts
- Joined: 2月 2016
- Offline
interesting question.
As you suggested, I also thought of some string manipulation.
Then I rmb about the intrinsic attributes and I thought there was some intrinsic attribute storing the ID of the node. There is actually a “geometryid” intrinsic but I always get “0” as result when I try to read it.
Also, what does “primitivetokens” mean?
As you suggested, I also thought of some string manipulation.
Then I rmb about the intrinsic attributes and I thought there was some intrinsic attribute storing the ID of the node. There is actually a “geometryid” intrinsic but I always get “0” as result when I try to read it.
Also, what does “primitivetokens” mean?
- tamte
- Member
- 8837 posts
- Joined: 7月 2007
- Offline
- tamte
- Member
- 8837 posts
- Joined: 7月 2007
- Offline
Andrprimitivetokens is just list of all possible primitive intrinsics
Also, what does “primitivetokens” mean?
however which ones are applicable depends on the primitive type
the geometryid you are referring to is geometry id for packed primitives
overall you don't want to use any of the intrinsics for this purpose as they rely to the geometry and not to the node itself (and of course reading the geometry to be able to generate that geometry with different seed would be an infinite cycle)
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- Andr
- Member
- 899 posts
- Joined: 2月 2016
- Offline
- SDENPIKE
- Member
- 5 posts
- Joined: 7月 2009
- Offline
- Leaf
- Member
- 12 posts
- Joined: 5月 2017
- Offline
This is how the built-in Attribute Randomize node does it.
The following python script is in the Scripts tab > OnCreated Script of the Type Properties for the hda.
Explicitly setting the seed parameter on node create is the safest approach. Basing the seed on the node name can quickly cause problems when you go to clean up your scene and re-name everything (Toootally never accidentally done that before )
The following python script is in the Scripts tab > OnCreated Script of the Type Properties for the hda.
node = kwargs['node'] seed = 6173*node.sessionId()+4139; node.parm('seed').set(seed % 10000)
Explicitly setting the seed parameter on node create is the safest approach. Basing the seed on the node name can quickly cause problems when you go to clean up your scene and re-name everything (Toootally never accidentally done that before )
- howiem
- Member
- 146 posts
- Joined: 9月 2011
- Offline
-
- Quick Links