Skip to content

Handling of glTF extensions (used or required) #2617

@javagl

Description

@javagl

There are a few open issues related to glTF (most of them opened by @stephengold , so I hope it's OK to tag here). Some of these issues are probably plain bugs (and I'll try to have a closer look at them soon). But there is an overarching question about how to handle glTF extensions.

In glTF, extensions are declared at the top of the glTF json. And as described in 3.12. Specifying Extensions, these declarations fall into two categories:

  • All extensions that are used must be declared in extensionsUsed
  • All extensions that are required must be declared in extensionsRequired

This is pretty straightforward (skipping philosophical discussions about what "required" means).

The main point from the view of a loader is:

When there is an unsupported extension in extensionsRequired, then the loader should probably reject loading the asset.

(The loader could still try to load it, but it could crash and burn arbitrarily, so this is not recommended)

A specific example where this is relevant:

The issue #2385 boils down to a NullPointerException. Under the hood,, this is caused by the EXT_texture_webp extension not being supported by jME. This could be derived from

  "extensionsRequired": [
    "KHR_texture_transform",
    "EXT_texture_webp"
  ],

and the loader could respond with a somewhat clean AssetLoadException that explicitly says:
"The asset could not be loaded, because it requires the 'EXT_texture_webp' extension, which is not supported"


An aside: The issue refers to an asset that uses the KHR_materials_sheen extension. This is also not supported. But this extension is only in the extensionsUsed:

  "extensionsUsed": [
    "KHR_materials_specular",
    "KHR_materials_sheen",
    "KHR_texture_transform",
    "EXT_texture_webp"
  ],

This means that the asset could still be loaded by jME (even though it would likely not look perfect). If the goal of the issue was to talk about support for KHR_materials_sheen, then this should be a dedicated issue (with the name of that extension in the title), and probably a pointer to the asset at https://github.com/KhronosGroup/glTF-Sample-Assets/tree/a4c33332cfe67130a9e005bc9f5e603f9f86b1c8/Models/CompareSheen which is a simple test that only uses this extension, intended for feature comparisons/tests in renderers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions