How subdivide GLTF model?

Hello everyone? . How to subdivide GLTF model?

        var subdivisions = 2;
        var modifier = new SubdivisionModifier(subdivisions);
        new GLTFLoader().load(
          function (gltf) {
            gltf.scene.traverse((o) => {
              if (o.isMesh) {
                o.geometry = modifier.modify(o.geometry);

TypeError: Cannot read property ‘length’ of undefined
at SubdivisionModifier.smooth

Can you share a sample jsfiddle or the model + entire error message?
Either the model is not loaded, or corrupted in some way, but there’s 12 occurrences of length in SubdivisionModifier.smooth so it’s hard to tell which part fails rn.

1 Like

See the example in SubdivisionModifier requires the legacy Geometry class, whereas most loaders create the newer BufferGeometry type. You may need to convert backward as shown there. In general it’s often best to do subdivision in a tool like Blender, rather than in your JS application.

1 Like