Gltf point material

Is there a way to add point material to gltf model? I can’t seem to find a demo anywhere and failed trying to get it to work. Thanks

Maybe this SO answer will help:

You can also convert the glTF file to contain points in advance, and GLTFLoader will assign PointsMaterial accordingly. For example:

// convert.js
import { NodeIO, Primitive } from '@gltf-transform/core';

const io = new NodeIO();
const doc = io.read('input.glb');

for (const mesh of doc.getRoot().listMeshes()) {
  for (const prim of mesh.listPrimitives()) {
    prim.setIndices(null);
    prim.setMode(Primitive.Mode.POINTS);
  }
}

io.write('output.glb', doc);
node ./convert.js

1 Like