View Full Version : Delete Double Faces doesn't work

05 May 2009, 05:54 PM
This one's about Bobo's ancient DDF ( script, or PointZero's edit (

Here's what I want/do:
I've just written a script that builds random stacks of containers (just boxes). After that, I attach them together. These all sit together tightly. Like any boring task that should be automated with script, I want all the double faces on the inside of these stacks to be deleted, for performance reasons. Problem is, Bobo's and PZ's script don't work on my stacks. I've triple checked to see if the faces do share space and yes they do. PZ's version only deletes the downward facing faces, Bobo's does nothing.
An OBJ with an example generated mesh is attached.
(I hope Bobo is still around here to help out)

05 May 2009, 10:40 PM
DDF was written to remove an actual double faces - not coplanar ones, but faces that were welded incorrectly and share the same 3 vertices. For example, if you would create a Sphere, collapse to EMesh, then accidentally clone all faces without moving them to a new element, then select all vertices and weld them, it would create faces not only coplanar to the originals, but also using their vertices. I don't know how this happens to people, but in the early days of Max when DDF was written, it seemed to be an often requested tool.

You will have to do some different kinds of checks to see if two faces are coplanar without sharing vertices. You might want to post a screenshot or sample scene to explain what the exact situation is...

05 May 2009, 11:35 PM
Sounds like the PZ one ( ) works; but it will indeed only delete the duplicate faces. So if two faces share the same space, one gets deleted, leaving one other (no longer duplicate).

You'd have to adjust the script to not just select/delete the duplicates, but the face it was found to be a duplicate of, as well. Check the script for the routines that determine a duplicate of face index j to face index i. Only 'i' or 'j' is currently added to a list, just change that so that both are added.

05 May 2009, 10:13 AM
Hi guys, pretty cool you both replied to me, didn't expect that.
Bobo: I understand now. I kind of misinterpreted the point of DDF. Seems like that sort of stuff doesn't happen anymore with Edit Poly though.
Richard: I looked into your code, and changed this. Ended up getting weird behavior where faces that didn't share anything, got deleted also, while the majority of double ones remained.

So, I decided to try a different approach with checking if the faces are visible. Used an example from the help, which I'm pretty sure is by Bobo. It does raycasts from a geosphere around my object and selects the hit faces. Already works a lot better than previous methods, I just get a bit of strange behaviour with the selections:

That's a sample of my random box stacks. It selects most outside faces, just skips some which as far as I can tell, should get selected? I can just select the extra ones manually, it's faster than doing everything manually anyway.

EDIT: oh wait, that's just because the geosphere invert normals always point to the center. I just have to use a subdivided box instead of a geosphere. Then All I have to fix are the occluded faces.

CGTalk Moderation
05 May 2009, 10:13 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.