Search Unity

TriLib - Model Loading Package

Discussion in 'Assets and Asset Store' started by rickomax, Jun 21, 2017.

  1. shibi2017

    shibi2017

    Joined:
    Jan 18, 2018
    Posts:
    153
    hi what file format you using? Im working on .glb and .gltf format.
     
  2. mi_ni_

    mi_ni_

    Joined:
    Jun 30, 2021
    Posts:
    1
    Hey!

    Is it still planned that Collada/DAE support is added to Trilib2?
    I cannot update to Trilib2 as long as this one is missing.:(
    So, whats the plan?
     
  3. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    476
    According to the documentation website, Humanoid Avatar Detection only works with GLTF and FBX models. Those are what's working for me.
     
  4. Chopium

    Chopium

    Joined:
    Jun 15, 2015
    Posts:
    19

    Currently having an issue with the standard material mapper and .FBX files. Appears as expected in editor, but everything appears fullsmooth+metallic in builds (iOS). Currently "fixing" by setting all smoothness metallic material params to 0 via the material post process callback. I'm logging the values (seen above) and they look the same, so I wonder if the default black metallic map is not having its alpha channel written to 0 like it does in the editor.

    https://drive.google.com/file/d/154mZ0DikObkkTXo59PWDyFhyGwLOku7Z/view?usp=sharing
    The file should be matte with a solid tan color. It appears ok in the WebGL previewer and earlier Trilib versions.
     
    Last edited: Mar 20, 2022
  5. shibi2017

    shibi2017

    Joined:
    Jan 18, 2018
    Posts:
    153
    ok, thank you. I export model with.glb format, which I think belongs to GLTF. But can not get avatar using humanoid. I'll try it again later.
     
  6. whitegreenstudios88

    whitegreenstudios88

    Joined:
    Dec 12, 2021
    Posts:
    10
    Hi, i have try to import T-Posed FBX from Mixamo, and set animationtype.humanoid. When my avatar loaded, i set parent to Geometry under starter asset third person charater, and replace the "1Avatar" animator avatar to starter asset third person charactor animator avatar. Normally it will work when i do this from readyplayerme avatar. But it doesn't work this time. Pls help. does the animator humanoid avator a standard unity humonoid? tq
     
  7. lavenderxxxxx

    lavenderxxxxx

    Joined:
    Apr 11, 2017
    Posts:
    1
    Hi.
    Loading new scene will cause AssetLoader.LoadModelFromFile() failed to load model.
    How could I prevent it ?
     
  8. Kavithagamer

    Kavithagamer

    Joined:
    Feb 18, 2022
    Posts:
    8
    Hi @rickomax, I got this package today. Its pretty awesome. since i am a beginner, I don't know the most of its function. it would have been soo good if there is a detailed video tutorials bot its usage.

    I want to load a avatar dynamically at runtime in the Mainmenu scene & want to take that avatar to the Gamescene. Might sound silly, excuse me for this. since i am a beginner i could use some help
     
  9. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    I apologize for the delay in updating this topic.
    I'm generally answering support e-mails, so if you have an urgent request, please e-mail me at:
    contato@ricardoreis.net

    I will be updating this topic.

    Best regards,
    Ricardo Reis.
     
  10. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    I don't think so, it will only prevent objects from being wrongly renamed when they have the same name.

    I'm investigating an Android issue where MipMaps can't be generated and looks like it has something to do with the memory needed to be allocated for the power-of-two Textures TriLib creates to fix the non-power-of-two Textures.
     
  11. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    Please use the AssetLoaderZip to load models from Zip files:

    Code (CSharp):
    1. FilePath = @"F:/blue_gown.zip";
    2. AssetLoaderZip.LoadModelFromZipFile(FilePath, OnLoad, OnMaterialsLoad, OnProgress, OnError, null, assetLoaderOptions);
     
  12. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    I just noticed the "_id" property from the AssetUnloader is not kept when cloning the object.
    I will fix it and include the fix in the upcoming update.
     
  13. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    The sub-meshes are always combined in TriLib 2.0. We don't have this option anymore.
     
  14. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    I'm not sure what compression Unity uses on Android, but the manual mention some (depending on the target device):
    https://docs.unity3d.com/Manual/class-TextureImporterOverride.html
     
  15. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    I'm planning to add Ktx support to the upcoming update.
     
  16. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    I've been considering writing a GameObject serializer/deserializer to speed-up model loading, so users can get a performance boost the second time they load the models. At the moment, there is no way to do that besides using custom serializers.
     
  17. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    It does support FBX version 7 onwards, it does not support any previous version.
    There was an experimental FBX compatibility layer before. I'm planning to add it back in a future update.
     
  18. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    This issue has been fixed on a previous update.
     
  19. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    I've fixed this issue in the upcoming update.
     
  20. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    This issue is caused by a mismatched material property declaration on the OBJ material library file.

    I've fixed this issue and will include the fix in the upcoming update.
     
  21. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Thanks for pointing this out. Fixed!
     
  22. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    Thanks for pointing this out. I've fixed this issue and will include the fix in the upcoming update.
     
  23. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    Child meshes are combined automatically by TriLib 2.0.
    If you mean combining GameObjects, please let me know.

    Regarding the DWG and STP/STEP support, it is out of the TriLib scope.
     
    JudahMantell likes this.
  24. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    All Unity objects (Meshes, Textures, and Materials) have to be created on the main thread, so there will be a UI lock when TriLib creates these objects.

    There are new ECS components that work with parallel threads, I will study these later and see what I can bring to TriLib.
     
  25. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    Yes, the DAE importer is basically ready. I haven't added it to the main package yet because I'm still fixing some issues with the other file formats.
     
    look001 likes this.
  26. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    The "customContextData" parameter is what you would use to do that, but there might be casting issues because TriLib also uses this parameter with some loading methods (like the Zip loading methods).

    In the upcoming update, I've added the "CustomDataHelper" class. This class has helper methods to handle the "customContextData" parameter and the "AssetLoaderContext.CustomData" field as a Type/Object Dictionary where you can store/retrieve the custom context objects by their type.
     
  27. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!
    If you're targeting WebGL, the application will freeze as there is only a single thread to handle everything.
    On other devices, there is a stall on the main thread when TriLib is creating the Unity objects (Textures, Meshes, and Materials). I'm studying methods to decrease the freezing time.
     
  28. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    The Emission textures are set correctly in the latest TriLib update:
    upload_2022-3-23_12-7-57.png

    If you having issues with a specific model, you can send it for testing to: contato@ricardoreis.net
     
    fra3point likes this.
  29. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!
    The "_EMISSION" keyword is set correctly with the latest TriLib update:
    upload_2022-3-23_12-10-35.png
     
    fra3point likes this.
  30. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    The Colliders should be added to the GameObject Renderers using the code you used. Have you checked them out?
     
  31. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    It is a Unity IL2CPP bug, I've opened a ticket for it:
    https://fogbugz.unity3d.com/default.asp?1409696_ne1rshv0ffvdjr0p
     
  32. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    This has been fixed on a previous update.
     
  33. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!
    Have you checked out your GameObject Renderers?
     
  34. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    476
    Hey, super quick question:
    Is there a way to get the file name of the attempted imported model through OnError?
    The argument contextualizedError.Context is null so I can't get any info about the file.
    Any help would be appreciated!
     
  35. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    The Colliders are added to the Renderer GameObjects. Creating a Collider to encompass the entire GameObjects require a different strategy. Is that what you want?
     
  36. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    I have barely tested TriLib with Coroutines, but I had no issues in my tests. I will try to create a small test-case here.
    Regarding the pink materials, I could not reproduce the issue yet. But I'm working on it. It is strange that you don't get it when loading a single model. Do you get any error messages in the console? Also, keep in mind that there is no way to fully load a model asynchronously with TriLib, as Unity creates Meshes, Textures and Materials on the main thread.
     
  37. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!
    TriLib Animation compression is in the works, but there is no ETA yet.
     
  38. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!
    I couldn't come across such an issue yet.
    Are you using the LoadModelFromFilePicker sample code?
     
  39. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!
    What happens between these two calls is called in the main thread, so there will be some UI stall. This is the part of the code where Unity Meshes, Materials, and Textures (depending on your options) are created.
     
  40. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!
    Have you tested your Avatar in the AvatarLoader scene?
    Is your Avatar rigged in Mixamo or 3Ds Max Biped?
     
  41. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!
    The DAE reader is basically ready, I just need to add some new features to it and do the tests. I guess I can release it after the next 2 or 3 updates.
     
  42. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    The upcoming update has Material Metallic/Smoothness fixes.
     
    CodeFluegel2 and Chopium like this.
  43. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!
    I have answered you via e-mail.
     
  44. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!
    I have never tested such scenario, I will make some tests here, and see if I can come up with a solution.
     
  45. theolagendijk

    theolagendijk

    Joined:
    Nov 12, 2014
    Posts:
    117
    Hi Ricardo Reis,
    Thanks for your great asset.
    I've purchased the TriLib (2.0) Model Loading package and I'm enjoying it a lot. I primarily use it to import OBJ files at runtime. Works great most of the time. However I encounter problems on a small subset of my OBJs. I think it's related to the known issue of blend-shape normals and tangents that are not imported (yet). Of course I'd love to see that fixed so I was wondering if you can share your planning on this known issue / limitation.
     
  46. michaellu88

    michaellu88

    Joined:
    Apr 6, 2022
    Posts:
    1
    Hi, did anyone have try import avatar into any shooting game like opsive UCC, universal shooter, z forward, etc.? i have purchase all of them, import avatar and runtime using trilib and replace the imported animator avatar with their exiting avatar. Animation work perfectly but only equip gun still stick with original avatar bone system. if u do hav solution, i hope u can share ur solution or any other third person controller that work perfectly with trilib. tq
     
  47. unity_5F3233DDF34AF1474DBC

    unity_5F3233DDF34AF1474DBC

    Joined:
    Dec 11, 2021
    Posts:
    18
    good day tried trilib again today, but every time I import an object from runtime it has a lagging point, around 75% then after the lagging point it will be loaded perfectly, just wondering if there is any kind of workaround for this, and btw I'm just using the very basic trilib functions.
     
    look001 likes this.
  48. theolagendijk

    theolagendijk

    Joined:
    Nov 12, 2014
    Posts:
    117
    Hi, I'm not 100% sure that I know what you mean by "lagging point" but maybe what you're experiencing is the Garbage Collector kicking in every half second.
    The GCHelper class does this.
    You can configure the Interval (in seconds) like so ;
    Code (CSharp):
    1. GCHelper.GetInstance().Interval = 2f; //Interval for Garbage Collection in seconds
    See https://ricardoreis.net/trilib/trilib2/docs/class_tri_lib_core_1_1_g_c_helper.html
     
  49. unitydevstudio

    unitydevstudio

    Joined:
    Jun 24, 2017
    Posts:
    24
    Hi @rickomax
    I have some issues while using Trilib on WebGL build.
    When I don't select the 3d model or HDR file and cancel the file browser, the "Choose Files" UI remains on the web.
    Is there any way to remove this UI element when I cancel the file browser?

    Also.. another issue.
    When I browse a 3D model or HDR file, the "Choose Files" UI element makes the webGL build's position change.
    Is there any way to not show this UI element and just display a file browser?

    Thanks.
     
  50. Chopium

    Chopium

    Joined:
    Jun 15, 2015
    Posts:
    19
    I am on the latest trilib build and am still getting this issue, only in builds on ios and android. Idk if this was in the last release from late march but the issue is still here in my project. Would be interested to hear if this is also something other users have seen...