Skip to content

Expectations for mesh indices: optional? auto-generated if not set? #720

@donmccurdy

Description

@donmccurdy

I've run into a user-reported issue in the glTF-Transform project, which supports both encoding and decoding glTF files using Draco compression: donmccurdy/glTF-Transform#280. The provided glTF file does not specify that any indices exist, which is the first time I've encountered that in a Draco-compressed glTF file. Indices are generally optional in glTF, but this case is ambiguous in the KHR_draco_mesh_compression spec. Despite the glTF file not referencing any indices, calling decoder.GetTrianglesUInt32Array does indeed return an array of ascending integers, i.e. the same result I'd get if we generated indices for an existing un-indexed mesh without merging vertices.

I'm hoping to understand the Draco library's expected behavior around indices. Reading the Encoding API documentation I'd previously assumed that calling AddFacesToMesh was required, and that you needed to generate an index list if you didn't already have one. Furthermore, compression (except sequential) may reorder and merge vertices — which would lead me to assume that even an originally unindexed mesh may be indexed after compression?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions