Jump to content
Sign in to follow this  
NoSOPforStupidity

How to unify orientation of a Divide SOP?

Recommended Posts

Posted (edited)

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

Share this post


Link to post
Share on other sites
Posted (edited)

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

Share this post


Link to post
Share on other sites
Posted (edited)

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×