Announcement

Collapse
No announcement yet.

The new glTF import supported in 4.19 preview is awesome. [Experimentation]

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • The new glTF import supported in 4.19 preview is awesome. [Experimentation]

    Click image for larger version

Name:	Capture.JPG
Views:	2
Size:	186.8 KB
ID:	1415588
    glTF is a new format, created by khronos (openGl, openCL, collada, others), designed to share game assets and scenes beetween engines. Mostly designed as a webGL exchange format, it turns out is quite good for normal assets.

    UE4.19 preview has a experimental importer for it, and right now its extremelly promising. This is an open format, that, once final, should work better than FBX, and actually work great with Blender.

    I went to test the 4.19 preview and started doing a few experiments with it. Right now its much superior to FBX for some simple cases.
    The cool point about glTF is that the same file holds a full scene, with multiple 3d objects, each of them with animation, and each of them with materials, and each material actually imports as a material graph, and with textures.

    This means that glTF is one click import and it setups every single mesh in your scene with correct materials and textures, from one file This allows you to setup your game assets in blender, with a blender material graph and textures, and import it directly into ue4, with everything getting translated.

    This gif shows the workflow:






    My tests have resulted in this:

    Basic static mesh support works. Skeletal meshes and animations are not supported yet.
    Each of the objects in the scene will become a single static mesh in unreal. This is good for a modular pack, but very bad for complex multiobject files. An option to merge objects would be great (like in FBX import). This fails spectacularly if you try to import one of the complex models from https://sketchfab.com/features/gltf , like the unity robot model (he imports as a ton of tiny objects) The same happens with the drone mode;.


    Interestingly enough, Blender export works by default, without any setup. There are no more scale ******** to deal with as with FBX, and also it will use the correct axis by default, so no flipped models or badly scaled models. Great improvement over FBX. It "Just Works"


    All objects in the scene will import as static meshes, with their scale and position reset. If you have any scale or position at "object" level in blender, when importing into unreal this will be reset. An option to apply the scale/position would be great, but working around it is absolutely trivial.
    Smooth groups export perfectly by default, exactly as they are with blender (no more import normals or not as with FBX). Another great improvement over FBX

    Whole scenes cant be imported well, as every object will just become a separated static mesh centered at origin, but without the "scene hierarchy". The importer having the option to create a blueprint that holds the scene information would be a huge plus, and would allow one to create a whole scene in blender and import it as 1 object into ue4.

    The material/texture import is a lot better than i expected, and its what makes this a superior format and workflow over FBX (for static meshes) right now. A blender cycles node tree will get completely translated to UE4, as long as it follows the roughness/metallic workflow. The fact that the importer already supports textures and recreates the material is awesome.

    The one that benefits the most from this is Blender, as FBX support has allways been terrible, but gltf already works well. Once Blender 2.8 releases, you will be able to author your meshes from it, using the PBR viewport, and then export the file to UE4 and it will keep all the material setup, looking similar.

    If unreal also adds glTF export, you would be able to extract any game asset in unreal, and import it into blender for use in a cinematic or a render with the pathtracer. With all the materials being compatible.
    Attached Files
    Last edited by vblanco; 01-19-2018, 10:54 AM.

  • replied
    Has anyone used this importer on OS X? I'm running 4.21.2 on High Sierra, and UE4 just crashes any time I attempt to import any of the glTF 2.0 models from the KhronosGroup sample models repo.

    This was the crash report for SimpleMeshes.gltf:

    Code:
    Assertion failed: (Index >= 0) & (Index < ArrayNum) [File:/Users/build/Build/++UE4/Sync/Engine/Source/Runtime/Core/Public/Containers/Array.h] [Line: 611] Array index out of bounds: 0 from an array of size 0
    
    FGenericPlatformMisc::RaiseException(unsigned int) Address = 0x1015a2f2b (filename not found) [in UE4Editor-Core.dylib]
    FMacErrorOutputDevice::Serialize(wchar_t const*, ELogVerbosity::Type, FName const&) Address = 0x101701524 (filename not found) [in UE4Editor-Core.dylib]
    FOutputDevice::LogfImpl(wchar_t const*, ...) Address = 0x101851730 (filename not found) [in UE4Editor-Core.dylib]
    FDebug::AssertFailed(char const*, char const*, int, wchar_t const*, ...) Address = 0x101765e4e (filename not found) [in UE4Editor-Core.dylib]
    ImportStaticMesh(GLTF::FAsset const&, TArray<UMaterial*, FDefaultAllocator> const&, UObject*, FName, EObjectFlags, unsigned int) Address = 0x167916177 (filename not found) [in UE4Editor-GLTFImporter.dylib]
    ImportStaticMeshes(GLTF::FAsset const&, TArray<UMaterial*, FDefaultAllocator> const&, UObject*, FName, EObjectFlags) Address = 0x16791b89c (filename not found) [in UE4Editor-GLTFImporter.dylib]
    ImportMeshesAndMaterialsFromJSON(FArchive*, FString const&, UObject*, FName, EObjectFlags, FFeedbackContext*, TArray<unsigned char, FDefaultAllocator>) Address = 0x1678ff41f (filename not found) [in UE4Editor-GLTFImporter.dylib]
    UGLTFImportFactory::FactoryCreateFile(UClass*, UObject*, FName, EObjectFlags, FString const&, wchar_t const*, FFeedbackContext*, bool&) Address = 0x1678fea47 (filename not found) [in UE4Editor-GLTFImporter.dylib]
    UFactory::ImportObject(UClass*, UObject*, FName, EObjectFlags, FString const&, wchar_t const*, bool&) Address = 0x10a7d38e9 (filename not found) [in UE4Editor-UnrealEd.dylib]
    UAssetToolsImpl::ImportAssetsInternal(TArray<FString, FDefaultAllocator> const&, FString const&, TArray<TTuple<FString, FString>, FDefaultAllocator>*, FAssetImportParams const&) const Address = 0x11e0d2e21 (filename not found) [in UE4Editor-AssetTools.dylib]
    non-virtual thunk to UAssetToolsImpl::ImportAssets(TArray<FString, FDefaultAllocator> const&, FString const&, UFactory*, bool, TArray<TTuple<FString, FString>, FDefaultAllocator>*) const Address = 0x11e0e00a8 (filename not found) [in UE4Editor-AssetTools.dylib]
    SAssetView::OnDrop(FGeometry const&, FDragDropEvent const&) Address = 0x11c14395b (filename not found) [in UE4Editor-ContentBrowser.dylib]
    FSlateApplication::RoutePointerUpEvent(FWidgetPath&, FPointerEvent&) Address = 0x108a34ecc (filename not found) [in UE4Editor-Slate.dylib]
    FSlateApplication::ProcessMouseButtonUpEvent(FPointerEvent&) Address = 0x1089d79e7 (filename not found) [in UE4Editor-Slate.dylib]
    FSlateApplication::OnDragDrop(TSharedPtr<FGenericWindow, (ESPMode)0> const&) Address = 0x108a4b9a4 (filename not found) [in UE4Editor-Slate.dylib]
    FMacApplication::ProcessEvent(FDeferredMacEvent const&) Address = 0x1089308e1 (filename not found) [in UE4Editor-ApplicationCore.dylib]
    FMacApplication::ProcessDeferredEvents(float) Address = 0x10892f14f (filename not found) [in UE4Editor-ApplicationCore.dylib]
    FSlateApplication::TickPlatform(float) Address = 0x108a047c2 (filename not found) [in UE4Editor-Slate.dylib]
    FSlateApplication::Tick(ESlateTickType) Address = 0x108a03d70 (filename not found) [in UE4Editor-Slate.dylib]
    FEngineLoop::Tick() Address = 0x101441e52 (filename not found) [in UE4Editor]
    GuardedMain(wchar_t const*) Address = 0x10144a478 (filename not found) [in UE4Editor]
    -[UE4AppDelegate runGameThread:] Address = 0x101457880 (filename not found) [in UE4Editor]
    -[FCocoaGameThread main] Address = 0x1016ffe67 (filename not found) [in UE4Editor-Core.dylib]
    Unknown() Address = 0x7fff2b6d0148 (filename not found) [in Foundation]
    _pthread_body Address = 0x7fff51891661 (filename not found) [in libsystem_pthread.dylib]
    _pthread_body Address = 0x7fff5189150d (filename not found) [in libsystem_pthread.dylib]
    thread_start Address = 0x7fff51890bf9 (filename not found) [in libsystem_pthread.dylib]

    Leave a comment:


  • replied
    UE4 supports only static mesh import from glTF format.

    Leave a comment:


  • replied
    Did anyone manage to import gltf animations from blender? i cannot, ive used the blender option embed buffers (the .bin file) into gltf but when i import in unreal there is only the mesh, no skeleton no animation nothing.

    Leave a comment:


  • replied
    Originally posted by c4g.io View Post

    I just test my plugin by official sample models. https://github.com/KhronosGroup/glTF-Sample-Models

    You know that I don't have enough time and models to test my plugin, I just try to ensure most of official's models are correct when imported into UE4 by my plugin.
    I am glad that you let me know if you found a glTF model has any error that is imported by my plugin.
    You can export models from Unreal and then try to import them back
    http://www.gildor.org/smf/index.php/topic,6281.0.html

    Leave a comment:


  • replied
    Originally posted by davide445 View Post
    I created a 3d model using Lego (for a construction project POC) trying to export it in glTF from Sketchfab create some odd result in UE4

    Sketchfab result

    glTF exported from Sketchfab and imported in UE4.19


    Not sure if this is only my fault, can anyone try it
    https://skfb.ly/6Atpz
    This is imported by my plugin glTF For UE4. It is free and open source.

    Click image for larger version

