Manifold - three.js Example

This example demonstrates interop between Manifold and Three.js with minimal code - please open dev tools to inspect the source. Here we generate two multi-material Three.js meshes and convert them to Manifolds while building a mapping from material to Manifold ID. Then Boolean operations are performed on the Manifolds and the result is converted back to a Three.js mesh using the material mapping. The input cube has half red faces and half normal-shaded, while the icosahedron has half blue faces and half normal-shaded. The resulting mesh has three materials, since one (normal-shaded) was common between the input models.

A slightly more complex example involving our library for GLTF import/export and <model-viewer> can be found here.