Hi, all,
I have a simple question, how could I create an attribute that can increment a random number. through time? Simple expression like $X+rand($FF) seem doesn't work because $X keep referring to the default value. I try many way but still can't make it work…
Thanks in advanced.
Increment a custom attribute through time?
8907 10 2- renochew
- Member
- 20 posts
- Joined: July 2007
- Offline
- Ondrej
- Staff
- 1081 posts
- Joined: July 2005
- Offline
POPs are a common way to perform feedback based solutions like this because they function iteratively on a single geometry over time. In other words, when deciding on the new value of an attribute, you have still have the old one available to you. For example, putting $TX + 5 into the first component of the position POP's position field would increment the x position by 5 units on every cook.
- renochew
- Member
- 20 posts
- Joined: July 2007
- Offline
- rafal
- Staff
- 1454 posts
- Joined: July 2005
- Offline
The simplest way is to have a reference to a POP network. Basically you would feed the points you want to walk randomly into the POP network and use them as source location at frame 1.Then at the SOP level you can use the popnet output as regular geometry points for further manipulation.
You can take a look at the attached hip file
You can take a look at the attached hip file
- paul
- Member
- 832 posts
- Joined: July 2005
- Offline
- rafal
- Staff
- 1454 posts
- Joined: July 2005
- Offline
- renochew
- Member
- 20 posts
- Joined: July 2007
- Offline
- rafal
- Staff
- 1454 posts
- Joined: July 2005
- Offline
you need to turn the points from the POP net back into the geometry. I modified the example to show how to use AttribTransfer to achieve that (ie, transfer point positions). The geometry/topology stays the same but the points move around.
Edit: you may want to use some other, more reliable, method to assign the point positions. I used attrib transfer because it was the first thing that popped into my mind. It assigns the new point position to the closest POPnet point, but there should be a way to assign it based on point number (and you may be able to match up the point numbers between the birthing geometry and POPnet by setting the Emission Type of the Source POP to ‘ordered’ rather than ‘random’ )
Edit: you may want to use some other, more reliable, method to assign the point positions. I used attrib transfer because it was the first thing that popped into my mind. It assigns the new point position to the closest POPnet point, but there should be a way to assign it based on point number (and you may be able to match up the point numbers between the birthing geometry and POPnet by setting the Emission Type of the Source POP to ‘ordered’ rather than ‘random’ )
- renochew
- Member
- 20 posts
- Joined: July 2007
- Offline
- andrewlowell
- Member
- 537 posts
- Joined: Dec. 2005
- Offline
in terms of feedback etc, you can just use the “channel” sop and reference an attribute in a CHOPs network if you wanted to avoid simulation and be able to scrub backwards etc.
Just import the attribute as animated geometry and use the expression CHOP.
If you wanted to simply add a random value on each frame (or index) you could do something like this …
oc($C,$I-1) + rand($C+$I)
don't have houdini in front of me but I think that will work. Then read it back into the channel SOP as animated geometry.
Just import the attribute as animated geometry and use the expression CHOP.
If you wanted to simply add a random value on each frame (or index) you could do something like this …
oc($C,$I-1) + rand($C+$I)
don't have houdini in front of me but I think that will work. Then read it back into the channel SOP as animated geometry.
- renochew
- Member
- 20 posts
- Joined: July 2007
- Offline
-
- Quick Links