Notifications
Clear all

[Closed] Select Alternating Polygons?

what do you want to do – fix normals after import or make a correct import?

what is the files you posted links to? what does them make? what is an original data?

how do you import these data to the max?

The sample files are .OBJ and PNG
Import using 3DS Max Import function.

Normals need to be flipped after import, because this sample doesn’t have a .RIP file.

the problem you have is due to the way the model has been made, instead of using say a double sided material/rendering the modeller has cloned the faces in situ and flipped then so you have two faces in the same position in all sorts of orientation so Unify has no chance of working. Need a way of finding all the duplicated faces then delete/detaching them which at first looks like a non trivial operation

looking at the mesh it’s two meshes in the same place as each face is exported twice probably something to do with a “double sided” tag it has in the original source

this will separate the 2 meshes (though they still need work welding an unifying)


    fn splitmesh msh faces =
    (
        detfaces = for f = 1 to faces.count by 2 collect faces[f];
        newmesh = meshop.detachFaces msh detfaces    delete:true asMesh:true
        update msh;
        othermesh = Editable_mesh();
        othermesh.mesh = newmesh --assign the detached faces to the new mesh
        update othermesh
    )
    
    
    splitmesh $ (#{1..$.numfaces} as array)

Dude, you saved the day again.

In retrospect, I probably should have realized that there were double faces because these models had unusually high poly counts.

Thanks for everything, I owe you one.

the mesh originally has duplicated faces because of probably “double-side” export feature, as Klvnk pointed…
but “checker – order” duplication might be a specific coincidence.

here is a more universal solution:


fn fixWeirdMesh obj = 
( 
   hash_faces = for k=1 to obj.numfaces collect
   (
      x = (length (meshop.getfacecenter obj k) * 100) as integer
      y = (meshop.getfacearea obj k * 100) as integer

      [x,y]
   )

   hash_unique = makeuniquearray hash_faces
   unique_faces = for i in hash_unique collect (finditem hash_faces i)


   meshop.deletefaces obj unique_faces
   meshop.weldVertsByThreshold obj #all 0.0001
   meshop.unifyNormals obj #all
   meshop.autoSmooth obj #all 45
   update obj
)
/*
fixWeirdMesh $
*/

it might need a code optimization, more accurate hashing, and a parameter tweaking…

Page 2 / 2