Unraveling the mysteries of Rhino mesh settings… Solutions to common meshing problems.
Note: I've done a fairly massive edit of this page - the formatting was was all messed up by the WIKI transition, and while fixing that, I took the opportunity to reorganize the info a bit. Hopefully I made it more readable… if there's anything that got missed or needs adding, check into the Rhino newsgroup and let me know. –Mitch 13.02.2010
Please feel free to contribute and share your meshing expertise and settings secrets!
Pretty much everyone that has ever used Rhino has run into a mysterious display problem at one point or another. Things like:
All of these can usually be traced back to some problem with the meshing of the model or your mesh settings in general…
MESH you say? I didn't make any meshes, all I made was NURBS surfaces.
Well, you may not know it, but you created some meshes without realizing it … read on.
Although Rhino is a NURBs surface modeler, it uses polygon meshes created from those surfaces for visualization purposes - so what you see on the screen when the model is shaded is in reality a special, invisible polygon mesh (the “render mesh”) that is attached to the actual NURBs surface.
Why? For quick shading and rendering. But while a mesh has the advantages of shading speed and adjustability, there is a disadvantage. The render mesh is always an approximation of the surface, so there are almost always gaps between the faceted render mesh and the actual smooth surface.
The same meshing engine in Rhino is used in the creation of analysis meshes for the functions like Draft Analysis and Curvature Analysis, EMap, etc., and by the Mesh command (Tools > Polygon Mesh > From NURBs Object), which creates a “real” mesh object directly from a NURBs object.
Exporting from Rhino with certain polygon-based formats (such as .stl) will also create mesh objects (in the exported file). Although you can't edit these in the original Rhino file, you do have the same group of mesh density settings to control how they are created.
The functions that create real, editable meshes like Mesh and Export (.stl) are very important in many applications, as other “downstream” programs or processes often need polygon mesh objects to work with.
All of the types of mesh objects can exist simultaneously in one file, they do not affect one another and each can have its own settings. Although all the meshes are created with the same engine, there are a couple of important differences between them.
Willem: When meshing an object for export I always first create a mesh and look at it in the viewport Flat Shade mode (FlatShade command) before exporting it to the desired format. The Flat Shade mode “Shades the current viewport with no smoothing so the individual (render)mesh faces are visible”.
Why do we need mesh settings anyway? Isn't Rhino intelligent enough to figure all this stuff out without my having to tell it what to do?
That's a good question — and subject to much debate. We won't get into the debate here, but suffice to say that yes, if you want optimum meshing in Rhino, you will need to understand how these settings work and how to manipulate them. Hence this long and windy page full of info and advice. Don't despair…
OK then, why don't I just mesh everything very finely and with high resolution - won't that solve my problem and let me forget about it??
Actually not — it will probably make things worse. Meshes are a bit like pixels in an image - the more pixels (mesh faces) you have, the finer the image (model) resolution is, but also the more data is needed to describe the image (model). At a certain point the data set can become huge, and considering that this data also needs to be dynamic (you want to rotate your shaded model and look at it, right?) the ability of your computer to process this data in realtime quickly reaches its limit.
So meshing is a balancing act. The idea is to use the least number of mesh faces you need to have adequate resolution for your job - and no more. To do that in Rhino requires some understanding of how the meshing system works. That's why you're here.
The controls for different mesh types are virtually identical. The controls for the Render Mesh (display mesh) settings are part of the .3DM file's properties (Properties > Mesh). They are set globally for the whole model, but as of V4 you can also override them on a per-object basis. Rhino offers you 2 standard settings, jagged and faster and smooth and slower, as well as custom, which lets you access the detailed controls.
When creating a mesh from a NURBS object, or exporting to a mesh format like STL, DXF, 3DS, and OBJ you can choose to use the “simple” controls, which are just a coarse ⇐⇒ fine slider: fewer ⇐⇒ more polygons.
Alternatively, there are the “detailed controls” which expose more of the settings to the user. They are virtually are identical for all the mesh types, and are described in detail below.
If you really want to control your meshing process, here is where you need to start!
There are seven numerical settings and three check boxes. Each one has a different method of mesh control and some of them can work together. The interactions and combined effects of these settings are complex to understand. Individually they are well described in the Help however, and reading this info carefully will give you a good idea of what each one does.
Below is a basic start point for custom settings, experiment with them on your models.
If a setting is 0 or 0.0, it is turned off (not taken into a account).
|Density (new in Rhino 4)
|Maximum aspect ratio
|Maximum edge length
|Maximum distance edge to surface
|Minimum initial grid quads
In Rhino 4, you can experiment with Density setting. It is scale independent. See below for a more detailed explanation of what it does. In Rhino 3, there is no Density setting, you can insert a scale appropriate value in Maximum distance edge to surface. For millimeter-unit models try 0.10 to 0.01
Pascal: I prefer to set some largish number in “Maximum angle” rather than zero (disabled), maybe 35-45 degrees. This way 'features' that fall below the max distance number will be subdivided a little. You can get away with a little bigger max distance number in some cases if you let a large angle setting take over for the smallest objects. When there is too great a discrepancy between an object and the global mesh settings, it often pays to use the Mesh command on those objects. Set the mesh to be as loose or as fine as needed for that object, then render the mesh object only, hide or delete the NURBS surface. Very small repeated details can be meshed very very loosely for instance, without impacting the quality of the image.
Mitch: I sometimes put a value of 6.0 in the “Maximum aspect ratio” setting to keep Rhino from meshing long, thin objects with long, skinny triangles, it will break them up into more shorter, smaller ones. However, this comes at the expense of bigger file sizes and sometimes significantly longer meshing times.
Ricardo: I do jewelry rapid prototyping. My default settings are 0.001 for maximum distance and 12 degrees for maximum angle. Larger angles tend to show the triangle edges on the final product. Mesh sizes range up to 30mb on very complex models. Units are milimeters
Olivier: I work on tensile structures that mix large membranes and steel structures. I need the membrane to be meshed accurately, but the steel tubes and fittings induce very heavy meshes. To deal with both big and very small curvatures, I always set a 'minimum edge length' to limit the number of polygons on small curvy details.
The main setting is the one for max distance edge to surface. If you think about it for a moment, you will understand that this value is scale (size) dependent, hence the following question:
What is a scale-appropriate value?
First, it depends on what you're going to be using your mesh setting for. For general display purposes your value can be a bit bigger (looser), as you're only visualizing the model on your screen, and less polygons mean faster meshing times and quicker display reaction when tumbling, zooming, etc.
It may seem very complicated at first, but after a bit of practice, you will find a few standard settings that work for you in most situations. These settings can even then be programmed into a macro or script to quickly launch the meshing of your objects with the desired characteristics.
Details of the Density setting:
The Density setting in V4 uses a formula to control how close the polygon edges are to the original surface. The valid range is from zero (off, or ignored) to 1, maximum density. Larger values result in a mesh with a higher polygon count. Used by itself (all other settings 0) it seems to create well balanced meshes. Density is not directly related to units or scale.
The Density number feeds Rhino something to use in its own internal calculation, per object, which in turn spits out a number that is like the “maximum distance edge to surface” setting that is, a number in current model units that tells the mesher how far to allow the mid-point of any mesh edge to stray from the original surface. The calculation is based on the size of the object among other things. This number will be smaller as the Density setting gets closer to one. The user will never actually see this final number and it is different for each object being meshed. If there is also an explicit non-zero “Maximum distance edge to surface” number set elsewhere in the dialog, then the mesher will use whichever number is smaller for its eventual max distance setting for each object.
Sometimes, you may find that even with the settings guidelines above, you are still not getting good results. You may struggle with ghost surfaces, uneven shading, or triangular mesh facets that cut across empty space where they shouldn't be. Some of these problems may be caused by the Rhino mesher's reaction to certain types of geometric structures. The only way to correct them currently may be to do some reconstruction on your structures.
While these conditions don't always cause problems meshing, they have been known to do so in the past, so it's worthwhile checking if you are having difficulties.