Skip to content

gltfpack: EXT_mesh_gpu_instancing - support instance colors #946

@andredsm

Description

@andredsm

I have a glb model that uses EXT_mesh_gpu_instancing extension. Apart from TRANSLATION, ROTATION, and SCALE attributes, each instance has a single color for its entire surface (so, a color per instance) and this info is in _COLOR_0 attribute. When I run optimize the model with gltfpack, the _COLOR_0 attribute is stripped from the output model. I am aware that gltfpack removes unknown/custom extensions, but since custom attributes are supported by EXT_mesh_gpu_instancing extension, I think these attributes should not be removed.

As with vertex attributes, custom instance attributes may be prefixed with an underscore (e.g. _ID, _COLOR, etc.) and used for application-specific effects.

As result, the ThreeJS loads and renders my model as expected, but the colors are missing when using the optimized model:

models.zip

Command:
gltfpack -i input-model.glb -o output-model.glb

Input model rendered in gltf-viewer:

Image

Output model rendered in gltf-viewer:

Image

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions