5

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

Wilt
  • 41,477
  • 12
  • 152
  • 203
Yenza
  • 440
  • 5
  • 19

1 Answers1

1

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.

I hope this post will help inform and enlighten more people about the latest developments in CSG! May the force be with you!

Jacob Philpott
  • 538
  • 1
  • 8
  • 24
  • 1
    Great find! Thank you very much! I’m still on the old wrapper but we are very close to update the engine and then it would be perfect to try this one as well! Accepted as answer! – Yenza Aug 30 '23 at 12:41
  • @Yenza my pleasure, I hope it works well for you! – Jacob Philpott Aug 31 '23 at 10:32