Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra edges after complex subtraction #181

Closed
codand opened this issue Nov 23, 2023 · 8 comments · Fixed by #193
Closed

Extra edges after complex subtraction #181

codand opened this issue Nov 23, 2023 · 8 comments · Fixed by #193
Labels
bug Something isn't working
Milestone

Comments

@codand
Copy link

codand commented Nov 23, 2023

Subtracting a box (or any shape) from a 3DBenchy (popular 3D print) produces a geometry with several incorrect edges contained in the subtraction area. These are only visible when rendering the result wireframe.

Repro: Open this codesandbox link (adapted from the Simple CSG example) and set brush 1's shape to "mesh".

Additional info:

isWaterTight reports true for this mesh,

Blender's 3D print checker also reports zero non-manifold edges.
image
image
image

Hope this report might help figure out some edge cases.

@gkjohnson
Copy link
Owner

gkjohnson commented Nov 23, 2023

Interesting - I'm also seeing that "intersectionEdges" is reporting some odd extraneous edges:

image

Can you please produce a simpler example that just includes the two geometries and the clipping operation and the wireframe?

isWaterTight reports true for this mesh,

Also note that is water tight is not documented and not currently fully functional.

@gkjohnson gkjohnson added the bug Something isn't working label Nov 23, 2023
@codand
Copy link
Author

codand commented Nov 23, 2023

Can you please produce a simpler example that just includes the two geometries and the clipping operation and the wireframe?

Sure. here's a stripped down version.

@gkjohnson gkjohnson modified the milestones: v0.0.14, v0.0.15, v0.0.16 Dec 4, 2023
@gkjohnson
Copy link
Owner

I fixed #183 in v0.0.15 which seemed to be related but it does not seem to have fixed this issue. Are you seeing this same kind of issue with any simpler models? Ideally generated models from the three.js primitives?

@codand
Copy link
Author

codand commented Dec 5, 2023

I've not yet seen it happen from a single subtraction between two threejs primitives, but I have seen it happen after multiple consecutive subtractions. I'll see if I can produce a simpler example on the latest update this week. Thank you for investigating!

@gkjohnson
Copy link
Owner

gkjohnson commented Jan 2, 2024

It looks this this is happening as part of the "full triangle" accumulation step - ie the step where unclipped triangles are appended to the result.

image

These edges look like they intersect the the clip volume but the intersection detection skips triangles marked as "degenerate". It seems they're inadvertently being added to the result geometry elsewhere, instead.

image

They're gone if we filter triangles with area === 0 when building the result geometry:

image

These degenerate triangles are in the original model, as well - 563 of them. I guess these will have to be filtered out during the clip process. I'll just have to think abut the right place to do it.

@gkjohnson
Copy link
Owner

#193 should fix it:

image image

@gkjohnson
Copy link
Owner

I still want to check out the "intersection edges" issue listed above, though.

@gkjohnson
Copy link
Owner

Looks like the eges issue can't be easily reproduced at the moment - we can track it down when it arrises another time:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants