Showing posts with label attribute. Show all posts
Showing posts with label attribute. Show all posts

Friday, 10 April 2026

how to match geo based on path attribute and delete non matching (or keep) primitives

This is quite a specific script.. I got chatgpt to make them for me!

TWO SCRIPTS - they compare input 0 and 1's path attritbutes. Firstly, they strip away (deleting) the primitives that don't match. 
Use case-  you have two mostly identical alembic files of a house. One has UVs you want to transfer to another, but maybe one has some excess geo that you haven't processed yet, or forgot to delete. This will get the two alembics having the same geo (based on path attributes!), so you could do a clean transfer.

 // Get this primitive's path

string my_path = prim(0, "path", @primnum);


// Flag to track match

int match_found = 0;


// Loop over all primitives in input 1

int nprims1 = nprimitives(1);

for (int i = 0; i < nprims1; i++)

{

    string other_path = prim(1, "path", i);

    

    if (my_path == other_path)

    {

        match_found = 1;

        break;

    }

}


// Remove primitive if no match

if (!match_found)

{

    removeprim(0, @primnum, 1); // 1 = delete associated points if unused

}



AND THE REVERSE - KEEPING ONLY THE NON MATCHING STUFF, so you can merge that back into the matching stuff after transferring UVs or whatever.



// Get this primitive's path

string my_path = prim(0, "path", @primnum);


// Flag to track match

int match_found = 0;


// Loop over all primitives in input 1

int nprims1 = nprimitives(1);

for (int i = 0; i < nprims1; i++)

{

    string other_path = prim(1, "path", i);

    

    if (my_path == other_path)

    {

        match_found = 1;

        break;

    }

}


// Remove primitive if a match IS found (reverse logic)

if (match_found)

{

    removeprim(0, @primnum, 1);

}

Monday, 9 June 2025

"details" to get string attribute into uvquickshade

say i have a primitive attrib with a texture path in it... But i want a uvquickshade to use this string value..
the easiest way I've found to get to it, is promoting it first to a detail attribute, then in the uvquickshade param box put this in -

 `details("../attribpromote1/", "texturePath")`

where attribpromote1 is the node before the uvquickshade... and texturePath is the string attribute name.

Tuesday, 24 September 2024

solver transfer attribute, eg. colour accumulation

i always have to look this up on cgwiki...

the left stream is some sweat drops falling down a surface.. the right stream is the surface. 

It goes into a solver









The slight 0.0075 blend in the blendshape causes a slight fade of the attribute being transferred. Leaving it at zero will result in an absolute solver-accumulation of the value.

Tuesday, 31 January 2023

exporting custom attributes in Alembic to Blender

We use the setattribtypeinfo function to force an attribute to be a color type. Just like Cd usually is.

This will probably streamlined and not necessary in future versions of Blender, but it seems like it is still necessary atm (Jan 2023)

using a point wrangle, set to detail (so it only runs once)

 setattribtypeinfo(0,"point","attributename","color");


here I'm forcing an attribute called attributename to be recognised as a color type & not just 3 floats.
I'm using the rop_alembic output to write the abc file.

Tuesday, 2 April 2019

separating objects for booleans/other things

Case example - you have a 


To separate out an object, maybe for booleaning, or to avoid intersections when doing some other sort of calculation, make a point class attribute (connectivity)
then in a point wrangle do something like this-

@P.x+=@class;
@P.y+=@class;

This should separate the pieces enough. If not, use a multiplier.
Then promote the class to a primitive attribute - for some reason Boolean Fracture doesn't carry across the class attr to any newly generated points when it is left as a point attr.


Do your booleans...you might want to scatter some points on the surfaces or copy some turbulent grids onto the object points.

Bring the class attribute back to point level and then do the reverse transformation

@P.x-=@class;
@P.y-=@class

 link any multipliers you might have to save time changing values in multiple boxes!