Delete Duplicate Faces

Hi all,

I have many plants which have duplicate polygons in exactly the same position.

In the real-time engine I have loaded the plants into... the faces flicker (as one would expect with Z-Fighting) but also the application crashes when it tries to calculate shadows.

Removing the unnecessary faces manually is time consuming and difficult... as it is really hard to find 'em all.

Anyone keen on helping me create a script (or point me to one already created) which will find the duplicate faces and select them in edit mesh or edit poly mode? (so I can then delete them).

Details:
- Faces are in exactly the same position.
- Normals facing the same way (don't want to select and delete polys which are in same position but facing the opposite direction).
- Mapping coordinates on the duplicate face is sometimes different.

Note: I tried a couple of similar scripts on scriptspot (like "remove coplanar") but it didn't work for my requirements.

Thanks for any potential help.
I'm currently using Max 9, but looking at upgrading very soon to 2010.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
nikobus's picture

This is what you need

I usually have the same problem. Maybe this is what you need:
http://www.scriptspot.com/3ds-max/scripts/find-coinstances

Garp's picture

Depending on how you ended up

Depending on how you ended up with duplicate faces in the first place, this might help:

setFaceSelection $ (for f = 1 to getNumFaces $ where (meshop.getElementsUsingFace $ f).numberSet == 1 collect f)

It selects all the faces in an editable mesh that are 'isolated', i.e. that do not share a vertex with the rest of the mesh.

Cullen's picture

Thank you Garp, But I think

Thank you Garp,

But I think the original artist cloned entire elements, so the faces are not isolated.

For example, there is one "Leaves" object which contains many elements for all the individual leaf clusters.
I'm unsure how the artist did it (maybe with some sort of scatter modifier) but some (not all) of the cluster elements have duplicate clusters in the same position, but somehow with different mapping coordinates applied.

Any other thoughts?

Garp's picture

The hard way would be to have

The hard way would be to have a script compare all the verts between all faces. Could take a while!
Something simpler would be to check the face centers and - eventually - the normals.

In both cases the problem is how to determine which face to keep and which to delete when two clusters have a few identical faces.

Did you try selecting by material ID or smoothing group? You might get lucky...

Cullen's picture

I was hoping you were right

I was hoping you were right and I would get lucky... but, alas... no luck.
Smoothing groups are the same.

Thanks for your feedback. I'll probably have to start learning MaxScript and try some of your above suggestions.

But happy for suggestions to keep coming in. :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.