Invalid Mesh - but what's wrong with it?

We are using the Rhino3dm library in VL to write meshes and other things into a .3dm file.

Now we have written one of the first meshes and opened the file in Rhino and it is saying it is an invalid mesh. If you click it in the viewport you can see the wireframe. When it is unselected you don’t see it at all in the viewport.

How can we find out what exactly makes it invalid? The mesh that is written in VL is a valid mesh as it can be rendered just fine, but maybe there is something missing.

Any hints are much appreciated!

The file is quite large (34mb) so I will attach it with a Dropbox link: Dropbox - 2022-09-02_15-27-20_action.3dm - Simplify your life

There’s a ‘IsValidWithLog’ method on ‘CommonObject’ which probably helps you.

1 Like

Our dev will check it out. Meanwhile is there a way to get the log in Grasshopper? That would be very helpful since invalid meshes can happen quite quickly.

You might also want to try the Check command in Rhino.

1 Like

Thanks, I was not aware of that command.

Interesting it is now saying that it is a valid mesh. Not sure what I did, but I though I had not done anything other than delete some layers.

Any idea why it is still not showing correctly in Wireframe mode? I can only see it when its selected. It seems like it’s actually there, but just rendered in the same color as the background or in some transparent material.

Oh, figured it out. The layer color was set to Alpha=0

So I take it if the material is set to “By Layer” in Wireframe mode it takes the layer color and not the color set in the material??

1 Like

I actually just tried running Check on the original file and it freezes Rhino forever (force quit after 30 mins).

There is something very strange with this mesh, it finds many degenerate mesh faces:

image

Culling those enables the check command to work, but whatever code is generating this needs revision. A degenerate mesh face is one with zero area.

ON_Mesh.m_N[57282] is not a unit vector (length = 0).
CRhinoObject.Geometry() is invalid.

The mesh has unit vectors of length 0. I guess that’s a result of degenerated face.

As per this, Rhino is checking topo for every vertice which I think is slow, possibly due to zero-area faces sharing edges and generating a very heavy topo map.

image

1 Like

Yes, the code generating the Mesh is still work in progress. It is meshing SDFs using the dual contour method. I’m sure we’ll be able to fix it.

Thanks, everyone for the detective work!

2 Likes

Thanks for finding this. The algorithm runs on the GPU and might output these. It is this technique: https://twitter.com/tebjan/status/1533140724631359490

I’ll look at whether the 0 area triangles can be filtered on the GPU or has to be done with the Rhino3dm library on the CPU.

Yes, seems to be the same issue. Maybe when downloading the buffers from the GPU they are too large or the count values aren’t correct. I’ll revisit that.

Thanks for the help!

The last faces in that Mesh is invalid (referencing non-existent vertice).
image

Yes, looks like the size of the buffer readback from the GPU is too high. Thanks!