Only the specified area is reserved

I now want to achieve something similar to the image below, but I only want to keep the inside of the area instead of outside of the area

Since the area requiring mask is irregular and may be a very complex polygon, such as the border of a province or city, I want to use stencil buffer to achieve the above functions, but I feel a little confused. Does anyone have similar implementation ideas, thank you in advance.

One possible way is to define the boundary as a shape and then extrude it with THREE.ExtrudeGeometry. I used this approach in a small library for making maps.



Thank you, but things are a little different, I need like this.

Would CSG (Constructive solid geometry) help?

Is there any code example for this

1 Like