Showing posts with label chops. Show all posts
Showing posts with label chops. Show all posts

Tuesday, 22 February 2022

Getting Point Attributes in CHOPS

Scenario - Had some points that were moving in unison, I wanted to stretch/squash each point's animation individually so they'd move at different rates. 
I made a point attribute for each called "shift" and gave them a random value between a min and max.

Then I made a CHOPNET and imported the geometry with the tx,ty,tz and shift channels.
Next we need a foreach chop node, be sure to specify all the channels in the parameter box.


Now dive into the foreach node and make a Stretch node.

I just wanted to use the shift attribute in the main Length Scale parameter, so I use the "chopi" function which seemed the simplest out of all the chop_ functions available. It evaluates the channel specified in quotes at the index you give it. This index is meant to be along the timeline, I believe - but since our value is a constant you can throw in any number.

chopi("../Foreach_Iteration/shift",10)

The Stretch node goes to the built in output node...make sure that one is being exported.

This should work now...each point's transform animation stretched according to the shift attribute.

Another thing I found whilst trying to figure this out was the Reorder node. It lets you sort the channels according to different rules. So if you use the number suffix, then it will "group" all the same point channels together. shift0, tx0,ty0,tz0, shift1,tx1,ty1,tz1....etc.... Could be useful if you have some sort of nth based logic going in a script or something, although I really think this for each method works much better.

I'm sure there are better ways to get point attributes in CHOPS.....I just can't figure them out haha. Let me know in the comments, if I've remembered to enable them.

Friday, 26 February 2021

CHOPS basics!

CHOPS.

Say you have a moving box. Make a null name it OUT_BOX (or something), for easy access.

Now create a chop network.

In here, make a Geometry node. Set the attribute you want to process. Maybe it's the P (for position).. or N (for normal). Set the Method to Animated if it's animated...

Add whatever effects you want. Eg. Lag, Spring.

And finally add an Output  node and set the relevant export flags.

Like this -

Now back at SOP level, add a Channel sop to follow on from your OUT_BOX (or whatever)

 and set the Attribute Scope to whatever you're processing. I was tweaking N, so that's what I've used!



You could add a Channel node elsewhere and apply the same values to a P, or Cd if you wanted!
That concludes CHOPS basics!

Bonus
in a parameter... you can use this expression to access the 0th value from chopnet1, every $F frames-
chopcf("../chopnet1/output0/",0,$F)