Isolated vertexes

Isolated vertexes

Anonymous
Not applicable
1,247 Views
12 Replies
Message 1 of 13

Isolated vertexes

Anonymous
Not applicable

I'm after finding a function to get rid of isolated vertexes (on the fly) that appear as result of slicing along hidden edges, anyone know a solution?


Note: The slice operation is performed in simple object plugin that has a pick object function.
The meshing result needs to be clean and not present those extra points that generate all sorts of problems in smoothing etc.


See screenshot,


Anyone?

Thanks,

 

isolated vertexes.JPG

0 Likes
1,248 Views
12 Replies
Replies (12)
Message 2 of 13

Swordslayer
Advisor
Advisor

You'd have to rebuild those polygons yourself (get invis edges with 2-edge non-border vert, get the polygon, remove and create new polygon, transfer SG/VC/map data if any). TriMesh is not really good when dealing with polygons.

Message 3 of 13

Anonymous
Not applicable

Thanks for the reply Swordslayer but I'm still stuck and short on ideas for the code.


I think your pointing at something that could work but I'm not jet that experienced at maxscripting, so I'm after some example implementations (code should it exist) that takes care of this in the script dynamically.

I know it must exist because this kind of behavior does not appear inside 3ds max on edit poly objects, there is some magic going on in there that takes care of this, vertexes get moved around in some way (I do not jet understand) and then clean geometry gets out all the time (not getting these isolated vertexes).

 

Basically don't know what is going on there (whats the difference) but I would like to have that same behavior in the create plugin output.

Looking for info on this particular part seems to be very hard as it involves some aspects of the edit poly geometry class and integrating that in the create plugin (somewhere between the slicing and meshing function), but there is no info to be found targeting this specific edit poly meshing behavior and how to implement it in a create plugin.

 

Lots of integration problems and confusion from my part that needs to be addressed in some way I do not jet know, I currently don't even know where to look for answers frankly.

0 Likes
Message 4 of 13

Swordslayer
Advisor
Advisor

Editable poly objects have a completely different structure, they don't use TriMesh (Mesh), that's why I said it's easy with PolyMesh (MNMesh). With TriMesh, the whole mesh is defined by a collection of faces and each of them has three edges. If you slice them, the edges get sliced, too. With polymesh (whole another structure, see winged edge), the defining structure are the edges that create polygons, their triangulation is secondary. If you use slice there, no such problems will arise. It also makes it possible to use concepts such as loops, rings etc.

 

To further address your 'I know it must exist' plea, no one bothered with it with the built-in modifiers either: make a box, convert it to editable mesh and apply a symmetry modifier on it and you will see that as soon as the underlying object is a mesh, it will exhibit the exactly same problems with vertices inserted at invisible edges where sliced. So no, it doesn't really.

 

Proper way to do that would be to create a modifier that modifies MNMesh instead, but seeing that you're not experienced at maxscripting and this would reuquire C++, I can only suggest asking for a MNMesh scripted modifier on the Ideas page. Scripted plugins currently only work with TriMesh values and maxscript cannot convert from that to PolyMesh without creating a scene node (and it wouldn't be a good idea either as the conversion time overhead everytime anything changes would make it crawl).

Message 5 of 13

denisT.MaxDoctor
Advisor
Advisor

as i understand you are working on your own simpleobejct plugin, which does do some mesh splice operation with a picked mesh (mesh or copy of mesh of a picked geometry object)... right?

 

but it's your own tool and you can make your rules... what if a picked object can be only editable poly? in this case you can use polyop.splice instead of meshop.slice, and you will not have this "extra verts" issue.

 

Message 6 of 13

denisT.MaxDoctor
Advisor
Advisor

@Anonymous wrote:

 

 

Scripted plugins currently only work with TriMesh values and maxscript cannot convert from that to PolyMesh without creating a scene node 


you can convert it with MaxPlus... what you have to do is to make empty PolyObject, set its mesh using the current(derived) mesh, do whatever you want using polyop, and finally return a modified mesh of your polyobject.

0 Likes
Message 7 of 13

Swordslayer
Advisor
Advisor

@Anonymous wrote:

you can convert it with MaxPlus... what you have to do is to make empty PolyObject, set its mesh using the current(derived) mesh, do whatever you want using polyop, and finally return a modified mesh of your polyobject.


True, you can do that, I wouldn't like this approach in a modifier but as a simpleObject... you could create the polyobjects upon picking the nodes, save them in a RefTargContainer in a #maxObject parameter and only update when needed.

