ThreeJS : CSG (Wrapper?)

420 views Asked by At

I've been using the standalone ThreeCSG.js (https://github.com/chandlerprall/ThreeCSG) to create different shapes but I'm having errors occur with some shapes I'm trying to create: Maximum call stack exceeded.

It seems the repo is not being updated so I tried the CSG-wrapper (https://github.com/kraag22/csg-wrapper) which creates the shapes without problems but is heavily outdated for THREE.JS.

Is there any other CSG library that you can use? Or one wrapper for the CSG (https://github.com/evanw/csg.js) that is up-to-date ?

My two reports on the repos:

https://github.com/kraag22/csg-wrapper/issues/3 https://github.com/chandlerprall/ThreeCSG/issues/23

1

There are 1 answers

0
jgphilpott On BEST ANSWER

Yes, I have actually used both of those CSG wrappers before. After using @chandlerprall's version I switched to this one (THREE-CSGMesh) created by @manthrax that is designed for use with modern three.js.

However, after some deeper research into the topic I discovered this awesome repo (OctreeCSG) created by @giladdarshan. This repo uses a completely different technique than all those other repos known as Octree-Embedded BSPs. After some experimentation with the code, I can affirm that this approach is the superior one by far with nearly a 1000X increase in performance! Furthermore this repo, unlike the others, is not a wrapper for @evanw's csg.js but rather a standalone alternative (read the comments on this thread for more detail).

As far as I can tell this technique is very new and not so well known. It looks like the academic research papers on the topic were published as recently as March 3rd, 2021 and the GitHub repo was created between April and September 2022 (more than 6 years after you asked your question and about 1 year ago from now).

So in conclusion, both the repos I have mentioned are better than the two you are (or were) working with but OctreeCSG is the best by far! I highly recommend you try implementing it and let me know what you think. I haven't yet found any other CSG repos that use the Octree technique but I will update this answer if I find anything better in the future.