# Settings for mesh fine-tuning

I am trying to get a sense of Detailed settings for mesh fine-tuning and have found several good papers in Rhino help, but there are some descriptions that really confuse me.

Density

The quotation from Polygon Mesh Detailed Options talks: “Uses a formula to control how close the polygon edges are to the original surface. Values between 0 and 1. Larger values result in a mesh with a higher polygon count.” Okay, I have obtained nothing from the description.

1. What is the formula, I mean what is a sense of that formula?
How does the Density correspond with the Maximum distance, edge to surface? The Maximum distance, edge to surface defines the max distance from polygon edge midpoints to the NURBS surface on the refine mesh stage, but what does Density? Is it similar to the Maximum distance edge to the surface but only in the first meshing stage (the generation of the initial mesh)?
2. What are those 0 to 1 values?

Refine mesh (checkbox)

1. Does it enable/disable refine stage of the initial mesh? If it is checked off (disabled) do we get merely the initial regular quad mesh and no mesh refinement?
2. The Polygon Mesh Detailed Options talks: “The mesh is refined until the angle between surface normals along a polygon edge is smaller than this value. The default is 20 degrees and the suggested range is from 5 to 90 degrees. Setting Maximum angle to 0 turns off the option. It is scale-independent.”
Which value is written about?? The “Refine mesh” option is merely a checkbox there is no value option! Why is there wroten about the surface normals tracking, this is the option of the “Maximum angle”?

What is the Initial mesh grid?
The quotation from rhino help (under Minimum initial grid quads description): “Initial mesh grid is a quad mesh Rhino creates on each NURBS surface in the first stage of meshing. When the initial mesh grid is made, trim curves are ignored. After the initial grid is made, Rhino meshes all trim edges, connects the initial grid to the trim edges, and then refines the mesh if the Refine mesh option is selected”. - trim curves are ignored and at the very same time, Rhino meshes all trim edges - how to understand this?

Search for “density” on the Rhino Mesh Settings - Detailed Info wiki page. Are your questions answered?

No. Refinement happens after Maximum angle, Minimum edge length, Maximum edge length, and Maximum distance, edge to surface options.

Yes, if you set 0 for all settings except Minimum initial grid quads, and enable “Jagged seams”.

20 degrees by default is from Rhino 1.0. I’ll have to review and update the topic.

If you set the Maximum angle, and use 0 for all the other settings, and evaluate the normal angle difference between adjacent mesh faces, you will find some faces in the high curvature areas have the angle larger then the Maximum angle. “Refine” adds more faces to those areas to meet the requirement of the maximum angle.

The minimum quad face number of each surface regardless of size. If you have a tiny surface, it will also have that many quad faces.

Hope I answered the questions properly.

4 Likes

@KelvinC Thank you for your response!

Either I don’t understand the terminology or there is some inconsistency with this definition (the source page):

“First a regular quad mesh is created and then that mesh is refined by splitting some quads into four smaller quads. The Maximum aspect ratio, Maximum edge length, and Minimum initial grid quads settings control the generation of the initial mesh. The Density (Rhino 4 only), Maximum angle, Maximum edge length, Minimum edge length, and Maximum distance, edge to surface settings determine which initial quads get split up into smaller quadrangles.”

As I understand from this paper the refinement process is determined by Maximum angle, Minimum edge length, Maximum edge length, and Maximum distance, edge to surface options, it doesn’t go afterward. Or probably I misunderstand what you mean by “No. Refinement happens after…”

What is wrong with my meshing workflow understanding: 1) The first stage is the initial regular quad mesh generation. The topology (quads quantity) is determined by the three parameters: the Maximum aspect ratio, Maximum edge length, and Minimum initial grid quads settings. 2) The second stage is the initial mesh refinement. The next four settings define which initial quads will be further subdivided to meet those settings (and I thought that the Refine check box designates take into consideration these settings in the meshing process or not). 3) And the last stage is the adjustment for trim boundaries.

@tim
I think you need to be involved in this discussion. Thanks.

1 Like

Waiting for @tim

@pierrec will look into the code.

1 Like

Thanks a bunch! You’re awesome for helping

1 Like

Sorry for the delay in replying, there were more layers in these meshing settings than I thought there were.

The best write-up I have currently for the meshing process is this:

Meshing a surface or Brep in Rhino happens in up to four steps:

1. The first step creates a regular rectangular grid of vertices on the untrimmed surface. The spacing of this grid can vary along each direction, and is estimated to roughly meet the meshing criteria.
2. The second step refines the grid by subdividing some quadrangles of the initial grid until each quadrangle meets the meshing criteria. This step does nothing if “Refine mesh” is false.
3. The third step meshes the surface’s trim edges, connects the edge vertices to the surface mesh, and finally trims the mesh along the trim edges. This step does nothing if the object being meshed is a single untrimmed surface.
4. The fourth step combines coincident vertices if the resulting mesh is a composite. This step does nothing if “Jagged seams” is true or if the object being meshed is not a Brep.

The criteria considered in the first step are: minimum initial grid quads, density, maximum distance, edge to surface, minimum edge length, maximum edge length, maximum aspect ratio, and maximum angle. Rhino uses several heuristics to choose the initial grid spacings to approximately match these criteria.

