Houdini Quick tip #10 (Attribute copy by id)


I got a task where I had to pick certain parts of a flip and assign a different color (or any other attribute), the normal way to do so is to:

- Freeze the desired frame.

- Select the your points and assign an attribute.

- Attribute copy.


Normally this will work but some times your flip sim point count change due to some deletion or if you have an emitter, and since Attribute copy depends on ptnum by default your copied attribute will start jumping randomly between particles.

To solve this you need to check "Match by attribute" option and type in "id", and here you should note that your flip sim is exporting "id" it's not on by default.


Or there are two wrangle hacks to do so, using two codes "findattribval()" or "idtopoint()" which will return the point number from the second input (the frozen one) that will be used by "point()" command to get that attribute, and it works as follow:

int pt = findattribval(1, "point", "id", @id);

if (pt!=-1) @Cd = point(1, "Cd", pt);

or:

int pt = idtopoint(1,@id);

if (pt!=-1) @Cd = point(1, "Cd", pt);


The used functions return -1 if they didnt find a match so I tested against that first, sometimes it works without it though.


Note: the title focused on the id part but it can be called Attribute copy by attribute.

Find Me on

Contact:

Riyadh, Saudi Arabia

Tel: +966 533 238 935

Alaa@vfxarabia.co

Skype: 

Copyright © 2014 - 2020 VFXArabia.