Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B3D JSON #14040

Closed
jordan4ibanez opened this issue Nov 26, 2023 · 7 comments
Closed

B3D JSON #14040

jordan4ibanez opened this issue Nov 26, 2023 · 7 comments
Labels
Feature request Issues that request the addition or enhancement of a feature Won't add The feature request was rejected and will not be added.

Comments

@jordan4ibanez
Copy link
Contributor

Problem

We have B3D binary only format with a complex binary file encoding. It does the job but it's very complex to work with. This is a heavily outdated format and the standard is basically whatever the Minetest engine says it is.

Solutions

I have studied the available documentation on this. It appears that everything that can be inside of a B3D file can be represented by a JSON file. A loader for this would be probably a magnitude easier to implement into the engine for the time being as a holdover while we're waiting for upstream Irrlicht to solve GLTF implementation. This solves a few problems:
1.) It makes B3D much easier to work with as a modder, you can more easily generate B3D files.
2.) It makes B3D extremely easier to work with as an extension developer. We can more easily bolt on importer/exporters into programs such as blender/maya/blockbench.
3.) It makes it so developers can completely skip using a modeling program and they can actually hand code their models if they so desire.

Alternatives

I mean there really aren't any alternatives

Additional context

I just spent 3-4 days trying to make a triangle appear in the minetest engine https://github.com/jordan4ibanez/minetest_b3d when I've written entire portions of game engines in rust faster than this horrific binary format has taken me to go nowhere. This idea came to me randomly, but I am glad it did.

@jordan4ibanez jordan4ibanez added the Feature request Issues that request the addition or enhancement of a feature label Nov 26, 2023
@jordan4ibanez
Copy link
Contributor Author

I have taken inspiration from Luatic in his beautiful example on the B3D format specification to create a sample example of what this could look like:

{
  "format": "BB3DJSON",
  "version": 1,
  "NODE": {
    "position": [0,0,0],
    "scale": [1,1,1],
    "rotation": [1,0,0,0],
    "MESH": {
      "brush": -1,
      "VRTS": {
        "flags": 0,
        "data": [
          0,0,0
        ]
      },
      "TRIS": {
        "brush": -1,
        "vertices": [
          0,1,2
        ]
      }
    }
  }
}

Of course, this can be minified etc. This is simply a readable version of it. The goal is to be as open as GLTF, but to allow progression in the existing format and engine implementations.

If you would like to see Luatic's spec: https://github.com/appgurueu/modlib/blob/master/doc/b3d_specification.txt

@rubenwardy
Copy link
Member

Thanks for the suggestion. We plan on deprecating (as in, no longer recommending the use of) b3d in the future, makes no sense to work further on it. Development efforts should be focused on glTF

@Pantyhose-X

This comment was marked as off-topic.

@appgurueu
Copy link
Contributor

Sorry, but I don't think this is a good idea. There are two crucial reasons for (keeping the) binary format:

  • It's what the current tools support (Minetest clients and servers, Blender exporter, modlib)
  • People already complain about lack of compression and space inefficiency of B3D. Using JSON would magnify that problem.

It's also not that hard to convert to/from binary from JSON yourself; it does not require engine support. I can write you a JS/TS library for that by porting modlib's b3d reader and writer if you need it.

@Des-Nerger
Copy link

Des-Nerger commented Nov 26, 2023

@appgurueu, don't forget: glTF doesn't imply JSON/ASCII, it can be binary too: .glb.
UPD: Oh, sorry. I thought you were commenting on @rubenwardy's.

@appgurueu
Copy link
Contributor

@appgurueu, don't forget: glTF doesn't imply JSON/ASCII, it can be binary too: .glb. UPD: Oh, sorry. I thought you were commenting on @rubenwardy's.

Yeah, I know, I'm just discussing the proposed B3D format here, not glTF. (It should also be noted that even "text" glTF contains base64-encoded binary buffers, presumably also for (space) efficiency reasons.)

The main problem that seems to be currently slowing down our "in-progress" glTF adoption is the complexity of glTF; any PR that properly solves this issue will probably have some kloc in diffs spanning both this repo and our Irrlicht fork.

We could consider adding zlib compression on top of B3D and OBJ in the meantime.

@rubenwardy rubenwardy added Won't add The feature request was rejected and will not be added. and removed Possible close labels Nov 26, 2023
@rubenwardy rubenwardy closed this as not planned Won't fix, can't repro, duplicate, stale Nov 26, 2023
@AligatorBkmz
Copy link

There is already a parser for blender 2.8. I made a fork to convert to JSON and B3D
https://github.com/AligatorBkmz/b3d_to_json
One single module B3DParser.py is used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Issues that request the addition or enhancement of a feature Won't add The feature request was rejected and will not be added.
Projects
None yet
Development

No branches or pull requests

6 participants