-
-
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
Fix mesh corruption of CSG by using elalish/manifold #94321
base: master
Are you sure you want to change the base?
Conversation
5a2e7e0
to
ccdfea7
Compare
eb82d74
to
e28f331
Compare
Thanks for the ping on Discord about this. I finally got a chance to take a look. 🙂 I got materials working (it seems), but all I did was put my old code from #91748 (review) back in and change some names to fit the new place where this implementation lives: 31@5eaf7cb. Admittedly, my testing is still quite limited. Here's a simple scene that is looking good to me: https://gist.github.com/31/a3e597b32ab31b132ddbc488d8eb0324. The stress-test-ish scene with text also still seems to be working fine: https://gist.github.com/31/c3c4bace42d4ca550ae6badf0f2b7cf9. (Maybe even faster? Been a while.) I like the change of where this logic lives (vs. #91748). However, I'm not following why the implementation details were changed. It seems significantly more complex and I can't spot what it's fixing. Do you have a test case that this helps with? |
As far as I know the implementation details changed because Mesh became MeshGL in manifold. The rest of the changes were a result of this. I didn't like that fact that we are passing an increasingly growing material dictionary so that was removed, but I caused an error. Thanks for fixing! |
The developers working at manifold worked hard to remove exceptions and thrust, so we were able to vastly reduce the dependencies by 1/3. The changes here were due to api updates. |
f4c93df
to
3391f6b
Compare
e77e71d
to
db8d880
Compare
Exciting! |
b42affa
to
71ffc33
Compare
Test cases for the optimization revert. |
95d749f
to
f02cb93
Compare
Switched the code to lazily collect manifolds of the same type and if the operation changes we apply the collection with Moved the |
80ff30e
to
7146227
Compare
64a498e
to
3d0a1de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fire asked me to review this PR. First up, testing to see if it works:
- Holes in CSG meshes with coplanar faces and engine freeze when moving them #58637
- The test project was made with Godot 4.0 so it may be outdated.
- Cannot reproduce the bug in master, it looks visually correct already. However, moving the CSG box causes the editor to freeze and stop responding.
- With this PR, there is still no bug, and the editor doesn't freeze anymore. ✅
- CSG flicker / missing triangles / holes in the geometry at certain translations #43755
- The test project is made with Godot 3.x so it had to be converted to Godot 4.x.
- I am able to reproduce the bug in master.
- With this PR, the bug is fixed. ✅
- CSG box and sphere subtract displays cracking from missing triangle #41140
- The MRP is a scene file, not a project, but it seems to load fine in master.
- I am able to reproduce the bug in master.
- With this PR, the bug is fixed. ✅ Plus the topology looks cleaner overall. ✅
- In both master and this PR, the outline of the CSG geometry becomes outdated when moving meshes. Clicking on the mesh with outdated outlines causes the outlines to refresh.
- All test cases:
- In both master and this PR, there is massive Z-fighting when a CSG box is selected.
- I did not test materials, the MRPs did not include any.
20 thousand new lines of code is a lot, unfortunately, but @fire has assured me that this is as cut down as it can be. It makes sense, calculating CSG manifolds is not a simple operation. All of this 'bloat' can be disabled by disabling the CSG module, so it's a non-issue for people making a minimal build of Godot. Plus, it removes a lot of broken first-party code that we don't have to maintain anymore, replacing it with working third-party code, which is great.
As for a code review, I'm not an expert in the CSG module so I cannot give it an in-depth review. However, it looks pretty good overall, it's all self-contained in the CSG module, but I have two notes:
196bbec
to
12bb0a6
Compare
Quick-hull is removable in a newer manifold git revision to reduce the code size, but @31 wanted to make a hull operator on top of this pr. godotengine/godot-proposals#9933 Updating to a newer revision is blocked on elalish/manifold#1027 Since upgrading manifold forward has some problems, I've kept this pr on an old revision to do more testing. |
Not so much removable as integrated. We removed the quick-hull dependency in favor of making it a native component with quite a bit less code. So you should be good to go updating and still building your hull operator on top. |
aca3a40
to
c5a92e1
Compare
Renamed Removed unused: MANIFOLD_PROPERTY_NORMAL_X,
MANIFOLD_PROPERTY_NORMAL_Y,
MANIFOLD_PROPERTY_NORMAL_Z, |
Uses MeshGL64 for more floating point precision. Co-Authored-By: 31 <[email protected]> Co-Authored-By: Claudio Z <[email protected]>
c5a92e1
to
336af24
Compare
Fixes: godotengine/godot-proposals#9711
Fixes: elalish/manifold#91
The goal is to supersede #91748.
Materials are not transferringOk to review for style. Trying to debug why the materials are broken.Fixes: #43755
Fixes: #58637
Fixes: #41140
Future work