Jump to content

How to unify orientation of a Divide SOP?


Recommended Posts

I'm importing meshes from Maya and triangulate them in a specific way. The orientation usually has quite a few polys that are not aligned with the majority. I am having a lot of trouble trying to figure out how to control that and prep the geo so that when I do apply a Divide SOP it's in the same direction for all polys.  I've tried playing with sorts and nothing seems to affect the direction.

As you can see below this is just a straight File in of an fbx from Maya and a Divide node...the split direction is not unified at all unfortunately.

 

2022-05-05_12h14_03.png

Edited by NoSOPforStupidity
Link to comment
Share on other sites

with the help of eikonoklastes in the Think Procedural discord group I've got a solution:

Setup a for loop block with an attribute wrangle in the middle with the following vex operating on vertices:

This VEX block will test the position of vertex id 0  is above 1 OR if vert 2 is above 3 on the Y axis and if it is then add that prim to a new group marked to be shifted later with a Reverse sop pre-divide

vector pos_0 = vertex(0, 'P', 0);
vector pos_1 = vertex(0, 'P', 1);
vector pos_2 = vertex(0, 'P', 2);
vector pos_3 = vertex(0, 'P', 3);


if (pos_0.y > pos_1.y || pos_2.y > pos_3.y) {
    setprimgroup(0, 'to_shift', 0, 1);
}

 

2022-05-05_14h05_54.png.d377c5a045266e24ab4ac421dde7a384.png

Edited by NoSOPforStupidity
Link to comment
Share on other sites

Hi,

if you take the idea of Animatrix of expanding prim properties to their neighbours until you reached all primitives. You can create reference lists foreach prim. Once you have the references, you can compare each vertex arrays and calculate the offset and the sum of the offet over all references. This offset(sum) can be used, to shift the vertices.

Here is an example using some VEX. The polygons should be all quads and the geometry should be (edge) connected aswell.

 

 

reorder_vertex_shift.hipnc

Edited by Aizatulin
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...