stephomi / sculptgl

DEVELOPMENT STOPPED I'm now working on Nomad Sculpt instead
https://stephaneginier.com/sculptgl/
MIT License
1.39k stars 360 forks source link

Performing Boolean Operation #82

Closed xyzdcgan closed 5 years ago

xyzdcgan commented 5 years ago

Hello, i want to perform boolean operation on stl/obj files can you help me on that. i saw editsdf which you created and in which boolean op are done, as there is no original source code how can i integrate and use/perform boolean op in sculptgl.

disjukr commented 5 years ago

editsdf isn't mesh modeling tool. but https://github.com/evanw/csg.js/ would be helpful

xyzdcgan commented 5 years ago

@disjukr How we can use that in sculptgl tool directly, means how to convert mesh to csg. as boolean operation can be performed in csg format.

disjukr commented 5 years ago

need to implement that feature in sculptgl with csg.js

xyzdcgan commented 5 years ago

need to implement that feature in sculptgl with csg.js @disjukr Can you guide me for implementing that, or provide any demo for that. Any help would be great.

stephomi commented 5 years ago

Thanks for your interest, but I'm not really active anymore on sculptgl, unless for bug fixes.

That being said I couldn't help myself to experiment a little bit with 2 (very) quick and dirty implementation:

Both branch are working but I probably won't polish it as it requires more work to really integrate it.

editsdf isn't mesh modeling tool.

True, it's just an experiment. However it's easy to produce a mesh from SDF tree (simply evaluate the sdf on a grid and then running marching cubes, like the voxel remesh). That's the whole UI/UX work that's hard... (and modeling with SDF is probably not a common paradigm)

xyzdcgan commented 5 years ago

Thank you so much @stephomi for your input i checked your both branch and got the result i wanted from remesh, as you said csg takes time about 20-30 seconds at 1k vertex and i tried that but it takes much time is there any thing to make that time less...??? And Thanks for your help it really made my work.

stephomi commented 5 years ago

No easy solution for a robust boolean operation on polygonal mesh. It's certainly possible to get something faster but... I don't think we'll see a fast and robust (enough) implementation in javascript for this kind of problem. Maybe in the C++ realm you can find alternative... but probably a pain to turn into wasm and performance/robustness might be still an issue (CGAL?, https://github.com/gilbo/cork?)

http://www.meshmixer.com/ can do boolean operation and it's fast, looks like it's using a threshold to detect intersection (so it might not work well in every cases, but maybe good enough).

xyzdcgan commented 5 years ago

Yes @stephomi conversion is difficult and also not so sure that it will increase the speed of operation, surely will look into meshmixer for using threshold to increase speed of operation in csg. Thanks once again.