Sunday 8 January 2017

Getting point values from primitives

Here's a way to get point values from specific vertices. The application here is quite specific actually..
When you make glue constraints for Bullet simming you get a bunch of 2 vertex lines and one method I've been ripping off is to use voronoi noise patterns to cluster the vertices. The aim of this is to check what voronoi cluster value i've assigned to the vertex.

primvertex(0,@primnum, 0);
returns the vertex number, of @primnum's primitive.

vertexpoint(0, vertexnumber);
returns the point number of the vertex you feed it.. Cos points and vertices aren't the same :)

so.. to get a point number from a primitive (say the first point in a line), we combine it all a bit..

int pt= vertexpoint(0,primvertex(0,@primnum,0));

Then you might access some values

float value=point(0, @something, pt);

Thursday 5 January 2017

add point to centre of primitive and have UVs (sort of)

Just to add points and then remove the primitive.

addpoint(0, @P);
removeprim(0, @primnum, 1);



This goes into a primitve wrangle!


To also have UVs:

vector uv = primuv(0,"uv",@primnum,set(0.5,0.5,0));


int pt = addpoint(0,@P);
removeprim(0, @primnum, 1);


setpointattrib(0,"uv2",pt,uv,"set");


Above this wrangle node, we'd initialise the uv2 value. After it, we'd rename the attribute to "uv". For some reason Houdini doesn't like it when you have UVs in both point and vertex.