glTF implementation in progress

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
josiah_wi
Posts: 2
Joined: Fri Sep 22, 2023 8:30 pm

glTF implementation in progress

Post by josiah_wi »

Hello, I am a Minetest contributor who has been working on glTF support for their Irrlicht fork. I have been informed that upstream Irrlicht is already planning glTF support, so I'm here to see whether the work I've done is useful for upstream and how we can coordinate. My work on it has recently slowed down significantly because of other circumstances in my life, and I've had trouble finding people to pick up where I left off or review what I've done so far.
CuteAlien
Admin
Posts: 9929
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: glTF implementation in progress

Post by CuteAlien »

Hi, glad to hear it. Sadly there is nothing about that going on in upstream so far. I would be super interesting to have it - mainly to get a nicer Blender->Irrlicht pipeline.

And talking about that chronologicaldot mention recently he has already written an irrJSON (https://github.com/chronologicaldot/Irr ... il/irrJSON, also needs https://github.com/chronologicaldot/Irr ... il/irrTree). I haven't found time yet for more than a cursory view, so can't really say yet anything about it. Having JSON support in Irrlicht would probably help a bit...

But until 1.9 release (whenever that is), adding features is not too high on my list. Might make an exception for a working glTF loader.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
josiah_wi
Posts: 2
Joined: Fri Sep 22, 2023 8:30 pm

Re: glTF implementation in progress

Post by josiah_wi »

The implementation I started uses a third-party library (tinygltf) for the the parsing. Perhaps you don't want to introduce a dependency on that library, as it would bring in a dependency on nhlomann-json as well.
CuteAlien
Admin
Posts: 9929
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: glTF implementation in progress

Post by CuteAlien »

Well, having an external loader still is great!

Actually I thought a few times already about adding a new folder to Irrlicht about 3rd party library integration. Which would include code to use those with Irrlicht, but not the libraries (maybe some documentation how to get it working). That would also also make it easier to include samples for stuff like freetype, physics libraries or integration examples for things like qt or wxWidgets. And maybe also more loaders (for example I recently made a Sketchup loader for a job and guess they might allow me to open source that, while I obviously couldn't add the proprietary Sketchup API it uses to Irrlicht).

I can't tell if that's possible with glTF. But can also be a mix of - external loader + some feature-patches which it needs inside Irrlicht.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Virion
Competition winner
Posts: 2149
Joined: Mon Dec 18, 2006 5:04 am

Re: glTF implementation in progress

Post by Virion »

As far as I know, tinygltf is MIT license, shouldn't be a problem I guess? I see zlib, libpng, bzip2 etc. are included in the irrlicht repo.
My company: https://kloena.com
My profile: https://zhieng.com
My co-working space: https://deskspace.info
My game engine: https://kemena3d.com
CuteAlien
Admin
Posts: 9929
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: glTF implementation in progress

Post by CuteAlien »

More or less OK-ish, although the 3 you mentioned are basically the same license as Irrlicht (jpeglib would be closer to MIT license). But I don't like adding even more dependencies. Every additional lib tends to make maintainance harder (updating libs is the kind of work no one ever volunteers to do in his spare-time and also something I usually push away as long as possible). And with me having to do most maintainance by now I'd rather see it as external loader. As mentioned - adding a new folder for integration 3rd party stuff would be OK by me. I won't add the libs then (so not much additional maintainance work), but it would help people who need that to set it up.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Elevations
Posts: 28
Joined: Sun Jan 12, 2025 3:31 pm
Location: New Zealand

Re: glTF implementation in progress

Post by Elevations »

Did the minetest guys ever get glTF to work with the animations in irrlicht aswell? We either need this ^^ or FBX loading with animations in irrlicht, i am desperately trying to find a solution but at same time @CuteAlien since you are still working on irrlicht bug fixes and updating svn revisions i am hesitant to try implement my own loader with animations.
n00bc0de
Posts: 118
Joined: Tue Oct 04, 2022 1:21 am

Re: glTF implementation in progress

Post by n00bc0de »

The guy who added GLTF support made a video showing it off. Here is the link.
https://www.youtube.com/watch?v=V6mzoLjpPCU
chronologicaldot
Competition winner
Posts: 699
Joined: Mon Sep 10, 2012 8:51 am

Re: glTF implementation in progress

Post by chronologicaldot »

For future reference and downloading, here are the links to the gltf stuff:
https://github.com/jordan4ibanez/irrlic ... b/tinygltf
relevant files:
https://github.com/jordan4ibanez/irrlic ... f/json.hpp
https://github.com/jordan4ibanez/irrlic ... iny_gltf.h
irrlicht loaders:
https://github.com/jordan4ibanez/irrlic ... leLoader.h
https://github.com/jordan4ibanez/irrlic ... Loader.cpp

Some notes:

The json.hpp is required although it's a rather large file, or optionally rapidjson.hpp (which was not used in the project). It's probably more true to the JSON standard than mine is, and I notice it actually stores the accepted value types so you don't need to convert them.
The use of auto and C++11 features means it's not C++ version agnostic as Irrlicht is.

The usage of the json object (set as: using JSONDocument = nlohmann::json , the latter being from json.hpp) is primarily in function TinyGLTF::LoadFromString() on line 5494, and everything else that loads JSON just uses that function. This calls JsonParse(), line 1716, which calls json::parse(). I don't know anything about rapidjson to know how it differs from nlohmann::json and how they could be used interchangeably by tinygltf, but because both can be used, maybe there's a way to squeeze in a 3rd JSON reader?

If anyone has spotted another file missing from my above list that's also needed, please do tell.
Post Reply