Search Unity

TriLib - Model Loading Package

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

  1. littliwhite

    littliwhite

    Joined:
    May 19, 2015
    Posts:
    2
    Hello,
    I found that some of the components of the fbx model are done by mirroring, but trilib zeros the transform and causes the model to be misplaced. How to solve this problem?
     
  2. unitydevstudio

    unitydevstudio

    Joined:
    Jun 24, 2017
    Posts:
    24
    Hi, @rickomax

    Loading FBX model has texture crashes every time on iOS.
    In Unity Editor, imported texture size is 80M. but on iOS, when loading fbx model, memory usage increased by 2.5G..
    I don't understand why memory usage for 80M texture file takes so much like 2.5G.
    How can this 80M texture take 2.5G memory usage?
    Most of my models has texture. Can u solve this memory problem, please?

    Thanks.
     
  3. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    @rickomax I just want to confirm that WebGL is working in Unity 2019.1, the Unity bug ticket does not seem closed; yet your changelog on the asset store says that a WebGL issue was fixed. I suppose I could test a build but I don't have the WebGL build support installed on my current device :p Will it build?
     
  4. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    Could you please send this link to contato@ricardoreis.net with this topic text?
    This way I can track this issue and give you a faster feedback via our issues tracking.

    Best regards,
    Ricardo Reis.
     
  5. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    Other users are having the same error, I'm investigating it.

    Best regards,
    Ricardo Reis.
     
  6. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    Sorry if I wasn't clear, but indeed, it still not working on Unity 2019 and Unity team is working on this issue:
    https://issuetracker.unity3d.com/is...-a-built-project-which-uses-libassimp-library

    Best regards,
    Ricardo Reis.
     
  7. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Wow! 1.7GB is a huge memory usage indeed.
    I'm not sure why it's consuming so much memory in your specific case.
    I'm getting a new iOS device this week and will profile the loading on it.

    The temporary textures creation is unavoidable at the moment when mip-mapping is created or a normal map texture is loaded as pixel-data should be manipulated in these cases. I can skip the texture duplication on normal map creation by the way, I'll do some tests, but the mip-mapping creation requires a new texture anyway.

    Best regards,
    Ricardo Reis.
     
  8. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    Are you using any special AssetLoaderOptions config?

    Passing "true" to your AssetLoaderOptions.UseOriginalPositionRotationAndScale instance should keep the GameObject aligned/scaled as the original source model.

    Best regards,
    Ricardo Reis.
     
  9. CAD_Schroer_GmbH

    CAD_Schroer_GmbH

    Joined:
    Jan 23, 2017
    Posts:
    14
    Hi Rockomax,

    I have a problem with the current version (1.8.9b).

    On windows my models looks good, but on Android the models are broken.

    Windows:
    v12Windows.png

    Android:
    V12Android.png

    can you help me with a fix?

    Regards,
    CAD Schroer GmbH
     
  10. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    I voted it up, this functionality is urgent for me. I suppose I can get away with writing my own quick import/export for .obj as a temporary solution. I would appreciate if others on the forum up vote the issue as well.

    Also are there any plans to implement the export features of assimp? What part of the wrapper do I need to call to access those functions?
     
  11. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    Other users are having issues with Android, I will be working on the issues during this week.

    Best regards,
    Ricardo Reis.
     
  12. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    There are no plans for an exporter at the moment since the importer needs a bit more of stability.

    If you want to implement it on your own using TriLib as base, I can give you access to TriLib GitHub repository which contains some information on how to compile it for many platforms and contains my modified Assimp version.

    Best regards,
    Ricardo Reis.
     
  13. EnduvoJD

    EnduvoJD

    Joined:
    Aug 12, 2016
    Posts:
    53
    Is anyone able to import models with a metallic map using the Standard shader with Trilib (without having to manually assign the texture to the metallic slot)? Does anyone have any example 3D models that have this working?

    If so, what program was used to create the model and what property was the texture assigned to?

    EDIT: I was able to import the metallic texture after using Blender to assign the texture to the hardness value of the blender material (which corresponded to "ShininessExponent" in the FBX). Though, I can't get any settings to affect the smoothness value that Trilib imports to the Standard Shader.
     
    Last edited: Aug 8, 2019
  14. Tofu-Huang

    Tofu-Huang

    Joined:
    Aug 25, 2015
    Posts:
    7
    Hi
    I have a problem when i load fbx file runtime.
    the normal map texture turns "pink" ...

    0130.png
     
  15. EnduvoJD

    EnduvoJD

    Joined:
    Aug 12, 2016
    Posts:
    53
    I'm seeing that result as well. (The normal map has the same features, but it's pink). Does that mean values are in a different channel?
     
  16. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Normal maps appear pink in the editor because there is a color conversion made by TriLib so the normal map is readable by Unity, since the compression/format used in normal maps is not acessible outside Unity Editor.

    Your normal map should work fine anyway.
     
    Last edited: Aug 8, 2019
  17. EnduvoJD

    EnduvoJD

    Joined:
    Aug 12, 2016
    Posts:
    53
    Do you have any 3D model examples that Trilib imports with a smoothness value >0 for the standard shader (not specular setup)? I'm trying to find a workflow where Glossiness and GlossMapScale are not 0.
     
  18. EnduvoJD

    EnduvoJD

    Joined:
    Aug 12, 2016
    Posts:
    53
    I had to change aiMaterial_GetShininess and aiMaterial_GetShininessStrength in AssimpInterop in order to get non-zero values for these. I changed it to read similar to the aiMaterial_GetOpacity, so the floatOut values would get assigned.
     
  19. Tofu-Huang

    Tofu-Huang

    Joined:
    Aug 25, 2015
    Posts:
    7
    my normal map didn't work fine on ios & editor...
    it's seems red channel is set to alpha channel?
     
  20. Tofu-Huang

    Tofu-Huang

    Joined:
    Aug 25, 2015
    Posts:
    7
    Got same error "Unable to find libassimp" on Android
    Unity 2017.4.30f1, Unity 2017.4.3f1
     
  21. SolidVirtual

    SolidVirtual

    Joined:
    Jan 18, 2016
    Posts:
    3
  22. Bernhard007

    Bernhard007

    Joined:
    Feb 22, 2018
    Posts:
    2
    Hi @rickomax

    Bought your trilib package yesterday, working great with importing anything through the asset loader sample scene, both from HD storage and URI.
    The only thing not working is when Im trying to load .zip files? (Even your example from: https://ricardoreis.net/trilib/test1.zip). It downloads the package and then gives me the error:

    System.Exception: Error loading asset. Assimp returns: [No suitable reader found for the file format of file "$$$___magic___$$$..zip".]
    at TriLib.AssetLoaderBase.InternalLoadFromMemory (System.Byte[] fileBytes, System.String filename, System.String basePath, TriLib.AssetLoaderOptions options, System.Boolean usesWrapperGameObject, TriLib.AssimpInterop+DataCallback dataCallback, TriLib.AssimpInterop+ExistsCallback existsCallback, TriLib.LoadTextureDataCallback loadTextureDataCallback, TriLib.AssimpInterop+ProgressCallback progressCallback, TriLib.FileLoadData customFileLoadData) [0x000a2] in D:\XRai\ModelImporter\ModelImporter\Assets\TriLib\TriLib\Scripts\AssetLoader\AssetLoaderBase.cs:695
    at TriLib.AssetLoaderBase.InternalLoadFromMemoryAndZip (System.Byte[] data, System.String assetExtension, System.String basePath, TriLib.AssetLoaderOptions options, System.Boolean usesWrapperGameObject, TriLib.AssimpInterop+DataCallback dataCallback, TriLib.AssimpInterop+ExistsCallback existsCallback, TriLib.LoadTextureDataCallback loadTextureDataCallback, TriLib.AssimpInterop+ProgressCallback progressCallback) [0x00003] in D:\XRai\ModelImporter\ModelImporter\Assets\TriLib\TriLib\Scripts\AssetLoader\AssetLoaderBase.cs:907
    at TriLib.AssetLoader.LoadFromMemoryWithTextures (System.Byte[] fileData, System.String assetExtension, TriLib.AssetLoaderOptions options, UnityEngine.GameObject wrapperGameObject, System.String basePath, TriLib.AssimpInterop+DataCallback dataCallback, TriLib.AssimpInterop+ExistsCallback existsCallback, TriLib.AssimpInterop+ProgressCallback progressCallback) [0x00014] in D:\XRai\ModelImporter\ModelImporter\Assets\TriLib\TriLib\Scripts\AssetLoader\AssetLoader.cs:132
    at TriLib.AssetDownloader+<DoDownloadAsset>d__22.MoveNext () [0x0018c] in D:\XRai\ModelImporter\ModelImporter\Assets\TriLib\TriLib\Scripts\AssetLoader\AssetDownloader.cs:230

    Am I missing something?

    Running Unity 2019.1.6f1
    Trilib version 1.8.9b

    Thanks in advance!

    EDIT: Nevermind, forgot to tick the ENABLE ZIP LOADING option.
     
    Last edited: Aug 19, 2019
  23. CAD_Schroer_GmbH

    CAD_Schroer_GmbH

    Joined:
    Jan 23, 2017
    Posts:
    14
    Hi Ricardo,

    we have fix the problem by using:
    LoaderOptions.Use32BitsIndexFormat = true;

    Regards,
    CAD Schroer
     
  24. NadiaUnity

    NadiaUnity

    Joined:
    Sep 13, 2018
    Posts:
    1
    Hi,

    Thanks to your plugin we're able to launch our application smoothly.
    But we have problems with the build size being too big on APK file.
    We've investigated the APK by unzipping it and look at the files inside APK.
    We found out that the file called "libassimp.so" take a huge space from overall build size.
    It might because we're building x64 bit APK so the build file size is over 200MB.
    Are there anyways to reduce build size with Trilib plugin being used?

    As you can see below, libassimp.so took about half of the build size.
    upload_2019-8-20_15-51-50.png
     
  25. Tohrak

    Tohrak

    Joined:
    Nov 2, 2015
    Posts:
    12
    Hello,
    I'm having an issue with this library when I use it with IOS. Seams like a memory issue.
    There is the Xcode log :


    I tried to use sample scene and it still didn't works. Can some one help me please ? :)

    ps : Everything works fine with Android.

    ps 2 : I did manage to make this library works with IOS when it's the only thing in my project. When I have all my assets in the project, it doesn't works anymore. I don't know what can cause this issue.
    Both project use the same Unity version, same Trilib version and same Scene.
    Could this be a problem with another Plugin ?
     
    Last edited: Aug 22, 2019
  26. unity_8rSx27Fqhg0e7w

    unity_8rSx27Fqhg0e7w

    Joined:
    Aug 23, 2019
    Posts:
    1
    About Android Build Error: Unable to load DLL 'libassimp'
    I have some ideas. I build with 2017.4.30f1 IL2CPP in Windows 10. Hope help someone.

    Here is my steps to fix:
    1. import TriLib.
    2. move folder TriLib/Plugins/Plugins/Android/arm64 & TriLib/Plugins/Plugins/Android/armeabi-v7a out of your Project.
    3. refresh Project. ( only focus on editor after move folders )
    3. delete *.meta in both folders.
    4. move both folder back
    5. wait Unity create new meta files
    6. set platform setting of libassimp.so & libstb_image.so correctly ( armv7 or arm64 )
    7. try to build android

    If there has libassimp.so & libstb_image.so in your apk/lib/arm64-v8a & apk/lib/armeabi-v7a that will be success.
     
    mmmistercrow likes this.
  27. Arcan-Studios

    Arcan-Studios

    Joined:
    Mar 12, 2015
    Posts:
    58
    hi, i have problems load in webgl compiled version, i tried with sample scene : asset loader
    the error in browser:

    An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
    uncaught exception: abort(-1) at jsStackTrace (compilacionesPruebas.wasm.framework.unityweb:2:15158)
    stackTrace (compilacionesPruebas.wasm.framework.unityweb:2:15329)
    onAbort@http://localhost:55238/Build/UnityLoader.js:4:9327
    abort (compilacionesPruebas.wasm.framework.unityweb:2:510880)
    _aiGetExtensionList (compilacionesPruebas.wasm.framework.unityweb:2:220837)

    error in browser conlose log:

    RemoteWebProgress failed to call onStatusChange: [Exception... "JavaScript component does not have a method named: "onStatusChange"'JavaScript component does not have a method named: "onStatusChange"' when calling method: [nsIWebProgressListener::eek:nStatusChange]" nsresult: "0x80570030 (NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED)" location: "JS frame :: resource://gre/modules/RemoteWebProgress.jsm :: _callProgressListeners :: line 103" data: no]

    in editor works well, only fail in compiled webgl version, when i tried to compile i have an error
    i fix deleting all pluging folder but webgl in webgl i have to delete emscripten 1.40

    load remote and local fail.
    the demo
    http://ricardoreis.net/trilib/demo/
    works well
     
    Last edited: Aug 26, 2019
  28. Chopium

    Chopium

    Joined:
    Jun 15, 2015
    Posts:
    19
    I have the same problem with android using 2019.1.10 but the fix doesn't appear to do it for me. Works fine with a Mono backend but not IL2CPP. Unfortunately Mono builds are incompatible with the Play Store now.
     
  29. NaveenSellamuthu

    NaveenSellamuthu

    Joined:
    Aug 27, 2019
    Posts:
    4
    Hello all,

    I have used the trilib plug-In in my unity project to load a 3d model file to the hololens device at the runtime.

    The model is uploaded at the azure cloud database.

    I am successfully able to load the models below 30mb.

    But when the model size increases, the model is not loading.

    I have attached the error screenshot for the referance.

    It would be helpful, if you suggest how to fix this issue.
    upload_2019-8-27_20-8-38.png

    Thanks in advance.
     
  30. CAD_Schroer_GmbH

    CAD_Schroer_GmbH

    Joined:
    Jan 23, 2017
    Posts:
    14
    Hallo Guys,

    is it somehow possible to get the "UnitScaleFactor" out of the .FBX file?
    Through the "AssetLoaderOptions" or the "AdvancedAssetLoaderOptions" it does not seem to be possible.

    Best Regards,
    CAD Schroer
     
  31. huafengw

    huafengw

    Joined:
    Sep 12, 2018
    Posts:
    6
    Hi @rickomax,

    When I used your trilib demo AssetLoader.exe to load fbx, it could read the Blend Shape successfully.
    but in my code, the returned GetComponentInChildren<SkinnedMeshRenderer>().sharedMesh.blendShapeCount is 0,
    any suggesstions?
    or can you share the AssetLoader.exe code to get the blendShapeCount?

    Thank you in advanced!
     

    Attached Files:

  32. huafengw

    huafengw

    Joined:
    Sep 12, 2018
    Posts:
    6
    Hi @rickomax,
    Please ignore the last mail, after updated the trilib to the latest version, it works!
     
  33. uz986

    uz986

    Joined:
    Oct 29, 2017
    Posts:
    12
    i am having same problem on android...app crashes when loading heavy models..atleast can there be a workaround which make the app dont crash so i can just show on canvas model cant be loaded.

    as far as i understand ai_ImportFileFromMemoryWithProperties or ai_ImportFileFromMemory causes the crash and try catch still make the app crash...i just want to prevent crash..
    Anyway to do this would be a great help
     
  34. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Thank you for your feedback. This issue has been fixed and that will be included on the next update.

    Best regards,
    Ricardo Reis.
     
  35. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    What is your Unity version?
     
  36. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    What's the Android device you're deploying to?
     
  37. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    Blend-shapes won't work well on meshes with multiple-materials, I will be fixing that as soon as possible.

    Best regards,
    Ricardo Reis.
     
  38. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Thank you for your feedback. This option is disabled on Android by default, as some old devices can't handle more than 65k vertices. I will investigate it later, since it should be working fine on any device.
     
  39. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    I'll investigate a solution to decrease the libraries size.

    Best regards,
    Ricardo Reis.
     
  40. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    By the error log you sent, looks like iOS can't allocate more memory to process the model when it's loaded. Have you tried loading simple models (no textures and low poly-count) when your project has all the files?
     
  41. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    I guess some issues are due to Unity 2017.4.1f1 (minimum TriLib target) doesn't being enable to configure Android ARM64 libraries. I can't see any solution for this issue, besides increasing the minimum Unity version required by TriLib or checking the metafiles with TriLib to ensure they're configured properly.
     
  42. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    By the way you're using an older TriLib install. Could you clean-up your TriLib files and install the latest update?
     
  43. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    This issue seems to be caused by wrong "libassimp.so" and "libstb_image.so" metadata files. I'm already looking for a solution to be included on the next update.
     
  44. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    Could you send your model for testing to "contato@ricardoreis.net"?
     
  45. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    Please refer to: https://ricardoreis.net/?p=341
     
  46. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Runtime loading requires a lot of memory, indeed, but I've been able to load meshes with high poly-counts (>65k) on older Android devices with no issues, maybe your model also have big embedded textures?
     
  47. uz986

    uz986

    Joined:
    Oct 29, 2017
    Posts:
    12
    Thank you for replying. Basically i am making project for someone and i need to be able load any model...mostly models works fine and some with embedded textures too and also i am loading them on samsung galaxy s8. i believe you are right the models which are making the app crash does have high poly counts and texture in them maybe that is what causing it.

    and for now it fine if i cant load them but crashing of application is really bad user experience so i just want to limit that application dont allow to load such heavy models with certian amount high poly counts and textures..Is there any way i can put limit and just display cant load this model?

    It would be really great help if you can tell me something for this. Thank you again
     
  48. Tohrak

    Tohrak

    Joined:
    Nov 2, 2015
    Posts:
    12
    Hello, thanks for the reply.

    I did tried to load very simple models but it didn't works. But I also tried to remove each plugin one by one and found the plugin with the issue. I will investigate more because I don't know yet why this plugin and your are not compatible.
     
  49. SolidVirtual

    SolidVirtual

    Joined:
    Jan 18, 2016
    Posts:
    3
    Well ive got only one material ...
     

    Attached Files:

    • 1.JPG
      1.JPG
      File size:
      68.5 KB
      Views:
      588
  50. Tofu-Huang

    Tofu-Huang

    Joined:
    Aug 25, 2015
    Posts:
    7
    I fix this issue by
    #676