Search Unity

Unity support for the glTF format by default (to replace Collada and FBX)

Discussion in 'General Discussion' started by Linkooo, Oct 8, 2017.

  1. Linkooo

    Linkooo

    Joined:
    May 16, 2016
    Posts:
    29
    glTF or glb in his binary version is in his version 2.0 a new open source file format that allow you to export your game asset with his lods and animations like the FBX, but it has also the advantage of being open sourced so it can be easily implemented, it supports the Disney's Principled PBR and it be packed with your textures and materials and will automatically append and plug your textures, so you will get the exact same result across all applications.

    Here are the 3 versions that exist:
    glb: the most interesting, this is the binary version, it is lightweight and directly readable by the GPU, it includes your PBR node materials, textures, LODs, animations
    glTF embedded: includes everything but it is a text file
    glTF + separated textures: the maps are exported separately but they are still appended automatically to your material(s)

    Godot 3.0 uses it by default and explain why it should be the industry standard and the issues with FBX: https://godotengine.org/article/we-should-all-use-gltf-20-export-3d-assets-game-engines

    The Khonos Group gives also informations about this file format: https://www.khronos.org/gltf

    This file format is available on GitHub for Unity users: https://github.com/KhronosGroup/UnityGLTF
    But for Unity users it's a bit complicated for an average user to compile it and can be unstable.

    Since the bad news about the collaboration between the closed Autodesk FBX and Unity, Autodesk will be able to impose their own specifications, closed technologies in the game art workflow and even delay the compatibly with alternative file formats. This will still be undocumented and the sources closed for other 3D modeling software in order to make it discouraging to develop and continues to break (it's the goal of Autodesk to sell more Maya LT). Also the license isn't compatible with some Open Source projects.

    We need an open format for game art, easy to integrate in a modeling, painting and game engine this has been asked for many years. Collada wasn't built for that but now the Khronos Group has made a new format open and dedicated for PBR games.
     
    Last edited: Jan 14, 2019
  2. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Unity 2017.2 is already in release candidate phase and 2017.3 in beta. I would not expect support for such file format until 2018.x, if it's popular enough by then.
     
    JamesArndt likes this.
  3. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,190
    Why do people keep pointing towards this engine as if we need to pay attention to the decisions it made? Last I checked it was a no name game engine developed by a no name organization and used by no one of any real note.
     
    thelebaron, Glader, Mallik29 and 3 others like this.
  4. Linkooo

    Linkooo

    Joined:
    May 16, 2016
    Posts:
    29
    We started to speak about Godot since the reveal of the version 3 in mid-august 2017.

    I have noticed that Unity helped to develop the glTF format, so I have part of my answer: yes it will be added to Unity. I hope in the release following the 2017.2.
     
    bargas_unity likes this.
  5. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,190
    Last edited: Oct 8, 2017
  6. cyberpunk

    cyberpunk

    Joined:
    Mar 20, 2013
    Posts:
    226
    I like the idea of glTF, but it's still early days. Many 3d modeling packages don't even support it yet. It would be premature to replace FBX, without solid asset pipeline support. However, it would be great if more software *did* support it, so I do agree Unity should add this eventually (but certainly not as a replacement for FBX).
     
  7. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    You mean , why they think it should be the industry standard.

    While it is true that FBX is a bad format, last time I looked at gltf I was very unimpressed.
    To put it bluntly, it was heavily tied to OpenGL, to the point where it used OpenGL enums and allowed embedding of glsl shaders.

    This is not a good way to go about it.

    Also, in this iteration:
    https://github.com/KhronosGroup/glTF-Blender-Exporter/blob/master/docs/user.md
    They introduced metallic shader support (good), but failed to provide support for blender's principled BSDF (bad).

    By the way, nothing stops you from adding custom importer for gltf or hiring someone to do that.
     
    Kiwasi likes this.
  8. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,561
    If they want gltf to be a hit, I think they should give it a simpler name. I read it as gitf because of the mixed case, and it doesn't roll off the tongue - FBX by comparison is a lot sexier I think and part of its marketing appeal. I'm guilty myself of using complicated names for my work (Nimian Legends : BrightRidge is a mouthful) so it's just an observation.
     
  9. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    While I think there exist already too many formats, I agree that I don't want FBX to stay the defacto standard. A good truly open format would be much better.

    Principled BSDF is still rather new, like available for less than 2 months in a stable release I think.

    Make file formats great again!
     
    protopop likes this.
  10. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,442
    ekergraphics likes this.
  11. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    joshcamas and Linkooo like this.
  12. 3agle

    3agle

    Joined:
    Jul 9, 2012
    Posts:
    508
    OTOY are doing work with Unity relating to glTF in terms of streaming for their Light Field tech Link. When that happens I imagine glTF may be added to Unity, but that is speculation and it's not exactly a direct correlation between the planned feature use and what is being discussed in the OP. This currently looks to be in dev as an ORBX to FBX conversion currently (https://unity.otoy.com/features/), but theoretically I would guess glTF could handle this.
     
  13. OTOY

    OTOY

    Official Otoy Account

    Joined:
    Apr 2, 2017
    Posts:
    31
    We did add support for glTF 1.0 I/O in the latest ORBX spec (and also FBX to get bones/skinning). We'll be looking at glTF 2.0 support, but glTF is not cinematic (can't do sub-div) like Alembic or FBX, so it cannot be a full replacement for those formats in ORBX scene system.
     
    IncomeCountry, wccrawford and VWGoA like this.
  14. jgwinner

    jgwinner

    Joined:
    Dec 21, 2016
    Posts:
    19
    Couldn't import/export just be added as a plug-in? Seems like the easiest way to get it out, even if not included in the official Unity binaries. Then it could be loaded in the store.

    I see 3 asset store assets (say that three times fast) that mention gltf, but they are all for pay.

    == John ==
     
  15. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    You can create meshes in scripts and save them as project assets. So import could be added as a plugin that opens an gltf file reads it and creates a mesh out of it. Export too.

    The more difficult part would be properly integrating gltf so it works the way like current fbx importer does. This may be more difficult, but might be possible using the AssetPostProcessors/etc.
     
  16. anarhist1994

    anarhist1994

    Joined:
    Sep 27, 2016
    Posts:
    32
    I'm using the glTF Unity3D Loader. I want to load some 3D Objects with glTF format in real time. With the glTF files they included in the examples, it works great. But when I try to load my 3D Object I'm getting this error:

    Does anyone know how can I approach this?

    Error:
    Code (csharp):
    1.  
    2. Exception: Invalid array at: buffers
    3. GLTF.Extensions.JsonReaderExtensions.ReadList[Buffer] (Newtonsoft.Json.JsonReader reader, System.Func`1 deserializerFunc) (at C:/Users/johnmce/Documents/GitHub/UnityGLTF/GLTFSerialization/GLTFSerialization/Extensions/GLTFJsonExtensions.cs:50)
    4. GLTF.Schema.GLTFRoot.Deserialize (System.IO.TextReader textReader) (at C:/Users/johnmce/Documents/GitHub/UnityGLTF/GLTFSerialization/GLTFSerialization/Schema/GLTFRoot.cs:151)
    5. GLTF.GLTFParser.ParseString (System.String gltfContent) (at C:/Users/johnmce/Documents/GitHub/UnityGLTF/GLTFSerialization/GLTFSerialization/GLTFParser.cs:123)
    6. GLTF.GLTFParser.ParseJson (System.Byte[] gltfBinary) (at C:/Users/johnmce/Documents/GitHub/UnityGLTF/GLTFSerialization/GLTFSerialization/GLTFParser.cs:40)
    7. UnityGLTF.GLTFSceneImporter+<Load>c__Iterator0.MoveNext () (at Assets/UnityGLTF/Scripts/GLTFSceneImporter.cs:124)
    8. UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
    9.  
     
  17. arumiat

    arumiat

    Joined:
    Apr 26, 2014
    Posts:
    321
    Any more news on this?
     
    Flurgle likes this.
  18. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    We are also monitoring this, as the FBX situation is really terrible.

    Exporting from 3D Studio Max, we can occasionally have two different results when importing it into either Blender or Unity.

    Autodesk have abused their dominant market position for too long...
     
    NotaNaN, joshcamas, Linkooo and 4 others like this.
  19. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Why are you importing into blender from Max?
    I've seen several posts from artists having issues with blend shape normals coming from Maya which sucks for those devs.
    But since 2013 fbx has been consistently stable coming from Max.
    I just want it updated to include joint angle deformers (joint angle constrained blends).
     
  20. JeremiahJ

    JeremiahJ

    Joined:
    Nov 1, 2016
    Posts:
    28
    @OTOY can you go into a small amount of detail on what you mean by "can't do sub-div" please?
     
  21. JeremiahJ

    JeremiahJ

    Joined:
    Nov 1, 2016
    Posts:
    28
    GlTF is done this way so that no processing is required for the GPU to consume the model data. It is already in a format that the GPU can consume directly. That is the design goal, anyway.

    That doesn't matter a lot when you import glTF into Unity first, but it should make the import process into Unity faster than FBX.

    It will matter a lot more when/if graphics cards load files directly. Maybe they already do, I don't know a lot about how GPUs work.
     
    IncomeCountry likes this.
  22. developersice

    developersice

    Joined:
    Nov 25, 2016
    Posts:
    36
    Keeping an eye on this too - would be very interested in support for it during 2018 versions
     
  23. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    We're working with glTF here for Chipmunk, and created a ScriptedImporter for Unity. It's not natively supported yet of course, but we did actually contribute this importer to the upstream Khronos repo for glTF support in Unity.

    Some folks at Unity are aware of the repo, and while I don't know of any plans here, we very much believe in this format and I'm always happy to contribute to that discussion.

    Check it out here:

    GLTFImporter.cs
    Repo: https://github.com/KhronosGroup/UnityGLTF
     
    NotaNaN, Linkooo, noemis and 4 others like this.
  24. JeremiahJ

    JeremiahJ

    Joined:
    Nov 1, 2016
    Posts:
    28
    I suspect Khronos' repo will be "the" official glTF importer once it has full support for editor and runtime import & export of glTF files. My own interest in glTF is strong, however after writing a parser for an ASCII format of the CAD files we use at work, I realized I didn't need to convert to glTF before import into Unity -- I could just import directly into Unity with a C# script.

    Now I'm importing thousands of meshes into the AssetDatabase. And, let me tell you, the AssetDatabase is extremely slow. I can't even fathom why inserts into this database/library take so long. The Java code I wrote to do the same parsing, in the same way, on the same files, into glTF models, converts several meshes per second. In Unity, it's several seconds per mesh because of the AssetDatabase.
     
    Last edited: May 4, 2018
  25. recursive

    recursive

    Joined:
    Jul 12, 2012
    Posts:
    669
    The AssetDatabase is effectively ancient (and mostly single-threaded!). I know that multi-threaded import is something they've discussed but it's not concrete on what the status of that is (and I expect the upcoming asset bundle improvements and data-less player to get the priority).
     
  26. JeremiahJ

    JeremiahJ

    Joined:
    Nov 1, 2016
    Posts:
    28
    Yes, it is clear to me now that the AssetDatabase is to be avoided, at least at the scale I am attempting to use it. AssetBundles are the way to go.

    Anyway, YAY GLTF! It's a great format and I look forward to the day it has proper support in Unity.
     
    recursive likes this.
  27. jessevan

    jessevan

    Joined:
    Jan 3, 2017
    Posts:
    35
    glTF is a transmission format, so I think its use cases are more comparable to unity asset bundles than to FBX. I don't know of any 3D packages that export Unity asset bundles.
     
  28. Siccity

    Siccity

    Joined:
    Dec 7, 2013
    Posts:
    255
    First time messing with this format and I'm in absolute support.
    I have a few beefs with it though, and that is mainly around marketing. The name is a disaster. It's easily forgettable and doesn't roll well nor does it look nice on paper. That, and the fact that i they're trying to market it as the "JPEG of 3D".
    Apart from that, I think it looks amazing.
    I'm also interested in seeing if it has a future as a graphics interchange format.
     
  29. JeremiahJ

    JeremiahJ

    Joined:
    Nov 1, 2016
    Posts:
    28
    Well, they aren't going to change the name. It's glTF and that's it. I would not trust the format if it intentionally chose a catchier name, anyway. xX_420_BEST_3D_FORMAT_69_Xx is not a good name for a graphics format, for example. "OBJ" sucks as a name and it's supported everywhere.

    The name doesn't bother me in the least, and the format has real merit now that the 2.0 format has removed all of the narrow definition that was intended with 1.0. It's really hard to describe just how lovely it is when a model format doesn't have a way to define units, for example. The model's unit is the meter, and that's it. The model's coordinate system is right-handed, Y-up, and that's it. No changing it, so just deal with it. Things like that make writing converters and parsers much easier, and they make adoption that much easier. There are a whole class of problems that you just don't have to worry about when you make those decisions for a graphics interchange format.

    They could phrase "the JPEG/PNG of 3D" better, though, for sure. I get what they're trying to say, and there must be a better way to say what they're trying to say, there. I don't know. I'm a software developer so I'm garbage at naming things.
     
    jessevan likes this.
  30. JeremiahJ

    JeremiahJ

    Joined:
    Nov 1, 2016
    Posts:
    28
    with glTF 1.0 that was the case, certainly; it was defined to be solely a transmission format in version 1.0, I believe.

    glTF 2.0 changes that. You don't HAVE to store your data in a format that is simple for the GPU to consume, for example. You can store it anyway you want, and your accessors define how to pull that data back out.

    Version 2 certainly feels well designed to me. It makes sense to my feeble mind.
     
  31. RockoDyne

    RockoDyne

    Joined:
    Apr 10, 2014
    Posts:
    2,234
    Having spent a good chunk of time yesterday trying to remember what it was called and eventually settling on glFS as plausible, I agree that it's definitely not a good name.
     
    Siccity likes this.
  32. nipoco

    nipoco

    Joined:
    Sep 1, 2011
    Posts:
    2,008
    Unreal Engine does support it already. At least in an experimental state.
    But no official support from Unity so far.
    And that‘s quite interesting, since under „Industry Support“ on the official glTF site, Unity is listed and Unreal Engine is not.
    It‘s a shame that Unity Tech instead choose to work closer with Autodesk and fix/improve the pipelines with their products and proprietary FBX format.
    That is not what I would call a democratization of game development.
     
  33. eobet

    eobet

    Joined:
    May 2, 2014
    Posts:
    176
    Yes, especially since Ton Roosendaal said in a recent interview that Blender will dump FBX support with their 2.8 release (even though I can't find anything in writing on that when I did a quick search just now).

    (In that same interview Roosendaal suggested that Autodesk slightly changes the FBX format each year on purpose, just to make it more difficult for 3rd parties to support it, which if you look at the bug reports on FBX with Blender seems entirely plausible.)
     
    Siccity likes this.
  34. tteneder

    tteneder

    Unity Technologies

    Joined:
    Feb 22, 2011
    Posts:
    175
    Last edited: Dec 5, 2019
  35. cfree

    cfree

    Joined:
    Sep 30, 2014
    Posts:
    72
    Please, any news on that subject?
    gITF support is already needed.
     
  36. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,190
    Have you tried the code posted by @atti?
     
  37. cfree

    cfree

    Joined:
    Sep 30, 2014
    Posts:
    72
    Yes, and it worked very well!

    But i mean "native" support... like OP, i think Unity should pay more attention to this format :)

    Thanks!
     
  38. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,190
    Why? What will "native" support provide that his extension does not? I'd like to point towards FBX by the way and mention that there is nothing Unity provides that couldn't have been provided by a third party. There is certainly no runtime support for importing assets. If you want anything fancy you have to do it yourself and it's a very widespread format now.

    Likewise, if for some reason glTF eventually does receive native support, you won't see anything special because of it.
     
    cfree likes this.
  39. JeremiahJ

    JeremiahJ

    Joined:
    Nov 1, 2016
    Posts:
    28
    The Kronos Unity code already supports runtime loading of glTF models. There are examples of it in the repository.
     
  40. Blarp

    Blarp

    Joined:
    May 13, 2014
    Posts:
    270
    I feel like there is a major disconnect here in the term "runtime."

    Are you saying that I can build an app to a device such as an iphone and while the app is running I can pull a model in?

    Because so far, from what I can tell, runtime actually means "from the editor" which is insanely annoying.

    I simply need a repo for my 3d models instead of packaging them in the app
     
  41. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    The Khronos reader above allows you to pull models in entirely at runtime. We use it to pull in user-submitted 3D models for our WebGL-based viewer.
     
    recursive likes this.
  42. Blarp

    Blarp

    Joined:
    May 13, 2014
    Posts:
    270
    Rolling my eyes really hard about the "Runtime" blanket statement when it only works when the client is built to a webserver or being ran in the unity editor.

    Major disappointment
     
  43. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Bit confused by this? Nothing special needed, you can pull in a .gltf or .glb file from the local file system, or just from a web request, it's mainly a parser for the format. IIRC, that web server is only used for the example scene (we don't even use that, so not sure)
     
  44. JeremiahJ

    JeremiahJ

    Joined:
    Nov 1, 2016
    Posts:
    28
    It loads glTF at runtime. The example project includes a web server, in case you don't have one. It loads fine from other web servers. It loads fine when you instantiate the GLTFComponent class, set its properties in code, then call the Load() method. At runtime. On any device.

    I do not understand what you are not understanding, here. It does not require that a web server be built in. It does not require that a web server be running on the same host.
     
    developersice and lilymontoute like this.
  45. VicUng

    VicUng

    Joined:
    Nov 27, 2016
    Posts:
    1
    Sorry to bumb this thread, this is my first post in the Unity forums and I wasn't sure if I should open a new thread, but some users that were active here seem to be quite proficient with glTF and Unity
    I'm a bit lost in confusion with the already mentioned UnityGLTF github library for import and export in Unity https://github.com/KhronosGroup/UnityGLTF
    I have already asked in the github but haven't gotten any reaction so I thought I might try here.

    I want to create a geospatial Augmented Reality App and was provided with 3D geodata in form of 3D Tiles https://github.com/AnalyticalGraphicsInc/3d-tiles which basically consist of glTF-Files as 3D models and are embedded in i3dm files and tileset JSON files to specify their spatial metadata structure.
    My plan was to import the glTF-Files to Unity, see if I could find or develop some kind of plugin or bridge for the JSON and i3dm files and try out some Augmented Reality SDKs like Wikitude, ARCore or Vuforia to create an AR App.
    I followed the Readme on github and managed to run the example scenes that were included in the repo as well as exchanging the glTF model that is loaded with my own glTF file but for all example scenes the 3D models are only loaded at Run-time, but I want to edit the glTF, add components or scripts for interactive functionalities in the Unity editor during Design-time.
    The Readme says that the goal of the library is to support Design-time import of glTF 2.0 files and Design-time export of glTF 2.0 files among Run-Time import/export.

    Now my questions are: Has anyone already managed to use glTF files in Unity at Design-time and added interaction for the 3D models or does it only support run-time loading/view at the moment?
    And if there is someone with more experience in Unity and glTF, does my plan to realize a geo-based AR App using glTF as 3D Tiles sound realistic to you?
    I have worked in a team for other VR projects with Unity and .FBX files before, but this is the first time I have heard of glTF and work with GIS and geodata, so I'm not sure if any of this would work or if I'm just wasting time and should find a different approach.

    Any help is highly appreciated!
     
    Last edited: Aug 30, 2018
  46. JeremiahJ

    JeremiahJ

    Joined:
    Nov 1, 2016
    Posts:
    28
    Yes, a scriptable importer has been written so that you can just drag your .glb assets into the assets folder and they will be imported and converted to Unity assets. It's currently broken for me, and I created an issue in the repo to reflect that, so it might not work for you, I don't know. Try it, though.

    The scriptable importer isn't very discoverable, which is probably why you didn't realize that it was there immediately; it's invisible.

    I don't know anything about 3D tiles or GIS stuff, but I see no reason why anyone skilled at all in C# couldn't make this happen if the metadata is in JSON and the content type is glTF.
     
  47. Blarp

    Blarp

    Joined:
    May 13, 2014
    Posts:
    270
    Sketchfab can easily make it to where we can import assets at runtime, I think they are deciding not to because of the "netflix problem." Their bandwidth would be insane.

    But with all of our clients wanting to store 3d models in the cloud and our scripts automatically pull them, sketchfab is the root of our problem.

    With those whole GLB/GLTFS thing, sketchfab holds the keys to all of our future to be perfectly frank,.

    Polyfab comes super close, but the models look terrible and half of them don't work.

    This is a serious problem that affects every single person that creates an augmented reality app. The first question from clients is ALWAYS "Hey, lets just upload models to wordpress and have you pull them inside the app."

    I don't even know the proper way to get this through sketchfab, kronos, or unity's head.


    EVERY single AR client I've had has asked me for this exact thing, and asset bundles are NOT the answer. This is coming from a freelancer that has made over $30,000 in augmented reality revenue in Unity related AR games.

    I basically have to send clients to Umbra because Im not going to deal with it.

    This is a problem that needs go be addressed, and the only bottleneck I see is Sketchfab, because no one else is going to create a repository for 3d models that we can pull from at runtime.

    Not to sound arrogant, but THIS is what is holding 3d model streaming back. Nobody comes close and very little are looking to solve it. It might be because of the cost, but we NEED a 3d repository for models that we can pull from at runtime. There is NOTHING more important than that for Augmented Reality.


    @JeremiahJ I guess I confused Kronos group with Sketchfab. But above is my problem, and I need to solved it for like 5 clients.
     
    Last edited: Sep 11, 2018
  48. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Check out Chipmunk (disclaimer: I am the product and development lead for the project). It supports a ton of formats (glTF (including .glb) and FBX for 3D so far), importing at runtime with automatic cloud conversion) and a workflow for creating/updating assets, rather than generating opaque asset bundles. Happy to answer any questions you have about it as well.

    @JeremiahJ, I'm tracking that one (I'm also the author of the ScriptableImporter in the Khronos repo). I believe some upstream changes broke it, so it just needs some minor bug fixing. Hoping to open a PR with a fix soon!
     
    Last edited: Sep 12, 2018
    Ryiah and JeremiahJ like this.
  49. JeremiahJ

    JeremiahJ

    Joined:
    Nov 1, 2016
    Posts:
    28
    Uh, why don't you just host them on AWS S3 or something? If all you need is somewhere to put them so they can be had with an HTTPS request, it doesn't get much easier than S3. Put them in a bucket, make the bucket public, get the public URLs.

    I don't know ANYTHING about model hosting services and what kinds of other features they provide that you require, so do look into Chipmunk if vanilla static web serving isn't enough.
     
  50. jariwake

    jariwake

    Joined:
    Jun 2, 2017
    Posts:
    100
    Interesting thread. I also would like to get rid of the .FBX format and all the problems that it introduces to the workflow with its closed format policy.

    It would be nice if someone from Unity would comment and shed some light on the plans of bringing glTF importing to Unity. Now that we have the package manager, it could be distributed through it, right?
     
    OfficialHermie, xCyborg and Linkooo like this.