HeapsIO / heaps

Heaps : Haxe Game Framework
http://heaps.io
MIT License
3.19k stars 337 forks source link

[Proposal] Add support to GLTF model format #611

Open Yanrishatum opened 5 years ago

Yanrishatum commented 5 years ago

First section is more a reasoning as to why I even do this proposal, for tl;dr; - see actual proposal.

As we know, FBX is very thoroughly documented and effortless to use format, that doesn't cause any issues to us regular people from community. /sarcasm While FBX->HMD conversion works fine enough, I can't say it's easy to setup and when it comes to animations, it gives a lot of headaches not only when using Blender, but also Autodesk software. While discussing how we love FBX format with @nspitko, he pointed out an GLTF scene/model format and said maybe it's worth adding an imported for better documented format. After taking a quick look, it seem to be pretty reasonable to add GLTF importer as alternative source format that would require less hassle to export, have actual specification and not "we guess it works that way" from Blender guys, as well as one that have pretty wide support of editors and tools.

GLTF format info: https://www.khronos.org/gltf/

Proposal:

  1. Add GLTF format reader akin to FBX.
    • A) We can write our own reader.
    • B) Make whole support of it opt-in by adding haxe-gltf library
    • C) Make it two-stage, with library as proof-of-concept and then adding built-in support if it will prove practical.
  2. Implement GLTF->HMD converter
  3. Provide documentation on how to get export going in wiki.

Main challenges I expect as of now and other notes:

P.S.: If there are going to be objections, please don't use "FBX works just fine", it bloody doesn't. It's a pain to use, especially when using Blender, and there is quite a few of people in Discord channel that would back me up on that. :)

Yanrishatum commented 5 years ago

Upon further inspection, it (as actually expected) is much more complicated.

ncannasse commented 5 years ago

Yes I think than trying to convert glTF to HMD would result in several problems and complify things without much gain.

So yes abstracting the Model Library seems the right abstraction point here.

Regarding PBR it's not a big problem: we use Metalic-Roughness in engine, just our roughness maps are in glossiness format by default, but that's just some different shader to inject when doing the decoding from textures, see https://github.com/HeapsIO/heaps/blob/master/h3d/shader/pbr/PropsTexture.hx