Home Technical Talk

3ds Max .net Plugin MeshInspector with source code

polycounter lvl 7
Offline / Send Message
[PB]Snoelk polycounter lvl 7
Hello together,

lately our lead engine coder notice some weird normal errors in our engine.
Plenty of meshes where containing NaN illegal normal, tangent or binormal vertices.
After some inspection on those meshes we found the problems within the mesh topology itself.
We also are using mikktspace for generating the tangent and binormal vertices.

The errors where produces by
  • degenerated polygons
    • sometimes max is turing the edges terrible wrong on quads or n-gons which result in degenerated triangles on mesh export
  • oposite faces with same smoothing group but merged vertices
    • the resulting vertex normals will kill themself on the corners and produce a NaN
  • faces with same smoothing group where the added face normals produce a NaN on the final vertex normal
  • degenerated UV-Triangles
    • tricky one, those ones will produce NaN tangents and binormals inside mikktspace
    • this is happening when a quad has a edge turn where the resulting uv tri will get degenerated
    • imagine a quad where one tri face is folded upwards. now add a planar uv map from top down. depending on the edge flip the resulting uv triangles will be degenerated


To prevent this i have written a small utility plugin for max. This plugin should be working on 3dsmax 2014 and upwards.

MeshInspector Binaries

MeshInspector Source Code

Just uncompress the binaries to your 3dsmax path\bin\assemblies

On the utility tab you will find the plugin under the category "Piranha-Bytes Utilitis".
The Plugin is quite simple. On start it will open a new window.
If you select something inside max, it will show up inside the new window with some spects like trimesh verts and tri faces.

MeshInspector.png

Press inspect to check all meshes.
When its finished all meshes with possible errors are presented in red and order on top.
The Keep Nodes will turn on after the inspection. That way you can check every element inside the Meshinspector with interfering with the max selection.
When KeepNode is utned on, the selection method is turn around. if you select an element now, you will select it inside max as well.
Zoom Extends will focus on the selections


On the bottom you see the details about the errors.
On each error you can select the first element, next or all


The misc errors where some code examples just for fun ^^
Wrong material is are mesh which contain more material ids than the actual material on the mesh is holding. this will be fixed as well

  • mesh has face mat id from 1 to 6
  • material is multi sub material from 1 to 3
  • after fix the mesh face mat ids are going from 1 to 3 (modulo math)

I also uploaded all of the sources and made plenty of documentations regarding the max sdk .net interfaces and how to's. When i started with max sdk i notices zero good examples on the max sdk .net api.
So here is one now :)
If you find errors or got ideas for other fixes let me know

Cheers
:nerd:
Sign In or Register to comment.