PDA

View Full Version : Merge stray polygon groups?



Infinite
01-30-2015, 03:28 PM
Excuse me posting here again but I'm quite out of the loop with regards to script writers and plugins in general. This is a problem that stems from ZBrush but I'm sure can be solved in Modeller by a script.

I was wondering if anyone knows of a tool for Lightwave or a stand alone application that is able to "merge stray polygon groups"? Like in the attached image.

Say if there are a couple of polygons that are of a different group but reside next to another larger polygon group, is there a tool that will make the smaller group absorb into the larger group?

126757

126758

I hope someone can help or point me in the direction of a plug-in that can solve this. Once upon a time I would visit flay.com!!

PS. ZBrush's "Merge Stray Groups" does not work. It's a redundant button in this situation :(

ernpchan
01-30-2015, 04:01 PM
I'm not following what you're trying to do. Are you trying to collapse multiple polygons into one? There's a merge polygons command for that.

Infinite
01-30-2015, 05:49 PM
Thanks for the reply.

Lightwave is good because it supports polygon groups. You can select a bunch of polygons and assign them a polygon group "Display/Grouping/Change Part Name etc. Zbrush also has this functionality and .OBJ allows the transfer of this information between applications.

Lightwave picks up this group information. Polygon/W "Part:"

What I want to do as you can see in that image is somehow automatically analyze a mesh, any stray polygon groups will get automatically assigned to its largest neighbour. i.e those 2x blue polygons will get assigned to the large purple polygon group or orange or green it doesn't matter.

In that example image the mesh is a slice of a much larger mesh that has dozens of these stray polygon groups, an artefact of ZBrush' decimation tool. I could go in by hand on 250k mesh, find them and assign them by hand, there could be 100's but it would take a long time.

I'm looking for a script that can do this automatically.

ernpchan
01-30-2015, 06:32 PM
Ah ok. Don't recall a script doing what you're asking for but I also don't work with poly groups much.

Sensei
01-31-2015, 04:30 AM
I don't see sense in existence of such tool, unless some already wrote it for himself.
But there is logical problem, your f.e. lavender color region is bigger than cream color, so cream should be absorbed by lavender group also, no?
If you have to pick up/select, then there is no automation..
If there will be automation, there will be merged incorrect regions..

I have tool that might help you while manual merging.
Select Connected Part,
Select Connected Surface.
See this video tutorial
https://www.youtube.com/watch?v=PaHWBsTiL7s
Basically you select single polygon, press Select Connected Surface, and whole region with same surface is selected. Then you can change it to whatever you need. Q key, and pick up surface from list.

Lewis
01-31-2015, 04:55 AM
Basically you select single polygon, press Select Connected Surface, and whole region with same surface is selected. Then you can change it to whatever you need. Q key, and pick up surface from list.

Why would he need plugins for that when there is native tools called "Same Surface" which works for surfaces and "Same Part" for Parts ?

Sensei
01-31-2015, 04:58 AM
Why would he need plugins for that when there is native tools called "Same Surface" which works for surfaces and "Same Part" for Parts ?

Select Entire Surf/Select Entire Part doesn't bother about CONNECTED region...

Make sphere, then make new sphere. Select poly on first sphere. Use Select Entire Surf. And both spheres are selected.
That's not what OP wants.
He wants to reassign little region of connected polygons that have same surface.
Not rename entire layer surface..

See video that I gave link..

Lewis
01-31-2015, 05:12 AM
I understand what he wants but neither of tools you are showing is what OP actually wants (he want's automatic mode, aren't we all ;)). Thing what he want's it's not exisiting as plugin (yet).

And BTW i've read before you edited reply and yes Select Surf/Part is there long time ago (I have it in 9.6 also but named diferently (dunno why deos LW like to re-name buttons :)) - it's named Select Entire Surf and Select Entire Part in 9.6

Sensei
01-31-2015, 05:25 AM
I understand what he wants but neither of tools you are showing is what OP actually wants

We have island of polygons in other surface. One way is carefully select them all. Other is select one poly, press Select Connected Surface, and do whatever you want to do with that selected polygon island..
Select Connected Surface is unification of Select Connected with Select Same Surface.
http://forums.newtek.com/attachment.php?attachmentid=126776&d=1422706899
Depends on how easy/hard is to select all these polygons.
http://forums.newtek.com/attachment.php?attachmentid=126777&d=1422707015
None tool will read mind of user..



And BTW i've read before you edited reply and yes Select Surf/Part is there long time ago

I found it's called Same Surface/Same Surface under Select drop-down menu, that why I edited.
I normally use normal top menu (Selection branch etc.)

Infinite
01-31-2015, 05:38 AM
Thanks for the replies but I'm still no further forward.

Surely it must be a trivial thing to analyze a mesh, see a small isolated "group" or "part" (as Lightwave calls them) of 3 to 4 polygons and be able to absorb them into any neighbouring group?

126778

Does anyone know of anyone able to write such a script or python app for this? I'm willing to pay for development on it.

Sensei
01-31-2015, 06:23 AM
Does anyone know of anyone able to write such a script or python app for this? I'm willing to pay for development on it.

It can't be done as a script.
IIRC Lscript can't read polygon's part name.
So it must be C/C++ plugin.

