GLTF from DAE has more vertices that its DAE

I am trying to access the vertices of a .gltf model. Assuming there is one child I do it like this:

gltf.scene.children[0].children[0].geometry.attributes.position.array.length

This is were things get weird. The number of vertex coordinates are 179976, the itemSize 3, so there are 59992 vertices ?

My original .dae model has 29266 vertices (that is what meshlab says). How is it possible for the .gltf model to have more vertices ?

Is this normal ?

I am using this to convert from .dae to .gltf: https://github.com/KhronosGroup/COLLADA2GLTF

There are a lot of reasons that conversion from one format to another might change the number of vertices, this comes down to how the exporter is implemented. For example, flat normals might require vertices to be duplicated so that triangles don’t share the same vertices. Or the exporter might not support writing an ‘index’, in which case the number of vertices would change.

You can clean that up with tools like Blender, or BufferGeometryUtils.mergeVertices( geometry ). https://threejs.org/docs/#examples/utils/BufferGeometryUtils.

2 Likes

Ok thanks! I will try that !