Looking for Updated plug-in for CSG

Here’s a list of the projects that have been suggested so far:

It doesn’t look like any of these support BufferGeometry currently (unless I missed something).

@3DFish, I’d say your best bet is to ask on the repos for those projects, and see whether the owners would consider converting them to use BufferGeometry. If you offer them a small fee they may be receptive, or they may even do it for free.

If that doesn’t work out, I would put the conversion of BufferGeometry in your app on the backburner for a month or so and see if there are any further developments. If not, then you will need to pay someone to convert one of these libraries.

1 Like

I did another conversion of the madebyevan CSG library that ya’ll may find useful… it works with current three (103) and fixed some issues I had with the older module out there. It allows buffergeometries but only by converting them to geometries internally.

Hope this helps someone and feel free to give feedback/suggestions.


I’ve also added a demo and a screenshot to my library:

feedback welcome



The only thing I could get working was Manthrax’s CSG solution using Three v103.

I kept getting very strange results that appeared to be axis related with other solutions. See the loss of volume on the sides:

With Manthrax’s library it worked fine:

I do not understand why the older solutions produce flat sides.

They were just buggy implementations. I re-ported my version from the original code on madebyevan. Glad you found it useful!

@manthrax Many thanks for doing that! It’s something I had in my to-do list for many years now. It’s that something you would like to contribute to the main repo?


Yeah I’d be happy to. But it will probably take a little work to make it consistent with the rest of THREE, but I have been short on time lately. The interface is a little clunky as it stands.


We can help with the clean up :grinning:


I made a shinier demo for my CSG port and fixed some bugs:




@manthrax good work. I was able to make it work with Simple Box, Sphere and Tube Geometry but unfortunately its not working with extruded mesh geometry. Am I expecting too much?

Do you have a repro of the issue that i could see?

1 Like

@mrdoob was this pulled into main? Is there an example? I am still importing @manthrax lib to complete this operation, which is fine, but I wasn’t sure if this is now redundant.

No, it’s no part of the main repository.

1 Like

Hi there, I am not quite sure if this is the right place, but I am referring to @manthrax ‘s version of the CSG library.
So far, mesh subtraction works great, but it does not seem to take the meshes’ positions into account. Can anybody verify this?

I have an example here: https://jsfiddle.net/zyj1oucx/

The actual code starts on line 2352. (The threejs and csg libraries are included inline above).

The code should subtract the simple box “clampingMesh” from the complex mesh “component” at position (-15, -50, 0).
Instead, it’s subtracted at (0, 0, 0,).

The sample shows the mesh to subtract at the right position, but the subtraction is on top of the cylinder.


Does the following update fiddle look better? https://jsfiddle.net/zhys4b8w/

The idea is to update Object3D.matrix of clampingMesh before performing the subtraction.

1 Like

Thank you very, very much. This is almost what I tried to achieve: https://jsfiddle.net/3snmhuvb/
I must have overseen the part with updating the matrix in the Github documentation. Shame on me.

Now I have to find out, how to “close” the subtracted shape. It is not desired to see through.

Edit: Experimenting with double sided materials does not help. Am I missing something, again?

Behold another example of CSG in Threejs

My Docs : https://sbcode.net/threejs/csg/

CodeSandBox Link : https://codesandbox.io/s/github/Sean-Bradley/Three.js-TypeScript-Boilerplate/tree/csg/?file=/src/client/client.ts

It uses the CSGMesh.js from https://github.com/manthrax/THREE-CSGMesh/blob/49f10e7aac97a8a1f16740eeef5e30565f598b8d/CSGMesh.js

I converted it to TypeScript

I also converted the Chandler Prall ThreeCSG, but I found this Manthrax CSGMesh the best so far.

To develop locally,

git clone https://github.com/Sean-Bradley/Three.js-TypeScript-Boilerplate.git
cd Three.js-TypeScript-Boilerplate
npm install -g typescript
git checkout csg
npm install
npm run dev
1 Like

I think it may be relevant here, we are working on something called Buerli: http://buerli.io We are just wrapping up and plan to release - everything is working as expected but it’s marketing and security that we’re trying to complete. Solid modelling will be completely free. This doesn’t just do basic booleans but pretty much everything that a real, parametric CAD can do: sketches, nurbs, constraints, extrusions, revolves, blends, slices, etc. At the same time it’s tied into threejs as you see in these screenshots, you can use three-paths for instance.

if you need it quickly, you could write us for beta access.


Thank you Sean for writing that! I took your code, removed the existing geometry and added an example for Extrude Geometry use-case. (Referencing @waqast comment from earlier) Working well!


Codepen: https://codesandbox.io/s/cool-tdd-h94t8?file=/src/client/client.ts

1 Like

Cool :slight_smile: Glad you found it useful!

1 Like