Name:	gltf.jpg
Views:	1
Size:	229.3 KB
ID:	1546262

    Leave a comment:


  • replied
    Originally posted by motorsep View Post

    Hmm.. But how do you export glTF from Blender in order to test your UE4 import plugin ?
    I just test my plugin by official sample models. https://github.com/KhronosGroup/glTF-Sample-Models

    You know that I don't have enough time and models to test my plugin, I just try to ensure most of official's models are correct when imported into UE4 by my plugin.
    I am glad that you let me know if you found a glTF model has any error that is imported by my plugin.
    Last edited by c4g.io; 10-31-2018, 10:48 PM.

    Leave a comment:


  • replied
    Originally posted by roberteker View Post
    Not sure where to post this, but it seems that Mozilla is making some effort to improve the gltf support in Blender, which is great news for everyone who wants to break free from the shackles of Autodesk:

    https://medium.com/mozilla-open-inno...l-ca0932b0ce76
    You won't break free from the "shackles" of Autodesk because people still going to use Maya/MAX which support FBX export natively and most of glTF exporters are not as polished as desired (especially when it comes to exporting skinned/animated meshes). When all 3D apps support glTF feature-complete export/import, then perhaps we can talk about dropping FBX for good.

    Leave a comment:


  • replied
    Not sure where to post this, but it seems that Mozilla is making some effort to improve the gltf support in Blender, which is great news for everyone who wants to break free from the shackles of Autodesk:

    https://medium.com/mozilla-open-inno...l-ca0932b0ce76

    Leave a comment:


  • replied
    Just adding this is a highly anticipated pipeline for us. The fbx importer code has a lot of legacy and is generally a mess. Combined with the lack of documentation on the sdk, it's very difficult to modify or extend. Here's hoping for predictable joint orients and usable coordinate space conversion for skeletal meshes.
    Last edited by garrettorious; 10-18-2018, 01:00 PM. Reason: Spelling

    Leave a comment:


  • replied
    There are many good reasons to load geometry at runtime. I have hundreds of millions of CAD models that I need to make available in a viewer at any time. I need that viewer to have functionality that is relatively easy to implement in a game engine, and impossible for the CAD software vendor to implement, despite offering them tens of millions of dollars to do so.

    This is a fully valid and much-more-common-than-you-think situation. Game engines are the only reasonable way forward.

    GlTF 2.0 does not allow custom shaders to be included, so models loaded from glTF use a standard/default shader in the engine that uses material properties defined in the glTF model. This does not preclude loading at runtime. I've reverse engineered and implemented readers for the proprietary CAD format that we use, which is not supported by any commercially available CAD importing tool, so that doesn't preclude runtime loading, either. I can convert our CAD models into glTF in an offline process that runs at the time the model is put back into source control quite rapidly, and optimize the draw call count (all the way down to 1 draw call per part instance and beyond) while doing it, so runtime performance of these models is not a problem.

    I am doing the things that you are saying can't or shouldn't be done, except loading glTF at runtime in Unreal. I DO NOT want to convert each CAD model to several different engine-native asset formats each time a new part is drafted or modified. I want to either implement a native CAD asset reader for each engine (which is usually slower than loading glTF at runtime) or convert the CAD assets to glTF once, then use the glTF assets in each engine at runtime. Right now, Unreal is the only reason I can't just dictate that glTF be used everywhere. All other game engines in use at my employer can do it, and we are using those engines to do it. Not every team wants to use those other engines, though, some want to use Unreal.
    Last edited by Naikrovek; 10-10-2018, 09:47 AM.

    Leave a comment:


  • replied
    Originally posted by Naikrovek View Post
    "The GL Transmission Format (glTF) is an API-neutral runtime asset delivery format."
    This doesn't mean "you should load and parse glTF files at runtime" This means that data structures of this format are suitable for being rendered at runtime without further processing, that's why it is a "runtime format". However for a complex engine like Unreal, you'd either need custom rendering code (which won't conflict with main renderer), or you still need data processing / conversion into engine's renderable structures. This conversion is done in Developer/MeshUtilities module, which is not a runtime one.

    Also, things you mentioned are not a point for doing loading at runtime anyway.
    Last edited by Gildor; 10-10-2018, 03:44 AM.

    Leave a comment:


  • replied
    Originally posted by Gildor View Post
    Point of glTF is "transmission format". There's nothing about "runtime" or "edit time". Unreal engine is designed to load assets prepared at edit time. Doing correct import at runtime will require lots of editor modules being pushed into runtime, for example - MeshUtilities, ShaderCompiler, Jpeg and Png decoders etc. And at the same time, there's no point for loading glTF files by UE4 at runtime. Really, no point - unless you want to make "another one glTF viewer", which is not the point of doing huge changes in the engine.
    OF COURSE there is a point to loading glTF at runtime... Not everyone using Unreal is working on a game.

    The FIRST SENTENCE in the specification: "The GL Transmission Format (glTF) is an API-neutral runtime asset delivery format."
    Last edited by Naikrovek; 10-09-2018, 11:39 PM.

    Leave a comment:


  • replied
    Ok found it in the Importers plugin in the engine
    Thank you

    Leave a comment:


  • replied
    Of course no. I never tried that third-party plugin, so I'm talking about built-in one (and this topic is about built-in plugin).
    The plugin is in "experimental" stage, and all such engine features are disabled by default. You should go to the settings, find glTF plugin and enable it. After that, .gltf files will be supported by standard "Import" option.

    Leave a comment:

Working...
X