manthrax/THREE-CSGMesh

Material Groups

supershwa opened this issue · 1 comments

I'm trying to figure out material groups.

If I subtract B from A, I'd like A to retain it's material however apply the material from B along the intersection, resulting in 2 materials on the new mesh.

I had a look at CSGStress.html but it shows a torus and not the screenshot shown in your readme.

Any thoughts on how I can achieve this? I've tried passing an array of materials, but the mesh "disappears" if I try this method.

Thanks in advance.

So the issue was my own fault. I didn't assign an index to fromMesh:

let a = CSG.fromMesh(obj1);
let b = CSG.fromMesh(obj2);

^ produced a mesh that only allowed a single material. Once I used:

let a = CSG.fromMesh(obj1, 0);
let b = CSG.fromMesh(obj2, 1);

I was able to use an array of materials which produced the results I wanted.

Thank you for building this!