Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

TriLib - Model loader package (Support via e-mail)

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

  1. andgest

    andgest

    Joined:
    Apr 26, 2018
    Posts:
    26
    Hi,
    Concerning the problem into Android and iOS about missing libassimp.so, I sent you the source by mail the friday 26. Did you received it well ?
    Thank you :)
     
  2. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Interesting statement about il2cpp using the default .NET libraries.
    Can you show me a screenshot of your build settings?
     
  3. CAD_Schroer_GmbH

    CAD_Schroer_GmbH

    Joined:
    Jan 23, 2017
    Posts:
    10
    Hi Rickomax,

    attached the screenshot from my build settings.

    Regards,
    CAD Schroer

    UnitySettings.png
     
  4. andgest

    andgest

    Joined:
    Apr 26, 2018
    Posts:
    26
    Maybe I stay too focus on the first error and I need to fix second error firstly ?

    10-31 18:23:04.277 12439 12484 E Unity : Unable to find libassimp
    10-31 18:23:04.498 12439 12484 E Unity : Exception: Error loading asset. Assimp returns: [Unable to open file "./Assets/Resources/PrefabBuilder/designConnected/garsnas_pia_3002_obj.obj".]

    On Android what is the path to correctly reach a file present into the Assets folder ?
     
    Last edited: Nov 1, 2018
  5. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    The real problem is the first error. I'm not sure about how Unity handles the native plugins selection for every android platform. If you prefer, we can connect via TeamViewer, so I can help you in your environment.
     
  6. andgest

    andgest

    Joined:
    Apr 26, 2018
    Posts:
    26
    Yes we can do that, thank you to propose this solution ;)
    But I'm on UTC+1 and I am not available every day from 7:40 AM to 6 PM from monday to friday (my employee job...).
    I am also available the saturday and the sunday.
    Maybe we can schedule this by private message ?

    I have test on Nexus 6 and I have the same error message.
    So to resume, I get the message "Unable to find libassimp" on Nexus 6, OnePlus 3T and Samsung Galaxy Tab S3.
    Also it doesn't work on iPhone XS and iPhone 7 but I can't still not confirm that I obtain the same error message (no find the way to get the logs... :( )
     
  7. andgest

    andgest

    Joined:
    Apr 26, 2018
    Posts:
    26
    Good news !
    I change the way to access to the .obj and ... it's work !!!
    The first error "Unable to find libassimp" is still here but the second is no more present.

    ItsWorkOnMyNexus6.png WithTexture.png

    v1
    It's currently work in progress but :
    - I put the .obj into the "Assets/StreamingAssets" folder
    - I use "Better Streaming Assets" to get bytes array and send it to trilib

    v2
    Now it's work with texture !
    I use "Better Streaming Assets" to copy all files and directory contains into "StreamingAssets" folder into Application.persistentDataPath folder (it's like if I unzip this files).
    Then I provide to trilib the file system path to Application.persistentDataPath/myFile.obj.
    This implementation work well on windows and Android (and I expect it work also on iOS :) )
     
    Last edited: Nov 1, 2018
    Thibault-Potier likes this.
  8. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Hi!

    What's the method you were using that isn't working?
     
  9. fueldown_

    fueldown_

    Joined:
    Mar 21, 2018
    Posts:
    23
    Hi @rickomax,

    I am getting this error with the zip file :
    ZipException: Version required to extract this entry not supported (788)


    what version of zip do you use and how can I take care of this?

    UPDATE
    I just downloaded latest sharpziplib and it worked fine for now, despite it saying that Stream api is replaced with IDisposable pattern. Not sure if this will break anything going forward.
     
    Last edited: Nov 5, 2018
  10. giriblr

    giriblr

    Joined:
    Aug 27, 2018
    Posts:
    2
  11. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Thank you for your feedback!

    I will update the SharpLibZip included in TriLib and check if that won't cause issues.
     
  12. andgest

    andgest

    Joined:
    Apr 26, 2018
    Posts:
    26
    Hi !

    I was just providing a classic path to TriLib like "./MyDirectory/MyObj.obj".
     
  13. JenniB

    JenniB

    Joined:
    Feb 15, 2018
    Posts:
    62
    Hello :)
    I use your AssetLoaderAsnc to load many models at the same time. So when a model is loaded, it goes recursively over all children and load them at the same time. Then this error occurs:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. TriLib.AssetLoaderBase.BuildBones (IntPtr scene) (at Assets/Libraries/TriLib/TriLib/Scripts/AssetLoader/AssetLoaderBase.cs:2297)
    3. TriLib.AssetLoaderBase.LoadInternal (IntPtr scene, System.String basePath, TriLib.AssetLoaderOptions options, Boolean usesWrapperGameObject) (at Assets/Libraries/TriLib/TriLib/Scripts/AssetLoader/AssetLoaderBase.cs:1417)
    4. TriLib.AssetLoaderBase.InternalLoadFromFile (System.String filename, System.String basePath, TriLib.AssetLoaderOptions options, Boolean usesWrapperGameObject) (at Assets/Libraries/TriLib/TriLib/Scripts/AssetLoader/AssetLoaderBase.cs:684)
    5. TriLib.AssetLoaderAsync+<LoadFromFile>c__AnonStorey0.<>m__0 () (at Assets/Libraries/TriLib/TriLib/Scripts/AssetLoader/AssetLoaderAsync.cs:52)
    6. TriLib.ThreadUtils+<RunThread>c__AnonStorey0.<>m__0 () (at Assets/Libraries/TriLib/TriLib/Scripts/Extensions/ThreadUtils.cs:50)
    7.  
    When loading it with the normal AssetLoader it works fine.

    Can someone help? :)
     
  14. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Hi. Could you try doing the same procedure instantiating a new AssetLoaderAsync for each model?
     
  15. JenniB

    JenniB

    Joined:
    Feb 15, 2018
    Posts:
    62
    Now it works thanks!!! :)
     
  16. sauravmohanv

    sauravmohanv

    Joined:
    Oct 29, 2018
    Posts:
    3
    The fbx file which I imported in real time had only one material assigned to the whole object. And the texture files were not loaded. is there any way to import all the materials(4 materials are there for each object). Also, how do I import the textures?
     
  17. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Hi!

    There is one post-processing step that merges redundant materials, you can disable it doing:


    var assetLoaderOptions = AssetLoaderOptions.CreateInstance();
    assetLoaderOptions.PostProcessSteps &= ~AssimpPostProcessSteps.RemoveRedundantMaterials;

    using (var assetLoader = new AssetLoader()) {
    var model = assetLoader.LoadFromFile(“my filename.fbx”, assetLoaderOptions);
    }
     
  18. JenniB

    JenniB

    Joined:
    Feb 15, 2018
    Posts:
    62
    Hei :)
    When exporting a GLTF model with UnityGLTF (https://github.com/KhronosGroup/UnityGLTF) and then import it with TriLib the model does not look like before exporting with UnityGLTF. In the GLTF Importer from UnityGLTF,which imports the correct model, the attributes like vertex positions etc. are also somehow changed when importing it in Unity.
    Any idea how the imported GLTF model will look the same as the exported one?
     
  19. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Hi!
    The GLTF module has been updated to accept the 2.0 specification on latest Assimp commits. I will update TriLib this week to include the latest Assimp modifications.
     
  20. CAD_Schroer_GmbH

    CAD_Schroer_GmbH

    Joined:
    Jan 23, 2017
    Posts:
    10
    Hi Rickomax,

    did you reproduce my problem with the il2cpp build on UWP?

    Regards,
    CAD Schroer
     
  21. JenniB

    JenniB

    Joined:
    Feb 15, 2018
    Posts:
    62
    Thanks! :) I will wait for the next update :)
     
  22. Elfinnik159

    Elfinnik159

    Joined:
    Feb 24, 2013
    Posts:
    110
    Hello
    I used this plugin to develop the application, and all the tests on Win10 passed without problems. However, when the build began to be tested on Win7 (x64, SP1), an error appeared:
    dllnotfoundexception assimp
    In notepad: failed to load "c:...Plugins\assimp.dll" with error "...(incomprehensible character set, wrong encoding)"
    AssimpInterop.cs 180
    .dll is in the folder.
    Please tell me how I can fix it?

    Unity: 2018.1.0
    Plugin: 1.8.7b

    P.S.My application is under moderation, so if the bug is known and fixed in the new version, can I get it before the release in the Asset store?
     
    Last edited: Nov 13, 2018
  23. Elfinnik159

    Elfinnik159

    Joined:
    Feb 24, 2013
    Posts:
    110
  24. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    I will be back to my office in two days, but meanwhile, we have the TriLib source avaliable. I will send you via PM.
     
  25. Elfinnik159

    Elfinnik159

    Joined:
    Feb 24, 2013
    Posts:
    110
    Okay, I will be waiting. Hope we can solve this sooner.
     
  26. AudrasC

    AudrasC

    Joined:
    Feb 19, 2016
    Posts:
    18
    Hello!

    I'm trying to load a .fbx with textures but the textures take a lot of memory and crash on iOS because it reaches the maximum memory.

    For testing purpose I used a small .fbx with only 2 textures.
    Here is a screenshot from Unity editor and the texture takes ~170 MB.
    Also I don't understand why the texture is duplicated.
    the
    Code (CSharp):
    1. assetLoaderOptions.TextureCompression
    is the default value.


    スクリーンショット 2018-11-15 16.17.40.png

    How can I decrease the memory usage of the textures ?

    Thank you.
     
    unitydevstudio likes this.
  27. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Hi!

    The only place where the texture is duplicated is when creating the texture mip-map levels, which I plan to do with stb_image on a future version, avoiding the duplicate.

    I will profile TriLib on iOS to check where is the texture loading flaw.
     
  28. fueldown_

    fueldown_

    Joined:
    Mar 21, 2018
    Posts:
    23
    Hello @rickomax ,

    Any news on the android logcat spamming the libassimp not found error? I am getting that error too frequently. It starts with Kernel32.dll not found and then it just spams the libassimp error while loading a model.
     
    kiandroid likes this.
  29. JenniB

    JenniB

    Joined:
    Feb 15, 2018
    Posts:
    62
    Is there any new update available with the latest Assimp modifications? :)
     
  30. samuelmorais

    samuelmorais

    Joined:
    Aug 3, 2012
    Posts:
    50
    Hi @rickomax , I have the same problem of @federicoVS with Unity 2018.2... Any help would be apreciated.
    Thanks!


     
  31. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Hi! Not yet.

    There are quite a few items on TriLib bug-list at the moment.
    Anyway, Assimp version will be updated on new TriLib update for sure, but I can't give an ETA yet.

    Best regards,
    Ricardo Reis.
     
  32. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Hi!

    The TriLib bug-list is a bit bigger than usual, so it should take more substantial time till your issue be resolved. I'll keep you updated.

    Best regards,
    Ricardo Reis.
     
  33. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Hi!

    I'm already working on WebGL platform issues. I'll probably have updates on it on the next TriLib update.

    Best regards,
    Ricardo Reis.
     
  34. AudrasC

    AudrasC

    Joined:
    Feb 19, 2016
    Posts:
    18
    Hello!

    Thank you for looking at it.

    It would be nice if we could choose the compression of the textures same as Unity.
     
  35. JenniB

    JenniB

    Joined:
    Feb 15, 2018
    Posts:
    62
    Is this feature part of the current release?
     
  36. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    337
    Hi, there seems to be problem with importing skinned fbx files. With unity fbx importer everything is ok, but when I use TribLib all meshes are rendered using skinned mesh renderer and skinning is completely broken. I tried all
    AssimpPostProcessSteps but it doesn't help.
     
  37. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Hi. Not yet!
     
  38. JenniB

    JenniB

    Joined:
    Feb 15, 2018
    Posts:
    62
    In your FileOpenDialog: Is there any possibility to change the start directory?
    I tried FileOpenDialog.Instance._directory, but this variable is private.
     
  39. Valtiel_

    Valtiel_

    Joined:
    Jul 27, 2013
    Posts:
    4
    Hi,

    I'm building for UWP and I have the same exact issue than you. The "expected x86 architecture" for assimp.dll and the endless loop when it comes to assimp methods calls...

    Did you manage to solve it since then ?

    EDIT : Finally, I found a solution.

    The hint was a looping error :

    Run-Time Check Failure #0 - The value of ESP was not properly


    I managed to solve it by replacing all the "CallingConvention.StdCall" with "CallingConvention.Cdecl" in AssimpInterop.cs

    Regards.
     
    Last edited: Nov 27, 2018
  40. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Hi!

    Thank you for your feedback. I will investigate this issue further.
     
  41. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Hi!

    You can set this variable to be public. I'll update the sample code to set it public next time.
     
    JenniB likes this.
  42. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Hi!

    Please send the model you're trying to load to contato@ricardoreis.net
     
  43. Elfinnik159

    Elfinnik159

    Joined:
    Feb 24, 2013
    Posts:
    110
    Hi!
    Is support for .pmx (MMD) planned (or other MMD files)?
    (it looks like it is available in assimp (Importers))
     
  44. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    337
    If someone has problem with broken skinned mesh renderer- it's problem with dupliated names in fbx models, I made very ugly hack to workaround this. Fortunately it's C# part of this package that's broken.
    Funny thing is that dev actually do lot of things in code to rename those objects names to not have duplicates, but somehow forgot to sync those changes with bones and it was very hard to fix/workaround(very convoluted logic). I hope it'll get proper fix in future.
     
  45. CogumeloSoft

    CogumeloSoft

    Joined:
    Dec 28, 2012
    Posts:
    72
    Hi!
    i`m having problems importing 2.0 GLB (Binary GLTF) files that are been loaded without textures. How can we get some "in development" version of next trilib version to test if it's fixed already? We have some milestone for this project in middle of December so it would be great have something working even if it's not the final version.
    This is the file i'm using to test:
    http://cogumelosoftworks.com/files/sofa.glb
     
  46. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Hi!

    I can confirm Assimp has a loder for PMX files, so TriLib is also able to load it.
    I'll update the oficial file formats list on the website.

    Best regards,
    RIcardo Reis.
     
  47. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    438
    Hi!

    I'm planning to release a beta version with GLTF2 fixes (vertex color loading and animation support) in the next week.

    Best regards,
    Ricardo Reis.
     
    mfleurent likes this.
  48. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,197
    Hello,

    when I use Trilib to load a Mesh file (DAE in my case), it takes a Long time until it is done (in my case betweeen 20 seconds and a Minute).

    I made a "Loading cube" with a simple Script with a constant Rotation in the Update Method.
    But as soon as I start loading with Trilib, my cube freezes. Is there a way to have it still rotating while Trilib loads or have some other simple Animation to Show it did not hang up but is loading?

    when I search for it I only find stuff when loading a Scene...

    Is there some way already in TirLib or do you know a simple way?

    Thanks!

    PS: I am using

    CADGameObject = assetLoader.LoadFromFile(fileName, assetLoaderOptions);
     
    Last edited: Dec 7, 2018
  49. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,197
    PS: I found there is an Async way, so I tried, but still my cube freezes:

    Code (CSharp):
    1.         public async Task<GameObject> LoadCadFile(string fileName, Vector3 position, Quaternion rotation, int addonNumber = 0, string tag = "")
    2.         {
    3.             CADGameObject = null;
    4.             // Laden
    5.             Debug.Log("Load CAD file:" + fileName);
    6.             using (var assetLoader = new AssetLoaderAsync())
    7.             {
    8.                 var assetLoaderOptions = AssetLoaderOptions.CreateInstance();
    9.                 // Mit diesem Flag die Original-Namen aus dem DAE verwenden (werden sonst mit NodeXY hochgezählt)
    10.                 assetLoaderOptions.AdvancedConfigs.Add(AssetAdvancedConfig.CreateConfig(AssetAdvancedPropertyClassNames.ColladaImportUseColladaNames, true));
    11.                 if (!Globals.ConfigData.LoadSimple)
    12.                 {
    13.                     assetLoaderOptions.AdvancedConfigs.Add(AssetAdvancedConfig.CreateConfig(AssetAdvancedPropertyClassNames.CalculateNormalsMaxSmoothingAngle, 0));
    14.                 }
    15.                 // File laden, momentan testweise mit hartem Pfad
    16.  
    17.                 // File laden aus Namen vom FileDialog
    18.                 _addonNumber = addonNumber;
    19.                 _position = position;
    20.                 _rotation = rotation;
    21.                 await assetLoader.LoadFromFile(fileName, assetLoaderOptions, CADGameObject, onCADLoaded);
    22.  
    23.             }
     
  50. ayublin

    ayublin

    Joined:
    Sep 27, 2016
    Posts:
    2
    Hi Elfinnik159, I'm having similar issue, would you mind sharing the solution? Many thanks in advance.
     
unityunity