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

Add a glTF2 scene exporter #885

Closed
fire opened this issue Dec 16, 2017 · 19 comments · Fixed by godotengine/godot#34193
Closed

Add a glTF2 scene exporter #885

fire opened this issue Dec 16, 2017 · 19 comments · Fixed by godotengine/godot#34193
Milestone

Comments

@fire
Copy link
Member

fire commented Dec 16, 2017

Describe the project you are working on:
3d multiplayer game

Describe the problem or limitation you are having in your project:
I wish to export my scene to a standardized exchange format.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
It would be useful to expose an engine api for a scene exporter. The ideal case is that we can click on a scene and then export it as a gltf2 file.

It may not be possible to be lossless exporting from scene to gltf2 and back to scene, but it would be helpful for these cases:

  • Easy export to sketchfab
  • Easy export to blender
  • Storing scenes in a standard format that can be sent to another engine / renderer / future godot version.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

This is a description of the architecture of the gltf plugin at https://github.com/godot-extended-libraries/gltf.

I split the importer into a glTF2 document and an importer. This allows us to modify the document to be a exporter.

This also allows for extensions through #1463 for import and export.

PRs:

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

Have to port 3000 lines of core module code to gdnative because it includes the importer code too.

Is there a reason why this should be core and not an add-on in the asset library?:
Core code is large and I do not want to duplicate it. This moves the gltf2 importer into a doument and two plugins (import and export). If I make the gltf2 exporter a GDNative plugin which is possible, I can't do this without duplication. glTF runtime import is also a requested feature from the community and also export.

Older Proposal

Click for the old proposal.

@reduz I require a Scene Exporter api exposed to gdnative. Importing scenes has a large dialog of options, so would exporting scenes.

<iFire> reduz: is roundtrip from godot to gltf2 part of the roadmap? 
<reduz> iFire: not really
<Calinou> why would you want to export glTF from a game engine?
<Calinou> unless we get a level editor…
<iFire> Calinou: why not?
<Calinou> then it would start making *some* sense
<Calinou> (and not that much)
<iFire> Calinou: well it just feels more proper to import any format and then export as gltf2. A) I can then put it in sketchfab B) Save a copy of the scene in gltf format because it's changed now
<iFire> C) move the scene to another game engine ;)
<Calinou> again, it's not relevant until we get a level editor
<iFire> I thought the scene editor is a level editor
<Calinou> once we have that, it has one main use: making renders in Blender or similar. Only really high-end games can afford this, so it is probably not a priority at all
<Calinou> it is not quite one. it doesn't let you create actual geometry using a GUI (CSG or similar)
<iFire> I don't care about, that's a workflow thing
<Calinou> also, remember that Godot and Blender materials are not fully compatible anyway
<iFire> some people use csg others use models
<Calinou> Eevee should be mostly similar, but you're going to have to wait 5 years until most people use it :/
<iFire> Calinou: but gltf is a workable process for standardizing the import
<iFire> there are blender import pipelines for gltf2
<Calinou> how good are the importers, too?
<iFire> https://github.com/ksons/gltf-blender-importer <-
<iFire> apparently the importer and exporter are different projects
<iFire> Calinou: anyways for my use case I don't need to go all the way to blender
<Akien> Well I think it would be nice to have a gltf2 export feature as a plugin, someone just needs to write it
<iFire> Akien: Can you expose the apis?
<Akien> There is no huge use case, but it's still nice to have. I like the idea to export a 3.1 scene as gltf2 and import it against in Godot 8
<iFire> I don't know what I need
<Akien> iFire: Then how would I know? :p Best would be to start and see what you are missing.
<Calinou> GDScript would be too slow for this, probably
<Calinou> (for large scenes)
<Akien> I don't think so.
<Akien> Blender's plugins are in python :)
<iFire> Akien: I was able to get a fbx importer but the gdnative interace has a bug with the import plugin and scanning for the fbx extension. karroffel is on it.
<Calinou> do remember that Godot isn't a 3D DCC, it stores vertices and everything differently
<iFire> Calinou: I don't see how it's impossible
<iFire> those are only things that make it more difficult
<Calinou> is it worth spending time on right now?
<iFire> I might spend time for fun :)
<iFire> or I can make a game lol
<Calinou> I don't find that task particularly fun
<Calinou> I'd find new renderer features funnier
<Calinou> or, you know, a 3D level editor