ps. Do you really have 19 thousands parts in this object?!

Infinite
01-31-2015, 06:53 AM
OK.

19 thousand parts? If you're referring to to the "Part:" name "Group18704" it's just an arbitrary name, it could say anything.

Overall there would be roughly 20-30 large groups and maybe 10-15 of these tiny small groups that need to be absorbed.

Sensei
01-31-2015, 07:03 AM
So how many parts is in object you want to process?

Do you care about surfaces? Or can we override them?

It's important.
Parts cannot be enumerated by plugin.
While surfaces can be enumerated (plugin will instantly without doing much learn names of surfaces).

Infinite
01-31-2015, 07:23 AM
So how many parts is in object you want to process?

Do you care about surfaces? Or can we override them?

It's important.
Parts cannot be enumerated by plugin.
While surfaces can be enumerated (plugin will instantly without doing much learn names of surfaces).

Well there could be a way to circumvent that by using Additional/Parts to Surfs, *process using script*, then Grouping/Surfaces to Parts... after the process has been done.

So surfaces are not important at all, the groups are the focus but we can swap the information between the two.

spherical
01-31-2015, 11:02 PM
Surely it must be a trivial thing to analyze a mesh, see a small isolated "group" or "part" (as Lightwave calls them) of 3 to 4 polygons and be able to absorb them into any neighbouring group?
followed by:

Does anyone know of anyone able to write such a script or python app for this?

I'm always amazed at this.... I'm not bashing you, but I see this all the time. A 3D slicing application that I use and have helped to develop gets this attitude all the time. Users make assumptions on how "easy" it is to do something in code, without having a clue on how to actually do it. Just grinds my goat that someone else's abilities and function is, for lack of a better term, trivialized; when said ability and talent are what we all depend upon every darn day. Coders work miracles, yes, but I'm here to say that it most certainly isn't as easy as it is assumed to be.

jeric_synergy
02-01-2015, 12:43 PM
Yeah, s/w is not telepathic. somethings are easy, yet enormously tedious for humans, and difficult for software.

I'd suggest this is a place where thresholds would have to be set and software would indicate "small" groupings as defined by the user, OR as ratios, e.g. "small=1/10th or less of other groups".

To the OP I'd suggest rigorously defining exactly what you are trying to do, like you're telling someone who's never seen a computer before. this will characterize the puzzle enough to see possible solutions. For example, you'd have to define what EXACTLY being 'surrounded' MEANS, mathematically.

Infinite
02-01-2015, 03:12 PM
followed by:


I'm always amazed at this.... I'm not bashing you, but I see this all the time. A 3D slicing application that I use and have helped to develop gets this attitude all the time. Users make assumptions on how "easy" it is to do something in code, without having a clue on how to actually do it. Just grinds my goat that someone else's abilities and function is, for lack of a better term, trivialized; when said ability and talent are what we all depend upon every darn day. Coders work miracles, yes, but I'm here to say that it most certainly isn't as easy as it is assumed to be.


Yeah, s/w is not telepathic. somethings are easy, yet enormously tedious for humans, and difficult for software.

I'd suggest this is a place where thresholds would have to be set and software would indicate "small" groupings as defined by the user, OR as ratios, e.g. "small=1/10th or less of other groups".

To the OP I'd suggest rigorously defining exactly what you are trying to do, like you're telling someone who's never seen a computer before. this will characterize the puzzle enough to see possible solutions. For example, you'd have to define what EXACTLY being 'surrounded' MEANS, mathematically.



I'm an artist not a programmer. There are things that I can do that a programmer will never be able to do and vice versa. I'm also a director of a company, I spend more time managing people with all different types of abilities. I see a problem and I try to solve it with what ever tools and expertise I know how. If someone is skilled in a certain area, more often than not it is trivial for them, that's not taking anything away from their years of experience or ability.

I tried to explain the issue as best as possible, including pictures and sample mesh.

Me saying it was trivial was because people immediately assumed the problem I was facing wasn't a problem at all. It was a problem, one caused by a badly written piece of code in ZBrush. It turns out to solve it, it was trivial but getting this across to a large company like Pixologic is near impossible.

Sometimes even explaining the idea and problem to people, especially large companies can often be met with derision and complications. I've already had from Pixologic "are you sure you pressed the correct button?" or "did you do x,y and z" I've been through the motions. It takes patience and perseverance to get the idea across.

Sensei has already completed the plugin, he did it over the weekend. Incredible. I will share it soon, if people want to use it.

So it goes to show you what a little bit of imagination and organization can do. If someone has a positive attitude to solve it that is ;)

I'm amazed at the Lightwave community, some fantastic people here. This is the 2nd time Sensei has solved an issue. Thank you Sensei.

Infinite
02-01-2015, 03:27 PM
A thanks back to the LW forum for anyone that might like to use it, as it says on the tin:

"Merge Stray Polygon Groups", by Sensei - http://tinyurl.com/mpf4lq5

jwiede
02-05-2015, 12:20 PM
A thanks back to the LW forum for anyone that might like to use it, as it says on the tin:

"Merge Stray Polygon Groups", by Sensei - http://tinyurl.com/mpf4lq5

I don't suppose there's a Mac version available?