Intersecting meshes with boolean

I would like to place a object into another to overlap and apply boolean. My purpose is to place a window into a wall and getting only the intersected wall removed . What is the best approach to do that. Im trying to get new ideas from the forum or tutorials but I haven’t found anything related.

I guess I made something that works as I intended to but as the time goes by the playground gets slower and slower. I think because of the new intersected mesh is generated over and over. I want to avoid this problem

Here is the playground

Any Ideas?

ps: If your pc is not fast enough, It may freeze your computer

I do not think you should use CSG in real time as it is a slow process that will also generates lots of GC in your case,you could maybe rely on stencil buffer and draw the window first so it would take the space in the wall and then the wall would not be able to overdraw it ?

Do you have any available playground or reference showing this stencil buffer in action?
I would like to see the result of it.


I had the same problem with stencil buffer but I found the solution. Hope my topic would help you. Please check out this link Mesh intersection by using stencil buffer

It helped a lot. Thank you so much