@reduz
Copy link
Member

reduz commented Dec 16, 2017 via email

@Gibbz
Copy link

Gibbz commented Dec 22, 2017

it could be handy to be able to export snapshots of the game in progress scene as a gltf scene also for artists

@garyo
Copy link

garyo commented Apr 3, 2018

I'd be interested in this. @fire, did you make any progress on it?

@fire
Copy link
Member Author

fire commented Apr 4, 2018

I have not done any work feel free to take over. Wanted to write down the concept.

@garyo
Copy link

garyo commented Apr 10, 2018

Just FYI, I'm working on this now. Doing it in python. No glTF lib, just creating a big python dict and saving as JSON, with binary blobs coming from int/float python arrays. Textures are a hangup due to godotengine/godot#18109 and there are lots of little details to get worked out before it's done.

@supagu
Copy link

supagu commented Jun 1, 2018

Any progress on this?
Would be super handy to be able to bring a in game scene into blender for some beauty/marketing renders!

@garyo
Copy link

garyo commented Jun 1, 2018

My python version is at https://github.com/garyo/godot-export-gltf, in case it's useful to anyone.

@Zireael07
Copy link

Bump, any news on this?

@jonbonazza
Copy link

I think doing this in gdscript vs godot-python would be better. Making someone install godot-python seems a bit ridiculous.

@fire
Copy link
Member Author

fire commented Apr 20, 2019

I was able to complete work exporting GLTF2:

  1. MeshInstances
  2. GridMaps
  3. CSGShapes

Materials don't work, neither do animations or skeletons.

godotengine/godot#19232 (comment)

The GLTF2 scene exporter code needs to be extracted into a module before it is mergable into Godot.

This is all the time I can spend it on this weekend.

Looking for contributors.

@fire
Copy link
Member Author

fire commented Apr 20, 2019

Here's the github branch:

https://github.com/fire/godot/tree/mesh_export

@fire
Copy link
Member Author

fire commented Apr 20, 2019

2019-04-20_07-19-01

Here's a picture of the TPS scene exported to GLTF.

@Toshiwoz
Copy link

Thank you for this really desirable feature.
Awesome that you included also gridmaps.

@golddotasksquestions
Copy link

There is no huge use case, but it's still nice to have.

I'd like to state that there is indeed a huge usecase for this for all level designers. It would mean they could test and block out levels within Godot using primitives and CSG Meshes and only once they are happy how it plays in game export it to a 3D modeling package for refinement. It would also mean anything generated in realtime could be used outside of Godot. I'm actually surprised it's considered just a "nice to have".

@eon-s
Copy link

eon-s commented Oct 25, 2019

@golddotasksquestions you are quoting something from 2 years ago, now if you check the WIP PRs, there is work towards more than just CSG, full scenes may be able to be exported soon to a couple of formats.

And this issue may need to be closed and a another opened on the proposals repository with a summary of the current state of the PRs.

@fire fire transferred this issue from godotengine/godot May 25, 2020
@hansagames
Copy link

Any progress on this ? :)

@fire
Copy link
Member Author

fire commented Sep 19, 2020

I've updated the proposal and started a pr chain on Godot Engine master.

@wajrou
Copy link

wajrou commented Jan 6, 2021

Any progress on exporting to blender through glTF2? :-)

@Calinou
Copy link
Member

Calinou commented Jan 6, 2021

Any progress on exporting to blender through glTF2? :-)

This is now implemented: https://godotengine.org/article/introducing-the-godot-gltf-2-0-scene-exporter

The feature will only be available in Godot 4.0, not 3.2.x.
Edit: The gltf module was backported from 4.0 to 3.x, making the feature available in Godot 3.4 and later. Check the Project > Tools menu at the top of the editor 🙂

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

Successfully merging a pull request may close this issue.