Showing posts with label vertex. Show all posts
Showing posts with label vertex. Show all posts

Monday 22 May 2017

voronoi fracture woes & exporting alembics to maya

Voronoi fracturing is often used to create destruction fx. It also creates a lot of dirty geometry, which leads to pain when exporting your geometry to Maya -

"UVs aren't per-vertex or per-polygon per-vertex, skipping"

 This also plays havok with motion blur and any other vertex attributes you might have in play.

Using a For-Each loop, or For-Each subnetwork (if using the subnetwork, attach a Connectivity SOP first, with a "class" attribute, so the For-Each knows what pieces to run over. You type "class" into the Attriubute field of the ForEach Subnetwork parameter box) use Clean SOPs to fix any nasty geo that might have been generated. You'll want to tick most of the boxes - your mileage may vary with the Non-Manifold option.

This probably won't fix the problem still - the fracturing process can make a lot of stray edges - 2 point primitives, which don't play nice.

drop down a Primitive Wrangle and use this code-
i@vertnum = primvertexcount(0,@primnum);

It creates a variable called vertnum that counts how many vertices you have in each primitive.

Follow this wrangle with a blast that has
@vertnum==2
in it's Group box. This will kill any stray edges & hopefully fixes everything!

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);