gkjohnson / three-bvh-csg

A flexible, memory compact, fast and dynamic CSG implementation on top of three-mesh-bvh
MIT License
552 stars 45 forks source link

Missing Faces after operation #127

Closed PrimalOrB closed 11 months ago

PrimalOrB commented 11 months ago

Good day,

I am looking for feedback or suggestions regarding the following issue.

I have a project which I cannot share, but have created a codepen which will duplicate the general way geometry is being built / the issue it is currently having with resulting geometry.

My current project is using the three-csg-ts however it has major performance implications on heavier models. I created a version using three-bvh-csg and was amazed by the speed, but the stability / predictability of output isn't quite what I need yet

The codepen has a toggle between three-bvh-csg and three-csg-ts so the results can be compared.

https://codepen.io/primalorb-the-reactor/pen/abQMjWe

To describe what is being done:

There are two generated geometries, arbitrarily called

These have settings which can be adjusted in the dat.gui

The issue I come across is holes in the result using three-bvh-csg like this: image compared to the three-csg-ts like this: image

This issue may be eligible for bounty reward, please reach out to discuss

gkjohnson commented 11 months ago

From the docs:

All brush geometry must be two-manifold - or water tight with no triangle interpenetration.

You are using open-ended shapes in your example which is not valid for CSG.

PrimalOrB commented 11 months ago

Thank you for the response, I will update my build tomorrow with closed geometry to compare results

My understanding of the two-manifold geometry was in reference to full polygons, and not the entire mesh. In the example photos, the polygons/form which are being clipped are entirely on both sides of the clipping geometry with no gaps

PrimalOrB commented 11 months ago

@gkjohnson I have updated the codepen link with a toggle for closed geometry, and yes that does do it!

Greatly appreciated! It will take some work for me to implement this in my other project, but this proof of concept certainly helps brighten the outlook!

Thank you again