I have two objects of different colors on stage and I need to combine them into one if they overlap each other. In 3d modeling there are boolean operations.

  • Union (connection of objects into one).
  • Intersection (only common parts of the source objects are included in the boolean object).
  • Exception (cut). And I need to write such a thing.

+ ------- + + ------- +

| | | |

| A | | |

| + - + ---- + = | + ---- +

+ ---- + .. + .... | + ---- + |

| ... B ... | | |

| ....... | | |

+ ------- + + ------- +

Although I woke up this morning and thought that for sure there is a library that can help implement such functionality. Came across csg.js.

I study WebGL and I don’t know how to implement this functionality. I can not find any information on this topic.

  • Try to write more detailed questions. Explain exactly what you see the problem, how to reproduce it, what you want to get as a result, etc. - Nicolas Chabanovsky
  • you actually found a suitable library that would help you (csg.js). Try to use it by reading the documentation and understanding it - the bare webGL API will not help you much. - ampawd

0