# CSG subtract to slow

**URL:** <https://forum.babylonjs.com/t/csg-subtract-to-slow/40041>\
**Category:** Questions\
**Tags:** csg\
**Created:** [April 20, 2023, 6:50pm UTC](https://forum.babylonjs.com/t/csg-subtract-to-slow/40041 "2023-04-20T18:50:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zhm](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@Zhm](https://forum.babylonjs.com/u/Zhm)\
**Post date:** [April 20, 2023, 6:50pm UTC](https://forum.babylonjs.com/t/csg-subtract-to-slow/40041/1 "2023-04-20T18:50:36Z")

</div>

Hi there:

I’m new to BabylonJS, Now I want to milling a mesh, so I using CSG.subtract, just like: [https://www.babylonjs-playground.com/#TS7JSQ#4](https://www.babylonjs-playground.com/#TS7JSQ#4)  
But subtraction is slowly, is there any other way to solve this need in Babylonjs? If not, what can I do to improve subratction speed?

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 21, 2023, 2:08pm UTC](https://forum.babylonjs.com/t/csg-subtract-to-slow/40041/2 "2023-04-21T14:08:22Z")

</div>

CSG generates geometries with potentially many faces, even for simple geometries such as cubes and cylinders. Therefore, if you reuse a CSG-generated mesh to apply another CSG operation, the number of generated faces will increase rapidly.

In this PG:

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#TS7JSQ%235)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

There are only 5 CSG operations, and the cube grows from 12 faces to over 70000!

CSG is known to be a slow operation and should not be used in every frame. Unfortunately it is difficult to perform boolean operations on meshes in real time. It seems that some solutions exist ([https://arxiv.org/pdf/2205.14151.pdf](https://arxiv.org/pdf/2205.14151.pdf)) but they are not implemented in Babylon.