0 Likes
Message 8 of 13

denisT.MaxDoctor
Advisor
Advisor

Swordslayer wrote:


I wouldn't like this approach in a modifier ...


what's wrong with using it in a modifier? i do it all the time if i want to handle an object as a epoly object ...

0 Likes
Message 9 of 13

Swordslayer
Advisor
Advisor

@Anonymous wrote:

@Anonymous wrote:


I wouldn't like this approach in a modifier ...


what's wrong with using it in a modifier? i do it all the time if i want to handle an object as a epoly object ...


It feels dirty to do it that way, especially using MaxPlus and its wrappers. I would probably opt for just passing the mesh to a separate .NET function in that case (avoiding the MaxPlus library completely, it's subject to change and can be quite limiting), only using the scripted modifier to pass it and nothing else.

Message 10 of 13

Anonymous
Not applicable

 

I was reading this topic and I thougt I have some questions about this topic too.

So I read that you can make your own rules to allow only poly-objects to the plug-in, what'wrong with converting a mesh to a poly object?

 

Is there any performance issue with converttopoly, or polyop instead of meshop or is there something else more important that I must know?

 

Because I'm not that experienced yet and only have thoughts.

When I do the same with mirror with a poly-object we don't see this vertices.

 

This is just an idea and I hope someone can correct me if this approach isn't that good or why it isn't preferd too do it this way? (learninpath boost 🙂 )

So is it possible to make copies from the 'picked object' one a mesh and another with a mesh converted to  a poly?

You can do your slices, mirror before you do some other stuff on both of them, make from each seperantly a collections of vertices.

Derive the 'isolated vertices' --> rearrange all faces and delete this vertices.

look for the vertices indexes in the facelist--> look how many faces are with this number, rearrange  the faces and delete that vertice.and do this in a loop until the islated vertices are away.

 

Is it possible to work this way so you can still output a trimesh object?

(i would think meshop is faster then working with mnmesh or poly-op)

correct me if I'm wrong

 

I tried to write some code, but I can't work with the polyop.slice method:

 

polyop.slice <Poly poly> <facelist> <ray plane_and_dir>

 

0 Likes
Message 11 of 13

Swordslayer
Advisor
Advisor

I was reading this topic and I thougt I have some questions about this topic too.

So I read that you can make your own rules to allow only poly-objects to the plug-in, what'wrong with converting a mesh to a poly object?


In general, you want to avoid creating (and deleting) new scene nodes with each update, and you want to avoid collapsing the picked nodes and converting them to poly. Accepting only objects that are already editable poly shifts the responsibility to think twice about doing that to the user. 


Is there any performance issue with converttopoly, or polyop instead of meshop or is there something else more important that I must know?

 

This is just an idea and I hope someone can correct me if this approach isn't that good or why it isn't preferd too do it this way? (learninpath boost 🙂 )

So is it possible to make copies from the 'picked object' one a mesh and another with a mesh converted to  a poly?

You can do your slices, mirror before you do some other stuff on both of them, make from each seperantly a collections of vertices.

Derive the 'isolated vertices' --> rearrange all faces and delete this vertices.

look for the vertices indexes in the facelist--> look how many faces are with this number, rearrange  the faces and delete that vertice.and do this in a loop until the islated vertices are away. 


If you already make a copy and convert that to poly to do the slice, just grab the resulting mesh directly. I've hinted above how you can identify the offending verts (no need for any duplicate objects), plus instead of 'deleting verts' you would need to rebuild the faces and transfer existing mapping/smoothing/ID/etc data. Not easy, though of course doable. For examples on polyop.slice feel free to search cgtalk forums, there's plenty of examples.

Message 12 of 13

Anonymous
Not applicable

Yes that's right Denis, it involves a scripted create object plugin using slices on multiple picked objects. It indeed would not be that big of a problem if those picked meshes need to be edit poly objects. If I'm correct it could also work if one puts edit poly modifiers on top of picked objects that would be something ells then edit poly?

 

Anyways, I have no problem telling the users to keep these things in mind.

 

I’m sorry to ask but would there be any code examples somewhere that involves this implementation?

0 Likes
Message 13 of 13

Anonymous
Not applicable

Denis, could you point me in direction of some more info about how that implementation of MaxPlus would go about? Sorry again, very new to Max Scripting and need lost of code examples to be able to understand how things connect. Its very hard to zoom in on something in that massive amount of info if you don't know what to look for.

0 Likes