Increment a custom attribute through time?

   8907   10   2
User Avatar
Member
20 posts
Joined: July 2007
Offline
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.
User Avatar
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.
User Avatar
Member
20 posts
Joined: July 2007
Offline
Hi, thanks for the reply.

I see…but how about in SOP? Basically what I am trying to do is to move some points of a geometry a random amount of distance per frame. Does it mean I need to do some kind of referencing to a pop network in order to achieve this?

Thanks.
User Avatar
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

Attachments:
random_walk.hip.gz (10.1 KB)

User Avatar
Member
832 posts
Joined: July 2005
Offline
you can do some feedback in the DOPs sop solver. or ask for the old feeback SOp back… ;-)
User Avatar
Staff
1454 posts
Joined: July 2005
Offline
oh yeah, forgot to mention… please note, that there may be other and better ways of doing it other than what I posted (like, the way paul mentioned). I am just a developer not an artist; i have no clue what Houdini does, but I have a pretty good idea how it does it
User Avatar
Member
20 posts
Joined: July 2007
Offline
Its OK.

But I still don't get it, the hip you upload is actually emitting particle from the point, but the point of the geometry itself is not moving (deforming). I try read back the position of the particles but no luck…

cheers
User Avatar
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’ )

Attachments:
random_walk_2.hip.gz (9.8 KB)

User Avatar
Member
20 posts
Joined: July 2007
Offline
Thanks rafal, I get it now. Thanks a lot for taking the time to help me.

Cheers
User Avatar
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.
User Avatar
Member
20 posts
Joined: July 2007
Offline
Hi, Andrew, thanks for the suggestion, I am trying that out too, seems working quite nicely. I need to learn more about chop though.

Thanks again for everyone's help!
  • Quick Links