[Closed] Getting uv shells/elements without UVW_unwrap Mod
i was/am working on an eMesh and with the low poly counts (3k ish) that im dealing with it is not noticeable when i run getShells(), or whatever i eventually called it
My basic code is
Get face 1
faceCount = 1
while faceCountChanged
verts = convertToVerts
faces = convertToFaces
if faces.count == faceCount
faceCountChanged = false
faceCount = faces.count
append shells faces
what tri counts are you dealing with? and try doing a timestamp() at some points to see what exactly is the slow part of your script.
My current code is about the same as that, following the reference code in the MXS Help.
But using that code on an EPoly Mesh, even a Teapot, in realtime, causes a 0.5-1 second delay.
Well, or at least 0.5 delay. The other 0.4+ is from me using the convert BorderEdges FromFaces EditablePoly method.
Exploring what Dennis said, this code I have I think is getting me there. Or giving me an idea.
vertArrs = #()
faces = ($.mesh.faces as BitArray)
for i = 1 to (faces as array).count do
(
verts = meshop.getMapFace $.mesh 1 i
append vertArrs #(verts,i)
)
Which then returns, on my plane mesh, something like:
#([3,4,1], 1)
#([1,2,3], 2)
#([5,6,7], 3)
#([4,3,8], 4)
#([8,9,4], 5)
So, I think I need to sort those somehow, to see if any of the arrays contain the same map verts.
So Face 1, it has a shared Vert (4), in Face 5, which is correct, according to my mesh.
So from that I could then group those into seperate Arrays, or Element Arrays. So it should be something like:
Faces Groups:
#(1,2,4,5),#(3)
I think this is correct??
Yes, since most people, including myself like to model in EditablePoly, because the tools are better/quicker to use. Also other internal max tools only work on EditablePoly I believe.
So i need to evaluate on the Mesh level, but allow EditablePoly. Basically how other XView options work, as this is where it’s being used.
well… for Editable_Poly it’s actually much faster than for Editable_Mesh…
there is another hint… to get all map seam edges you need only two polyop functions – getmapface and getfaceedges
Thanks for that.
So, was I right though, in that I should be doing some sort of compare FN /Sort against those mapVerts? That’s the best way I can think to do it right now.
another hint… if we don’t have such thing as map edge, what might be the best implementation of it? what does an edge make?
Well verts would make an edge, or we need verts to make an edge.
I wish I could figure this out, but I’m not sure I can. :banghead: I’m pretty much stuck at the beginning yet.
Like I said before, the only thing I can think of, is to compare/sort the faces based on MapVerts. To see if faces share map verts, then group into arrays/elements.
#(#(9, 10, 11, 12), 1)
#(#(1, 2, 5, 6), 2)
#(#(2, 3, 6, 7), 3)
#(#(3, 4, 7, 8), 4)
#(#(1, 4, 5, 8), 5)
As I showed before, the 1st value here, Face 1, clearly has seperate map Verts from the other Faces. But the rest of them, 2-5 in this example, share map verts in 1 way or another.
sure! you are so close. the edge is [v1,v2] !!! or [v2,v1]… but is it really different?
Well when creating an edge, it doesn’t matter the vert order I don’t think, only if you want to create a face properly… So the face isn’t turned on 1 end or inverted.