GLTFLoader: Extensibility


We are currently implement b3dm (a format that encapsulates glTF) support in our project and have encountered a few problems with the current GLTFLoader implementation.

We need to support addition attribute (batchid, used to identify the different objects packed in the geometry), extensions (CESIUM_RTC) and potentially additional uniforms. However, there does not seem to be any way to add these new features without modifying the GLTFLoader file itself.

So my question is: how to support the extensible nature of glTF? Do we contribute directly to the source and add the attributes/extensions/uniforms that we need? Or does the loader need to be modified so extensions can be “plugged in” without changing the source?

Related question: when loading glTFs in a scene rendered using a logarithmic depth buffer, the model’s shader are not modified to account for it, resulting in depth issues: I implemented a small hack to fix the problem. Should this process be added to the loader natively? Or could Three provide a helper function to patch the materials?

Author: Fantashit

1 thought on “GLTFLoader: Extensibility

  1. On a similar topic, I may need to postprocess some geometry before exporting to glTF. Would there be any interest if I proposed a similar extension mechanism for GLTFExporter?
    For instance I need to not export certain subtrees, and change materials to glTF-compatible ones. (If there is any interest I’ll follow up in a new issue of course. Don’t want to hijack this discussion.)

Comments are closed.