ThatOpen / engine_web-ifc

Reading and writing IFC files with Javascript, at native speeds.
https://thatopen.github.io/engine_web-ifc/demo
Mozilla Public License 2.0
617 stars 190 forks source link

Integration with elalish/manifold #164

Closed agviegas closed 2 years ago

agviegas commented 2 years ago

šŸ“‹ GENERAL:


āš” CHALLENGE:

One of the greatest challenges of BIM software are CSG operations, also known as boolean operations. Until now, we have relied on our own implementation, but it's a complex topic and it demands a lot in terms of maintainance.

Short time ago, we were super excited to see the library elalish/manifold show up, because it solves all the issues that we currently have with boolean operations. The task consists of taking this library and integrating it with this repository, thus compiling it with Emscripten.

It seems that it's possible and [some people already did it, explaining the steps to follow, so this task shouldn't be that complicated:

Here are some of the issues that this bounty should solve as a side effect:


šŸ‘©ā€āš–ļø REQUIREMENTS:


šŸ”„ STARTING MATERIAL:

You should follow the steps described in the elalish/manifold issue, where they explain how to do this.

Here you have some IFC files to test:

makc commented 2 years ago

hello there, I am just curious what kind of apis does ifcjs need from emscripten port, and where can I check the current code that needs to be replaced in order to tap into that port? I did dabble in emscripten ports in the past, I think I was the 1st to compile assimp to js 6 years ago, for example, but Im not sure if I could take on this one šŸ˜…

agviegas commented 2 years ago

Hey @makc we have a video explaining how the library works, it'll probably clarify some of your questions. If you give us a mail, we'll give you access. Cheers!

agviegas commented 2 years ago

@makc talking with one of the original authors: "he needs to port the boolean API and everything that is needed to use it, so transforming meshes to the internal format of Manifold. Inside web-ifc he needs to call that lib from the web-ifc-bool file, and potentially modify also web-ifc-geometry. If he gets the boolean subtract working using Manifold, in the browser of course, he's done"

makc commented 2 years ago

@agviegas oh you actually replied, I missed the notification. I think you said somewhere you have a discord for bounties found the link, let me try to ping you there... ah. but what's your name there... ansoni?

QuimMoya commented 1 year ago

Hello @makc Great work with elalish manifold! this is really a hard issue. I'm trying to understand how it works but i'm having some trouble. Is it possible to contact you?

makc commented 1 year ago

@QuimMoya iirc it did not quite work because there was a problem in the booleans code input data (so not related to manifold per se) that @agviegas never asked me to investigate, so it was left unresolved.

QuimMoya commented 1 year ago

@makc I can review that code, but i will need some help from your part. Is it fine for you if we review this problem together? I started investigating and saw that manifold library is compiled. I also found that many times geometry does not pass the "manifold" test, probably wrong triangles, not closed, etc. It will be great if you can guide me to find a solution.

makc commented 1 year ago

I started investigating and saw that manifold library is compiled

yes, via emscripten, so these .a files only work for wasm build

many times geometry does not pass the "manifold" test

iirc it does not pass the test due to self-intersections, which are caused by double geometry in the input (which is the data problem I referred to).

screenshot

Also see https://github.com/IFCjs/web-ifc/issues/53#issuecomment-1165931781

QuimMoya commented 1 year ago

I think it will be necessary to add a function that removes these repeated triangles from geometries. I could do that, thank you. Let's see if it solves the problem. Hum... is there a way to debug without build the project? I mean... now i can debug C++ but only without using manifold.

makc commented 1 year ago

@QuimMoya what I did was using this line to output .obj file of the input to browser console.

makc commented 1 year ago

@QuimMoya there is also this to output the data before vertices are merged for manifold lib

makc commented 1 year ago

@QuimMoya

i can debug C++ but only without using manifold

so then you can, for example, use DEBUG_BOOLEAN_INPUT and tweak #ifdef EMSCRIPTEN to let it reach geom2mesh() but comment out all the code referencing manifold there.

makc commented 1 year ago

@QuimMoya one last thing,

a function that removes these repeated triangles from geometries

they should never be added in the 1st place. also it will be quite hard to remove them, I mean the boxes are intersecting, not identical

QuimMoya commented 1 year ago

@makc

@makc

they should never be added in the 1st place.

Maybe this is related to some types of geometry, i will try to check it. Anyway, thanks, i will update you on any news.

QuimMoya commented 1 year ago

@makc

I think there is no other choice than collect all files that fail, then go file by file detecting which elements are causing it to fail. Well... it will be a tedious work, but its feasible

makc commented 1 year ago

@QuimMoya what, do you think it is different from file to file? I would think any file from the issues will do the job