====== Rhino Mesh Settings FAQ ======
//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 [[news://news.mcneel.com/rhino|Rhino newsgroup]] and let me know. --Mitch 13.02.2010
> **Please feel free to contribute and share your meshing expertise and settings secrets!**
> //**[[http://www.hydraulicdesign.net/meshes.htm|See also James Carruthers' excellent explanation of display mesh problems]]**//
=====Why am I here?=====
**//Pretty much everyone//** that has ever used Rhino has run into a mysterious display problem at one point or another. Things like:
* getting a //faceted rendition// of what should be a nice, smooth curved surface
* a display that //slows to a crawl// with a large model
* mysterious //"ghost surfaces"// showing up in unexpected places
* invisible surfaces or whole objects
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//.
=====Why do we need meshes anyway?=====
Although Rhino is a [[rhino:nurbs|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 [[rhino:nurbs|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 [[rhino:nurbs|NURBs]] Object), which creates a "real" mesh object directly from a [[rhino:nurbs|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.
=====The different types of meshes=====
* **Render meshes** are created on [[rhino:nurbs|NURBS]] surfaces and polysurfaces for visualization purposes when using Shaded or Rendered Viewports. They are not directly user accessible or editable, they stay "attached" to the [[rhino:nurbs|NURBS]] object they were created from. They can be deleted by using the **ClearAllMeshes** command, and regenerated by using the **RefreshShade** command or by changing the settings (at File > Properties > Mesh) (which forces a global regeneration of all render meshes). As of V4, you can also transform the render mesh into a real editable mesh object using the command **ExtractRenderMesh**.
* **Analysis meshes** are similar to the render meshes in that they are not normally editable or separable from their [[rhino:nurbs|NURBS]] object. They simply have another set of controls and exist separately from the render meshes. You //can// see them temporarily, however, when you use the "adjust mesh" button or the "preview" button in the settings panel on the dialog boxes for the Analysis commands. In V5, like with render meshes above,you can transform an analysis mesh into a real mesh object with the command **ExtractAnalysisMesh**.
* **Meshes created by the MESH command** are visible and editable, and are separate from the [[rhino:nurbs|NURBS]] objects they were created from. They are objects in their own right, and can be seen and edited with the various Rhino commands that apply to meshes (see Bonus > Mesh), and can be exported to in the polygon mesh formats like STL, DXF, 3DS, and OBJ.
* **Meshes created during SAVE and EXPORT** (such as .stl) have the same mesh settings dialogs ("Detailed Controls") as the other types. You can also see them temporarily when you use the "preview" button in the settings panel, but they are not stored in the original file (only exported).
> //**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".//
=====The Mesh Settings Dialogs=====
**//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====
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.
====The Default settings====
* **Jagged and Faster** is the default for render meshes --- fine for quick visualization, but not very good for anything else.
* **Smooth and Slower** //theoretically// offers better resolution at the expense of longer meshing times. In practice, even though it does take longer, frankly, it may still leave visible gaps where you don't want them, so you are advised to try the custom settings instead.
* **Custom** allows the user the maximum flexibility in tailoring the mesh settings to their needs, at the expense of being a bit complex to understand and set up.
* The default "simple" slider settings for analysis meshes as well as Mesh and Export is an average //"somewhere in the middle"//...
* The default setting for the special STL Export dialog is generally the last used //"max dist edge to srf"// setting in the custom dialog (see further on) or the value of Absolute Tolerance in File > Properties > Units if none was set.
====The Custom Settings====
//**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.
**[[rhino:meshsettings|A copy of the Rhino Mesh Help page can also be found here.]]**
==Some Quick Guidelines==
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)//| **0.0**|
|**Maximum angle**| **35**|
|**Maximum aspect ratio**| **0.0**|
|**Maximum edge length**| **0.0**|
|**Maximum distance edge to surface** | **%%**%%**|
|**Minimum initial grid quads**| **16**|
> 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
* Refine mesh **checked**
* Jagged seams **//unchecked//**
* Simple planes **//unchecked//**
* The //maximum distance edge to surface// method forces Rhino to create a mesh that is no further away from the surface than the specified value, which is in current file units. It allows Rhino to put fewer polygons in lower detail areas and more polygons in higher detail areas, resulting in a more efficient mesh.
* The //minimum initial grid quads// setting makes sure the flatter areas have enough polygons to look smooth.
> //**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.
* If you are doing computer-sized objects, 0.01mm works out pretty well. For watches and jewelry, you will probably want it smaller, maybe .002mm. For larger objects like buildings, much larger, maybe 1mm or even larger.
* If you're going to be exporting your object for later processes, or are going to be doing very detailed renderings, you may need to tighten up the settings a bit, depending on where it's going and how precise the process is. For a stereolithography part, .01mm should still be fine for example, but for a good machined part, .001mm-.002mm is probably more appropriate.
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.//
=====Known meshing problems and weaknesses=====
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.
====Things to watch out for:====
//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.//
* **Bad objects.** While they don't always result in mesh problems, these are easy enough to track down, so it's a good place to start. If you find one, try hiding it. If your problem disappears, then perhaps all you need to do is fix the object (make it valid) and you'll be good to go.
* **Long, skinny surfaces.** These are hard for the mesher currently. The longer and thinner, the harder it is and the longer it takes. A typical example might be long continuous small radius fillets on the edges of your model. If it's taking forever to mesh and you think you're geometry doesn't warrant that, you might also have a tiny sliver surface somewhere that's hanging up the mesh machine.
* **Joined tangent lines and arcs that have been extruded or revolved.** Example - extruding a rounded rectangle. This forms a single surface with internal G1 areas, which the mesher struggles with. Solution - **Explode** the curves before extruding, or use **Split > Isocurves** at the G1 spots to create a structure with separate joined tangent surfaces instead of one single one. In the case of the extruded rounded rectangle, you will have eight joined surfaces, not one.
* **Kinked surfaces.** Usually caused by having **CreaseSplitting** (V5 or V4 add-on) set to No, or using **MergeSrf Smooth=No** on surfaces that are not at least tangent to each other. In this case, again, it is better to have multiple joined surfaces instead of one kinked one. Use **Surface edit tools > Divide surface along creases** or **Split > Isocurves** at the kinked spots to split these types of surfaces up into separate parts.
* **Triangular surfaces with holes** //This is a known Rhino bug in V4.// The "Use simple planes" setting (outlined above) messes up with either a triangular planar surface with a hole in the middle, or a planar surface with a triangular hole in the middle. The symptom is that the hole is not displayed in shaded mode, even though it is there. The remedy is to uncheck "Use simple planes" in the detailed mesh dialog. If you are using "Jagged and Faster", "Simple planes" is checked by default and can't be unchecked, so you will have to switch to a "Custom" mode.
=====Diagnostics (From the Rhino Help file)=====
**[[rhino:meshdiagnostics|The Diagnostics explanation is a bit difficult to find in the Help, for your convenience it is provided here]]**
----
===Please add your experiences!===