Notifications
Clear all

[Closed] Grow face(poly) selection by edge angle

i don’t really work a lot with max modeling and could missed something. is there a built-in max tool(solution) which does growing selection of faces based on specified edge angle threshold with neighbor faces?
i believe it’s not hard to write this tool but i don’t want to do what already done.

a maxscript solution probably can’t work for me. i’m talking about very high-res models (from ZBrush). it’s usually couple millions of triangles.

6 Replies

I don’t believe there is anything in Max that does exactly what you are describing, though I could be mistaken. If the meshes you are importing are quad-based, you can probably just use the grow loop tool from the Graphite toolset. Otherwise you will probably have to look elsewhere for a solution or write your own.

in general my models are not ‘quad-guarantied’

there is the “By Angle” option in the face selection mode of an editable poly, or “Ignore visible edges” option in editable mesh, should do what your looking for

thanks… i know about these methods but i want to select faces in growing mode (only connected faces) with continue check of neighbor edge angles. for example this method has to select all faces of a geosphere with angle threshold higher than an angle for any edge shared by two faces…

this is the source code for editable poly grow selections

void EditPolyObject::EpfnGrowSelection (int mnSelLevel) {
	if (mnSelLevel == MNM_SL_CURRENT) mnSelLevel = meshSelLevel[selLevel];
	DbgAssert (mm.GetFlag (MN_MESH_FILLED_IN));
	if (!mm.GetFlag (MN_MESH_FILLED_IN)) return;
	BitArray newSel;

	switch (mnSelLevel) {
	case MNM_SL_VERTEX:
		mm.ClearEFlags (MN_USER);
		mm.PropegateComponentFlags (MNM_SL_EDGE, MN_USER, mnSelLevel, MN_SEL);
		newSel.SetSize (mm.numv);
		for (int i=0; i<mm.nume; i++) {
			if (mm.e[i].GetFlag (MN_USER)) {
				newSel.Set (mm.e[i].v1);
				newSel.Set (mm.e[i].v2);
			}
		}
		SetVertSel (newSel, this, TimeValue(0));
		break;

	case MNM_SL_EDGE:
		mm.ClearVFlags (MN_USER);
		mm.PropegateComponentFlags (MNM_SL_VERTEX, MN_USER, mnSelLevel, MN_SEL);
		newSel.SetSize (mm.nume);
		for (int i=0; i<mm.nume; i++) {
			if (mm.v[mm.e[i].v1].GetFlag (MN_USER) || mm.v[mm.e[i].v2].GetFlag (MN_USER))
				newSel.Set (i);
		}
		SetEdgeSel (newSel, this, TimeValue(0));
		break;

	case MNM_SL_FACE:
		mm.ClearVFlags (MN_USER);
		mm.PropegateComponentFlags (MNM_SL_VERTEX, MN_USER, mnSelLevel, MN_SEL);
		newSel.SetSize (mm.numf);
		for (int i=0; i<mm.numf; i++) {
			for (int j=0; j<mm.f[i].deg; j++) {
				if (mm.v[mm.f[i].vtx[j]].GetFlag (MN_USER)) 
				{
					newSel.Set (i);
					break;
				}
			}
		}
		SetFaceSel (newSel, this, TimeValue(0));
		break;
	}
	macroRecorder->FunctionCall(_T("$.EditablePoly.GrowSelection"), 0, 0);
	macroRecorder->EmitScript ();
	LocalDataChanged (PART_SELECT);
}

and theres a MN_EDGE_NOCROSS edge flag that can be set with the following function

DllExport void MNMesh::FenceNonPlanarEdges  (  float  thresh = .9999[f]( http://forums.cgsociety.org/class_m_n_mesh.html#o2),    
 
 bool  makevis = FALSE  
 ) 

may some kind of combi would do the trick in a slick million poly+ kind of way ?

thanks… this is the direction i’m looking too. maybe next year i will make this tool. and the next year is soon!