-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Subtracting two CSG box nodes from a box can generate a floating triangle #86567
Comments
There hasn't been much work in the CSG code and I've been busy, so poke me if you want to investigate. I can give you a tour of where the code is on discord. https://github.com/godotengine/godot/blob/master/modules/csg/csg.cpp#L283-L463 |
Thanks for the offer, but after reading this earlier issue I found: I'm not sure working on this rather than trying to find an alternative would actually be the best for my project. I do also use coplanar faces quite frequently, and don't need good performance. Based on that issue, it seems that good performance is considered a core requirement of Godot's CSG for compatibility reasons and making Godot's fast CSG handle all cases might not be feasible. Maybe I could figure out how to add a slow layer on top of Godot's CSG that e.g. detects that the mesh isn't manifold and "shakes" nearby nodes. 😄 However, if I'm using subtraction to e.g. make a tunnel (involving coplanar faces), random shaking could lead to the tunnel being totally blocked rather than open, so it is probably not so simple. Even just detecting non-manifold CSG output would at least help with level design by letting me know the CSG nodes need some manual shaking before I put things on the floor. It would also make it easier to catch bad cases and report them. For now, I've added a few more examples at https://github.com/31/godot-csg-mesh-repro: one uses coplanar faces, and one uses near-coplanar faces and ends up with a missing triangle. |
I think a way to detect non-manifold as a ui element would help.
|
I confirm this has been an issue even in 3.5. In a project we have, CSG subtraction was required during random generation, causing these to happen at complete random. I'm unsure on what the workaround is. "Shaking the CSG nodes" is not good enough in a random situation. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
@fire What is the PR in question? |
Fixed by: #94321 |
Tested versions
System information
Godot v4.3.dev1 - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2080 Ti (NVIDIA; 31.0.15.4584) - Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz (16 Threads)
Issue description
Subtracting two CSGBox nodes from one larger CSGBox gave me a floating triangle:
I normally hit this in more complicated level prototyping situations, but it's pretty easy (at least with my luck 😄) to reproduce with simple subtractions like this, too.
Wiggling one of the boxes a little can get a good mesh, but this only works after noticing the issue. When making level geometry prototypes, I often end up with missing/extra triangles that I didn't notice on the first pass. Wiggling a node that is already involved in the level (e.g. it has things placed on top of it) also causes more work to get everything placed right again.
Steps to reproduce
The MRP contains a camera pointed at the triangle and lighting to make it easier to see when running the scene. It should look like the screenshot.
Minimal reproduction project (MRP)
CSGSubtractRepro.zip
More at https://github.com/31/godot-csg-mesh-repro
The text was updated successfully, but these errors were encountered: