Jump to content

Get polygons in VEX


Recommended Posts

I have some geometry with a few number of color polygon pieces. In VEX we can simply detect this polys by color attribute value.
But I need to detect only single color piece (by poly number for example).
So I want to see something like connectivity\partition but in VEX implementation.

 

Any ideas?

Edited by Alexey Vanzhula
Link to comment
Share on other sites

Is there a specific reason why you cannot use a connectivity SOP? you can of course just query the attrib generated by the connectivity sop in VEX,]

you can also consider promoting your prim color attribute to a vertex attrib and then use the vertexsplit SOP (and possibly a connectivity afterwards)

Link to comment
Share on other sites

Thanx for reply!

Need some fast solution to detect color poly patches on geometry without deleting geometry (connectivity/partition).
Of course  we can add attribute with connectivity SOP, delete other pieces and detect what piece of this color we need. But it slow.

I need fast solution for interactive tools.

Link to comment
Share on other sites

Create some objects like this that has Cd prim attribute and add Connectivity for prims before AttribWrangle:

 

1KeEPzc.png

 

In AttribWrangle (Detail mode) use this to color prims that has class attribute value of 3. This is not the best way to do this but I am just showing it as an example to get all the primitives that has the same attribute value.

int targetprim = 3;
int count = findattribvalcount(0, "prim", "class", 3);
for (int i = 0; i < count; i++)
{
    int primindex = findattribval( 0, "prim", "class", targetprim, i);
    setattrib(geoself(), "prim", "Cd", primindex, -1, {1,0,0}, "set");
}

The result should be like this:

 

2ZzmVqH.png

  • Like 1
Link to comment
Share on other sites

Good example. But i need this: http://i.imgur.com/M8eRdDH.png

As you can see prim with id=840 have a red color in red island. Also this geometry has other red piece. I need only prims in red island form prim with id=840.

 

Sorry for bad topic description :) Still have a bad english :(

Edited by Alexey Vanzhula
Link to comment
Share on other sites

Guest mantragora

Wouldn't it be easier if you just made a group from each colored island and check did any of those groups contains interesting you primitive id? That way you wouldn't had to loop thru it.

Link to comment
Share on other sites

Guest mantragora

1. First Pass = ConnectivitySOP + PartitionSOP.

2. Second Pass = ForEach set to group and again ConnectivitySOP + PartitionSOP. You will have to name groups here correctly so it wouldn't return again back two groups.

3. Check which group contains your primitive.

Edited by mantragora
Link to comment
Share on other sites

One blast, one connectivity, one attribtransfer and couple of wrangles.

 

There is no need for partition sop and foreach sop.

(There is foreach example included. That one grows the starting group until the inclusion of the whole color island. But it's too slow, and fail in certain situation).

 

Solution with blast looks much more stable and faster.

pz_wrangle_prims_example.hipnc

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

if you promote "Cd" from primitives to vertices you could use the vertexSplit-sop to partition the geometry into seperate parts. after that you can select the different islands in the viewport by using 3d connectivity. should also be quite fast ...

 

hth.

petz

  • Like 2
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...