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

Make GLTF (and possibly other) imports available in runtime #2509

Closed
BastiaanOlij opened this issue Mar 26, 2021 · 3 comments
Closed

Make GLTF (and possibly other) imports available in runtime #2509

BastiaanOlij opened this issue Mar 26, 2021 · 3 comments

Comments

@BastiaanOlij
Copy link

BastiaanOlij commented Mar 26, 2021

Describe the project you are working on

Implementing OpenXR support for Godot

Describe the problem or limitation you are having in your project

OpenXR supplies controller models as GLTF (GLB) data. These are totally dependent on the runtime the end user uses to play their game with and are thus not available during development but supplied when the game is started.

As the GLTF import code is only available in the editor the only option left is to duplicate the entire importer as part of the plugin (or in core for Godot 4)

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The idea here is to move the importer code in a more general location. The editor will use it as before but in runtime it would now be possible to load external GLTF files.

There are two more changes needed here:

  • there is never a file involved, the GLTF data is held within a memory variable so the importer needs to be able to work with a memory stream
  • there is no need to first save the imported data into scene and mesh files to then be reloaded.

This would also solve problems for people working on online games where models could be supplied by the server.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

See section above

If this enhancement will not be used often, can it be worked around with a few lines of script?

This is critical to any OpenXR application and without the functionality available in Godot the only option is to duplicate the GLTF loader.

Is there a reason why this should be core and not an add-on in the asset library?

This is critical for VR to work out of the box.

@fire
Copy link
Member

fire commented Mar 26, 2021

To clarify, the simplest version of this api would be getting an in-memory buffer, parsing it into the existing in-memory document format and then doing things with it, like using meshes with transforms, hierarchies and skeletons for display or saving to disk. The mirror for export too.

The api needs to be available during the game.

Godot has two separate universes for buffer based (network) and file based things which is confusing and bad. So we require an api that takes a File and another api that takes a StreamPeerBuffer. The file based api is here. The stream peer buffer api is missing.

https://github.com/godotengine/godot/blob/c6b9ceadf2d2c220acdb4081e488c13de9d5f52c/modules/gltf/gltf_document.cpp#L6350-L6367

There's also dependencies on the EditorSceneImporterMesh and EditorSceneImporterMeshNode class, which we can expose to the game.

The proposal by Reduz of implementing the gltf importer/exporter as an extra gdnative/module plugin is doable but isn't attractive to game developers.

Hope that helps.

@BastiaanOlij
Copy link
Author

The proposal by Reduz of implementing the gltf importer/exporter as an extra gdnative/module plugin is doable but isn't attractive to game developers.

The problem implementing this as a plugin for me is that you suddenly have core functionality dependent on a plugin. That does not make sense.

@Calinou
Copy link
Member

Calinou commented Mar 26, 2021

Duplicate of #1632. Please post your findings as a comment there 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants