-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
CSG box and sphere subtract displays cracking from missing triangle #41140
Comments
Simpler example involving 3 boxes |
cc @madmiraal |
The cracks show up pretty clearly in my game, even in the shadows. Units are in metres for VR use, and those models are the size of my hands. I am also getting shards, the opposite of cracks, poking out of my surfaces, The use of epsilon values (the "snap" value here) in commercial CADCAM software is the source of many bugs that can never be fixed. The problem is that Mesh-based CSG is much harder to get right than it looks because there are an unbelievable number of special cases that you won't know until they show up as bugs years later. Using voxels can be a worthwhile approximation. In my opinion this is a definitely domain of a specialist third-party library, like zlib or jpeg compression. It's not an important enough part of this project to be worth debugging to the bitter end. The place I've used a lot of this type of CSG is OpenSCAD, which depends on http://opencsg.org/ which is GPL, so is a problem. The other place where these functions are available is CGAL, like here: Has anyone looked hard for an MIT version of these algorithms? Maybe the godot code could spun off as a thirdparty mesh algorithm where it will be easier to debug. The problem with bugs when it is part of this bigger system is that when they are quite hard to fix there's always a sense of: Is this worth it when we can usually find a way to work around it in this case. |
@goatchurchprime: Yes, Godot devs did look for a CSG library that would be compatible with Godot's license, and IIRC found none (OpenSCAD and CGAL were both proposed) |
I basically have a similar problem in my prototyping. The idea was to utilize CSG for procedural content generation, as frankly, it is just so obvious it should be used for that. It's so easy to use and construct procedural levels with it, even supporting different materials. But there are just way too many bugs (no doubt stemming from various special cases). In the end, I think we just have to face the reality that CSGShape is not fully suitable for production and never will be. |
@goatchurchprime I had trouble integrating manifold, but it is Godot Engine MIT license compatible. Perhaps others can assist. |
Godot version:
3.2.2.stable
OS/device including version:
Windows10
Issue description:
CSG subtraction of a SphereMesh from a CubeMesh given in the attached scene is missing a triangle.
The crack does not go away when I turn off backface culling, so I think the triangle is being discarded rather than inverted. The too-close points should instead be pulled closed.
Steps to reproduce:
Cubemesh size = Vector3( 0.1, 0.1, 0.2 )
Spheremesh size = radius 0.1, height 0.2, radial_segments 12, rings 12 at position Vector3(-0.0544916, 0, -0.0286622 )
Minimal reproduction project:
csgmesh_cracked.zip
The text was updated successfully, but these errors were encountered: