External Publication
Visit Post

Adding full support for custom materials to GltfLoader

jMonkeyEngine Hub April 1, 2026
Source

theMinka:

Btw, GltfLoader already has some public configuration methods (e.g. registerExtension(...) and registerDefaultExtrasLoader(...)) that are practically inaccessible.

Yeah, those are static because they have to be available at loader instantiation time.

    public static void registerExtension(String name, Class<? extends ExtensionLoader> ext) {

And that’s how unlit materials are handled.

theMinka:

Custom materials should be completely independent from jME3’s standard materials. This means they can use different material definitions and parameters.

If this is just about loading a regular GLTF with a different material then I think the only way would be to replace the existing GltfLoader with your own (which could be a subclass if you want most of the behavior and then override createMaterial()).

Else there would have to be something about the gltf file that signaled the customization… or you’d pass it in the AssetKey (which could also be custom) if it needs to be something set per model.

Discussion in the ATmosphere

Loading comments...