Alexey Vanzhula Posted March 19, 2015 Share Posted March 19, 2015 (edited) 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 March 20, 2015 by Alexey Vanzhula Quote Link to comment Share on other sites More sharing options...
acey195 Posted March 20, 2015 Share Posted March 20, 2015 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) Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted March 20, 2015 Author Share Posted March 20, 2015 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. Quote Link to comment Share on other sites More sharing options...
magneto Posted March 20, 2015 Share Posted March 20, 2015 I am not sure what you are doing in VEX, but can you use findattribval function? Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted March 20, 2015 Author Share Posted March 20, 2015 magneto any simple example of using findattribval? Quote Link to comment Share on other sites More sharing options...
magneto Posted March 20, 2015 Share Posted March 20, 2015 Create some objects like this that has Cd prim attribute and add Connectivity for prims before AttribWrangle: 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: 1 Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted March 20, 2015 Author Share Posted March 20, 2015 (edited) Good example. But i need this: http://i.imgur.com/M8eRdDH.pngAs 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 March 20, 2015 by Alexey Vanzhula Quote Link to comment Share on other sites More sharing options...
magneto Posted March 20, 2015 Share Posted March 20, 2015 Yeah you can use the same technique I showed to only get those. Just replace 3 with 840 and then use id instead of class. It will still be in Detail mode though so not sure if this is fast enough for you. Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted March 20, 2015 Share Posted March 20, 2015 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. Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted March 20, 2015 Author Share Posted March 20, 2015 (edited) mantragora, in this case partition SOP will create 3 groups: 1. white prims 2. red (2 islands) 3. blue So, red group still contain 2 islands. I need only one (from prim id=840 for example). How to separate this island? Edited March 20, 2015 by Alexey Vanzhula Quote Link to comment Share on other sites More sharing options...
magneto Posted March 20, 2015 Share Posted March 20, 2015 I think you can use both the class and your id which would give you only those red primitives on the part of the geometry. Not sure how you are generating your id values. Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted March 20, 2015 Author Share Posted March 20, 2015 (edited) I doesn't generate any ids. i get polygon from selection in my script, it doesn`t matter. Than i need to create group with that red island.In other words I want to get color island from single polygon Edited March 20, 2015 by Alexey Vanzhula Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted March 20, 2015 Share Posted March 20, 2015 (edited) 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 March 20, 2015 by mantragora Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted March 20, 2015 Author Share Posted March 20, 2015 (edited) yeah, i know this simple brutforce way, but not sure if it's speed is good for me. yersteday i will try it in action Edited March 20, 2015 by Alexey Vanzhula Quote Link to comment Share on other sites More sharing options...
pezetko Posted March 20, 2015 Share Posted March 20, 2015 (edited) 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 March 20, 2015 by pezetko 1 Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted March 21, 2015 Author Share Posted March 21, 2015 (edited) Thanx pezetko, very useful example with good description. You are the best! Edited March 21, 2015 by Alexey Vanzhula Quote Link to comment Share on other sites More sharing options...
FrancisR Posted March 21, 2015 Share Posted March 21, 2015 Couldn't using a group sop that collects the faces by expression (using $CR or something) work? Curious as to why this isn't as interesting a solution. Quote Link to comment Share on other sites More sharing options...
petz Posted March 22, 2015 Share Posted March 22, 2015 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 2 Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted March 23, 2015 Author Share Posted March 23, 2015 petz, thanx! i will try it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.