More 3D model formats support - SPM and glTF

Post Reply
User avatar
Worldblender
Member
Posts: 66
Joined: Tue Jun 30, 2015 22:12
GitHub: RQWorldblender
In-game: Worldblender

More 3D model formats support - SPM and glTF

by Worldblender » Post

After hearing about the news that the next Minetest version 5.5.0 will be using a custom fork of Irrlicht (the engine powering this game), I thought that this would make it easier for me to introduce new features and fixes. I don't have to worry about sending fixes to the upstream Irrlicht anymore, and it saves me of having to create one more account. With this out of the way, I have some more ideas that can be implemented, related to 3D model format support:
  • SPM (Space-partitioned mesh) - a custom format made for use with SuperTuxKart that mainly comprises of a GL vertex buffer. one of the main benefits over using the B3D file format is that SPM model files save more disk space compared to the B3D model format. They also have animation support, providing another alternative for modders who wish to use animated 3D models in their mods. Should such support be included in Minetest's Irrlicht fork, it will also be possible to use the tools at https://github.com/supertuxkart/stk-blender (SPM tools only) for creating 3D models, which can then be used in both SuperTuxKart and Minetest. I may be able to port the code over by myself, since it doesn't differ too much from the B3D loader found in SuperTuxKart itself.
  • glTF (Graphics Language Transmission Format) - a standardized JSON-based file format from the Khronos Group, being first released in 2015. The data for these model files can either be self-contained, or reference external files. There also exists a binary version of this format, with such files ending in '.glb'. More recent software (from 2015 onwards) is likely to support this format, and Blender 2.80+ has OOTB support for this format (B3D support is not OOTB; another exporter like https://github.com/joric/io_scene_b3d is required), reducing barriers for modders who wish to use animated 3D models in their mods. Implementing this support will require that the Minetest Irrlicht fork include a JSON parser (there already is jsoncpp, but that is for Minetest itself).

sfan5
Moderator
Posts: 4094
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

Re: More 3D model formats support - SPM and glTF

by sfan5 » Post

glTF support has been suggested already, though adding it would not have depended on switching to an Irrlicht fork as we did just now.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

twoelk
Member
Posts: 1482
Joined: Fri Apr 19, 2013 16:19
GitHub: twoelk
IRC: twoelk
In-game: twoelk
Location: northern Germany

Re: More 3D model formats support - SPM and glTF

by twoelk » Post

just wondering,
why does minetest restrict itself in the first place . . .
why not support as much as possible of what irrlicht allready supports out of the box on file formats.

bzt
Member
Posts: 217
Joined: Tue Sep 24, 2019 14:26

Re: More 3D model formats support - SPM and glTF

by bzt » Post

twoelk wrote:
Thu Mar 11, 2021 18:13
just wondering,
why does minetest restrict itself in the first place . . .
Because it's easier to handle (for both the developers and the content creators), easier to test, less chance to incorrectly load models, etc. etc. etc.



But if we're talking about new formats, you might want to take a look at Model3D. It is a very flexible and very efficient way of storing models. On its website, click on "Models" in the top right menu, then choose "Geometry" category, and model "Notre Dame". That's a voxel model, over half a million voxels stored in less than 18Kb. Check out "Models", "Characters", "Voxelhuman" too, that's a skeletal animated mesh model, only 3Kb, converted from aliveai's .b3d file (was 46Kb in .b3d format), storing all the information of the original.

It's extremely easy to integrate too, one stb-style header file (no libraries needed, except libc), configurable via defines. Its SDK is very well-documented, easy to use, and also provides C++ classes (but loading models is as simple as calling one C function, so that could be used as well in MTE.) It's also extremely optimized and fast, loading the ASCII Model3D variant is about 3 times faster than loading the same model with tinyobjloader, and about 10 times faster using the binary variant. An example viewer application is included, with that loading an extremely complex model over 2 million polygons ("Models", "Geometry", "SG Atlantis") is done within a blink of an eye, even on my old and slow computer.

The format can store everything that Minetest has ever used or might need in the future: voxel images, triangle mesh, skeletal animations, etc. Plus there's a command line tool to convert all the formats Minetest engine and mods have ever used: .obj, .b3d, .mts (and a lot more, .gltf, .glb models, .vox, .qb voxel images also supported as well as Minecraft Schematic files). Furthermore there's a Blender plugin to export animated models into .m3d, and it's implemented in Goxel voxel editor too natively. It was merged into assimp about a year ago, so all projects that use the assimp library can already load and save Model3D models. There are no surprises using this format, it's well-specified (every single bit is described and accounted for) and all documentation are freely available (unlike .b3d).

Of course, the format and the Open Source SDK is licensed under MIT so there's no probs there either.

It worth thinking about it if we're talking about new formats.

Cheers,
bzt

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests