Manthrax CSG library update: now 20% faster, and using BufferGeometry internally

Hi all… I’ve done some spring cleaning on my CSG library located here:

I’ve sped up the algorithm by removing a ton of internal allocation, and also made it work on buffergeometry by default, so no conversion to/from geometry required.

Additionally, I’ve separated the algorithmic core into a separate file with no dependencies that could be easily adapted into a webworker, by serializing/deserializing the vanilla bsp structure.


I’m using “clipping planes” for a project in order to interactively show cut-section views of the internals of complex objects.

This method allows me to distinguish the object’s main material from the “cut section” material. Ie: the new internal “side” created by the cut… The faces that are created from the Boolean operation.

Is this an option in your library?


If you only need visualization, there is something called the “goldfeather csg” algorithm that would perform better.
Here’s a sandbox with goldfeather… that I fixed up from this medium article which had the sample but broken:
scs-csg-subtraction-webgl (forked) - CodeSandbox

and the article:

1 Like

@GlifTek btw I just pushed support for color and material id / material groups. Should all work like we were just discussing. You can give each input an id and the result will have separate material groups for each id.



Well that was quick.
Very cool!

ive got objects interacting on the x,y,z axis when they move up and down and vertically.
however i can’t get them to interact if they are rotated at all.
is that a limitation or not implemented yet, or am i missing something?

also polygons moved by morph factor? can that affect the boolean process as well?
i’ve tried but it hasn’t worked.

got diagonals working… wasn’t any problem with the code (obviously works in the demos.) … fault was a silly one on my part…
i had been rotating an empty null which the mesh was attached to.
not the mesh itself.

Thanks a lot! :heart_eyes:

I will try to add it to enable3d :+1:t2: