Why does a list of materials result in nothing being shown?

    let x = new THREE.BufferGeometry().setFromPoints([[0,0,0],[0,1,0],[1,0,0],[1,1,1]].map(([x,y,z]) => new THREE.Vector3(x,y,z)));
    x.setIndex([0,1,2,0,1,3,0,2,3,1,2,3]);
    x.addGroup(0, 2, 0)
    x.addGroup(2, 2, 1)
    let mesh = new THREE.Mesh(x, "red blue".split(" ").map(x => new THREE.MeshBasicMaterial({ color: x, side: THREE.DoubleSide })));
    scene.add(mesh);

I run this code and nothing happens. Nothing is rendered but no errors either.

If I replace the list of materials with a single material using a single color, then it works. Then, it does show up on the screen.

Why does using a single material work, but a list doesn’t?

try

x.addGroup(0, 3, 0)
x.addGroup(3, 3, 1)

Example,

1 Like