Wednesday 31 March 2021

alternative to attribute interpolation, point specific?

This is quite a simple tip, but I always forget about it..

I had a a bunch of points that, over time, would get stretched out along the z axis. The stretching was dictated by a few random attributes, so it wasn't obvious which would end up the furthest away from the starting point.
Later it turned out I needed to adjust the pscale of each point, based on it's position. ie; the tip would be largest, the tail would be smallest.

So, timeshift and hold your points to the last frame. In a point vop, use a "relative to bounding box" node and get the delta vector. Output it to however it works for you - in my case I used a vector-to-float node to isolate the Z value and I called it pscale_z. Very original eh?

For whatever reason, I wasn't able to get attribute interpolation to work - I thought I could just plug in the moving points and the static end frame into the node, but the arrays and values just weren't working for me.. Leave a comment if you know how to get it working! (it does work for scatters and primitives, as the sourceprim and uv get created for you...)

Anyway, my work around was to use a point wrangle. Plug the moving points into the first input (0), and the static points with the pscale_z attributes into the second input (1).

f@pscale_z=point(1,"pscale_z",@ptnum);

 that's it! The moving points will now take the pscale_z attribute from input "1" . As long as you don't mess around with point numbers, this will keep working. (or if you do need to do that, I guess, give it an @id value somehow)

No comments:

Post a Comment