[Closed] Script to find "V" faces/Edges
Hey guys,
There might be a solution for this, but I have yet to find one. Basically, is there a way to to find any “v” shaped faces in mesh. And then I would need to turn the bad edge to fix the problem. I have a picture below to explain the situation. I know this can be done by hand, but with a 100k face mesh, with this happening in numerous areas, the time used up to correct this issue becomes less than ideal.
I know basically i could get the faces of a selection, and try and check corresponding face normals based on reverse edges, but then there’s differences between convex, and concave angles
Has anyone made anything like this before, or does something like this exist?
Thanks guys.
Just a thought (and I have basically no experience with these things):
If the mesh is quite simple and convex throughout (else you probably wouldn’t be able to tell which “valleys” are intentional and which aren’t), one brute force approach might be to rebuild the mesh completely from the vertices. (Assuming this is for meshes from 3d scans that don’t have proper UVs yet.)
And another thought: You probably would have to check for surface continuity for at least the next or even the next two faces in every direction in order to identify single outliers and exclude the possibility of an intentional valley. So the angle of the affected faces themselves might give you a hint, but the proof would be in the flow of the surrounding faces. The pair in question should disrupt the flow in every direction as little as possible, while the angle between the two faces themselves can be quite steep (concave or convex). Maybe it even doesn’t matter at all.
(Not sure if I’m using the right terms, here.)
Roughly sketched out it could work like this:
Walk trough all the faces and get the angles with the surrounding faces. Faces that are almost co-planar all around (under a certain, maybe user defined threshold) are very unlikely to cause problems and can be ignored.
The other faces are each paired with the surrounding faces one at a time (if not already excluded) and the sum of the angels to the surrounding faces (including the previously excluded ones) is compared for both orientations of the internal edge. (Not sure if that would destroy the face or vertex order and if that can be reversed)
Now I’m not sure if it makes sense to turn the edge immediately or collect them to turn them all at once at the end and if this could cause some overlapping and I certainly did not think this through, but it might be a possible approach. (On the other hand it’s a common problem with automatically generated meshes, so it’s probably not a trivial task.)
we would only be concerned with invisible edges only…any visible edges, I would say the modeller made his bed, now lie in it…
For invisible edges, let’s keep things simple and talk about a mid edge of a quad that has been spun the wrong way…hence the need for ‘spin’ edge macro…
Have you got a problematic mesh you could upload for me to test ? Maybe just focus on the offending area and delete the surround areas and upload what’s left…
I have a hunch that this might be about automatically generated or changed surfaces. (E. g. optimized or generated from a point cloud.)
But thanks a lot for your tool, I see you doing a lot of these. Much appreciated!
(Not sure if that would destroy the face or vertex order and if that can be reversed)
This might be obvious to some, but I did a quick test. The vertex order isn’t changed (which makes sense), the facenumbers are. Edges seem to keep their ID as well. So it might makes sense to select the face pairs by the joined edge. (Which is probably the best method anyways.)
A quick overview over the mistakes that the proposed method would be able to correct and those it might introduce:
a) intended mesh
b) a flipped edge that would be identified by measuring and comparing the angles at the outer edges of the triangle pair.
c) other flipped edges that could be corrected that way
d) errors that might be introduced. (Didn’t measure them, just an estimation.)
In some cases it might be simply impossible to decide which orientation is the intended one.
For the lower edge looking further than the surrounding polygons might do the trick.
it’s not script, it’s MCG…so you can tell me to PO if you like…but here’s my little experiment…
the trouble for you, though in your example the solution seams obvious, is that there can be cases where there is no obvious/correct solution and therefore the result becomes arbitrary and the algorithm could just make the topology worse not better.
to take your simple quad…
which is the correct solution ?
left one concave…may be selected…right one convex WON’T be selected…
who said anything about right and wrong…? or let me clarify, my tool SELECTS concave quads based on whatever Tolerance…i never claimed my tool ‘corrects’ any faults…
what about this case
surrounding geometry supports both cases, it’s an artistic decision on the direction of the edge.
vusta I was talking to the OP.
ahh ok, sorry
(yes, your case above illustrates either way could be interp as ‘right’…hence I’ll stay away from auto-correcting feature…let the user decide)
Thanks for the reply guys.
Generally, for the low angle variations, I’m not to concerned. Its for the high angle differences where its an issue. Generally its about the threashold of an angle that i originally posted, where the faces have an angle of +35- 40ish degrees. If that makes sense.