The criteria considered in the second step are the same except for minimum initial grid quads. Contrary to the first step, Rhino is much stricter about the criteria in this step. As long as their edge length is larger than twice the minimum edge length, quads that do not meet one of the criterion will be subdivided.

For a trimmed Brep face or surface, the first and second steps are run for the entire untrimmed surface, and the associated criteria apply on the entire untrimmed surface.

For the density, the exact formula does not have much importance, it’s a quick way to choose a value for “Maximum distance, edge to surface” based on the approximate size of the surface being meshed (usually the diagonal of its bounding box). Currently we use this:

I think that answers the remaining questions you had, feel free to ask again if I missed something or if something remains unclear. We are tracking related improvements to the docs here: https://mcneel.myjetbrains.com/youtrack/issue/RH-66828

3 Likes

Hi @pierrec great thank you for your awesome comprehensive response! But there are a few questions left:
1.

As long as their edge length is larger than twice the minimum edge length, quads that do not meet on of the criterion will be subdivided.

Did you mean “quads that do not meet One of the criteria will be subdivided”? If did then is it correct that right away a mesh quad meets just one of the criteria the meshing process will stop subdividing of that quad without taking any notice of the rest criteria (If the length of its edge is still larger than twice the minimum edge length but some rest criteria want further subdividing it)?

2.
From your words, I may conclude that each initial mesh quad is subdivided absolutely independently from others, I mean if a quad that does not meet one of the criteria will be subdivided independently without adding a loop-cut across the whole mesh. Am I right?

3

Grasshopper also has a mesh detailed options dialog, for its Mesh Brep component. It uses options from a different “layer” of settings than Rhino, so they are different.

Could you explain what is different with the Grasshopper Mesh Brep component, I thought it just fully repeats the Rhino Detailed options

Does it work in this order? A little bit confusing actually

Yes

No, it’s the opposite. Quads subdivide until they meet all criteria, if possible with respect to minimum edge length.

Mostly correct. Mesh refinement is recursive, at each step the mesh refiner looks at the mesh result of the previous step and tests each quad one by one. Since splitting one quad changes the topology aroud it, splitting one quad at step n can change whether its neighbors will be split at step n+1. So independent quads at each step, but dependent on the previous step.

Yes, as shown in Kelvin’s image. Subdividing one quad does not subdivide the whole row or column.

Do you see the images in the Youtrack issue? I’m referring to the mesh details panel that can be accessed with right-click on the `S` input of `Mesh Brep`, then clicking on “Set Mesh Options”. The `Settings (Custom)` component uses the same parameters as in Rhino.

2 Likes

The meshing process in Rhino has been mysterious for me, just now with your clarifications it begins possible to make a sensible/optimal mesh. Thank you @pierrec and @KelvinC! Hope it helps other users as well as me

2 Likes

@pierrec

Yeah I did, I have got that the Settings (Custom) use the same criteria as the Rhino, but I am mostly asking here

about the order in which the criteria are being applied (considered) in the meshing process, I mean is the order the same as in Rhino (in the second refine step are used the same criteria as in the first)? As you wrote here

My question goes from my misunderstanding of your comment:
“Grasshopper also has a mesh detailed options dialog, for its Mesh Brep component. It uses options from a different “layer” of settings than Rhino, so they are different. The dialog is easier to understand (it separates initial grid parameters from refinement parameters), but this is not useful as it seems because setting different values for each of these steps will be almost the same as using the most restrictive everywhere.”

So, my question is does it means that we get the same result from Grasshopper at the end as Rhino gives us, despite the refinement step (in the Grasshopper) having merely the two criteria (Min and Max length)? A little bit tricky how all criteria work together in Grasshopper… I’m asking it because I have noticed that by declaring the same value for the same criteria in Grasshopper and Rhino often can get different results

Good, sometimes Youtrack blocks access to images to external accounts, I wasn’t sure we were talking about the same thing.

Yes, GH and Rhino use the same mesher and the same parameters are passed to it using the Rhino detailed meshing dialog or the GH `Settings (Custom)` component. That makes your image on that component incorrect, the inputs max dist, max angle, min/max edge are used in both initial grid generation and mesh refinement. Aspect should be the same but the hover text says otherwise, I’ll double check. Min/Max grid quad count only apply to the first step.

Yes, if using the `Settings (Custom)` component you should get the same results. What I wrote is only in reference to the GH detailed mesh settings panel. You have more parameters than min/max edge for the mesh refinement step, see above.

If you have examples of models giving different results with the same settings between GH and Rhino, please send them (on this forum or through Rhino - Upload to Support to pierre@mcneel.com) I’d be interested in making these agree.

1 Like

Great thanks! Rhino meshing process is revealed

Hi @pierrec! I wonder why the “Maximum distance, edge to surface” criterion does not succeed sometimes. An example below shows the case, there a lot of edges the distances from their middle point to underlying surface surpass the “Maximum distance, edge to surface” value. Is there a way force to achive the criterion.

MaxDist.gh (372.3 KB)