Search Unity

TriLib - Model Loading Package

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

  1. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    I will test using your Unity version and answer here.
     
  2. deanryanvr2019

    deanryanvr2019

    Joined:
    Apr 12, 2019
    Posts:
    15
    Thanks
     
  3. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    I've tested on the same Unity version as yours and got no issues....
    Could you check if all plugins inside the "Plugins" folder are enabled for "All Platforms"?
     
  4. All_American

    All_American

    Joined:
    Oct 14, 2011
    Posts:
    1,528
    @rickomax

    I need to keep the models in the app after downloading. After exiting and returning.
     
  5. Malley13

    Malley13

    Joined:
    Jul 15, 2018
    Posts:
    5
    @rickomax I was still not able to sort my problem out I have tested it on many different phones and different versions of Android now. Using the default AssetLoader scene I can't load a model on the phone the app works but it doesn't show any files to open. It worked on the first few builds. But when it worked it used to ask for permissions to access files and it doesn't do that on any of the new builds.
     
  6. deanryanvr2019

    deanryanvr2019

    Joined:
    Apr 12, 2019
    Posts:
    15
    YEs they are all enabled

    still getting that issue

    only way to fix it is reimport but i cant do that every time

    Thanks
     
  7. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    Does it happens when you import TriLib to an empty project?
     
  8. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    You could save them on a local folder and load them again with TriLib, but the best option would be serializing/saving them to a custom format which you could load faster.

    There are some open-source options to do that, but you may have to tweak them to work for your needs:
    https://github.com/Mcklem/JSONGameObject
     
  9. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    I'm checking it out.
     
  10. EdgarSantos

    EdgarSantos

    Joined:
    Nov 11, 2013
    Posts:
    27
    Thank you. Do you have a estimate of when I can test it again?
    Keep up the good work :)
     
  11. All_American

    All_American

    Joined:
    Oct 14, 2011
    Posts:
    1,528
    I will check it out. I’m downloading the models at runtime. So hopefully it’s possible to save them With serializing.
     
  12. smartinetz

    smartinetz

    Joined:
    Dec 8, 2017
    Posts:
    49
    Any news on the problems loading multiple large texture maps.
     
  13. All_American

    All_American

    Joined:
    Oct 14, 2011
    Posts:
    1,528
    So to update, do we just import the new package over the last one?
     
  14. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    For TriLib 2, yes. You can't update TriLib 2 over TriLib 1 as they aren't compatible.
     
  15. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    I've fixed some issues with the PNG textures reader. If your textures are on PNG format, that may fix your issues. I'm working on another fixes and gonna update the beta version soon.
     
    karolrecko likes this.
  16. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Sorry, not yet!
    I've been pretty busy lately, but I'm slowly organizing the next TriLib 1 update.
     
  17. Smaika

    Smaika

    Joined:
    Apr 28, 2014
    Posts:
    14
    Hi,
    Is it possible to save loaded 3D models as prefabs on the Resource folder for example so I could allow players to use those prefabs later?
     
  18. All_American

    All_American

    Joined:
    Oct 14, 2011
    Posts:
    1,528

    Rgr that
     
  19. reckodata

    reckodata

    Joined:
    Oct 21, 2017
    Posts:
    6
    Hi,

    recently i bought TriLib for Unity. Could you please advise me how to download .fbx file from server with texture (or .obj with .mtl)?
    i am developing on mac for iOS. and it works fine while importing same model from local storage but not from server.
     
    ina likes this.
  20. reckodata

    reckodata

    Joined:
    Oct 21, 2017
    Posts:
    6
  21. All_American

    All_American

    Joined:
    Oct 14, 2011
    Posts:
    1,528
    What script are you using to download?
     
  22. reckodata

    reckodata

    Joined:
    Oct 21, 2017
    Posts:
    6
    Hi:)

    thanks for reply.
    I am using sample from TriLib import which is: Scene1 - Asset Loader.unity
    There are two options. First one to load data from local storage - which works fine. Second, Load Remote Asset (URI) which correctly download and display model but texture is missing.

    If you want me to copy paste code from sample please let me know.

    Thanks!
     
    Last edited: Dec 9, 2019
  23. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    TriLib 2.0 beta version updated:
    OBJ loader fixes.
    STL loader fixes.
    Added automatic alpha material checking.
    Added URI downloading and updated sample.
    Misc fixes.

    Existing users, download at:
    https://ricardoreis.net?p=217
     
    smartinetz likes this.
  24. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    Loading textures from the downloaded model works as long as your model is inside a ZIP file.
     
  25. AnthonyKozak

    AnthonyKozak

    Joined:
    Feb 4, 2019
    Posts:
    6
    Hi,
    this the error I got, building for webgl with trilib 1.9 on Unity 2019.3f1. any idea ?

    Code (CSharp):
    1. Failed running "C:/Program Files/Unity/Hub/Editor/2019.3.0f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe" -E "C:/Program Files/Unity/Hub/Editor/2019.3.0f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten\emcc" @"D:\UNITY\UNITY - PROJECTS  - UNITY2018\WebglGLTF\Assets\..\Temp\emcc_arguments.resp"
    2.  
    3. stdout:
    4. stderr:warning: unexpected number of arguments 1 in call to '__cxa_pure_virtual', should be 0warning: unexpected return type i32 in call to 'aiSetImportPropertyInteger', should be voidwarning: unexpected return type i32 in call to 'aiSetImportPropertyFloat', should be voidwarning: unexpected return type i32 in call to 'aiSetImportPropertyString', should be voidwarning: unexpected return type i32 in call to 'aiSetImportPropertyMatrix', should be voidwarning: unexpected number of arguments 2 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 4 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 5 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 4 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 2 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 3 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected return type i32 in call to 'ReleaseUnityMesh', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voidwarning: unexpected number of arguments 1 in call to '_ZNKSt3__28ios_base6getlocEv', should be 2warning: unexpected return type %"class.std::__2::locale::__imp"* in call to '_ZNKSt3__28ios_base6getlocEv', should be voiderror: unresolved symbol: _ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE2atEjerror: unresolved symbol: _ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4findEcjerror: unresolved symbol: _ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5rfindEcjerror: unresolved symbol: _ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEjjPKcjerror: unresolved symbol: _ZNSt3__212__next_primeEjerror: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE2atEjerror: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5eraseEjjerror: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcjerror: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcjjerror: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKcjerror: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertEjPKcerror: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertEjPKcjerror: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6resizeEjcerror: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEjjPKcerror: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEjerror: unresolved symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_jjRKS4_error: unresolved symbol: _ZNSt3__213basic_istreamIcNS_11char_traitsIcEEE4readEPcierror: unresolved symbol: _ZNSt3__219__shared_weak_count12__add_sharedEverror: unresolved symbol: _ZNSt3__219__shared_weak_count16__release_sharedEverror: unresolved symbol: _Znajerror: unresolved symbol: _Znwjerror: unresolved symbol: _ZnwjRKSt9nothrow_tAborting compilation due to previous errors | undefinedTraceback (most recent call last):  File "C:\Program Files\Unity\Hub\Editor\2019.3.0f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc.py", line 3063, in <module>    sys.exit(run())  File "C:\Program Files\Unity\Hub\Editor\2019.3.0f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc.py", line 1780, in run    final = shared.Building.emscripten(final, append_ext=False, extra_args=extra_args)  File "C:\Program Files\Unity\Hub\Editor\2019.3.0f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\shared.py", line 2274, in emscripten    emscripten._main(cmdline)  File "C:\Program Files\Unity\Hub\Editor\2019.3.0f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 2233, in _main    return temp_files.run_and_clean(lambda: main(  File "C:\Program Files\Unity\Hub\Editor\2019.3.0f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\tempfiles.py", line 93, in run_and_clean    return func()  File "C:\Program Files\Unity\Hub\Editor\2019.3.0f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 2238, in <lambda>    DEBUG=DEBUG,  File "C:\Program Files\Unity\Hub\Editor\2019.3.0f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 2164, in main    temp_files=temp_files, DEBUG=DEBUG)  File "C:\Program Files\Unity\Hub\Editor\2019.3.0f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 86, in emscript    glue, forwarded_data = compiler_glue(metadata, libraries, compiler_engine, temp_files, DEBUG)  File "C:\Program Files\Unity\Hub\Editor\2019.3.0f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 218, in compiler_glue    glue, forwarded_data = compile_settings(compiler_engine, libraries, temp_files)  File "C:\Program Files\Unity\Hub\Editor\2019.3.0f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 541, in compile_settings    cwd=path_from_root('src'), error_limit=300)  File "C:\Program Files\Unity\Hub\Editor\2019.3.0f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\jsrun.py", line 132, in run_js    raise Exception('Expected the command ' + str(command) + ' to finish with return code ' + str(assert_returncode) + ', but it returned with code ' + str(proc.returncode) + ' instead! Output: ' + str(ret)[:error_limit])Exception: Expected the command ['C:/Program Files/Unity/Hub/Editor/2019.3.0f1/Editor/Data\\Tools\\nodejs\\node.exe', '--stack_size=8192', '--max-old-space-size=4096', 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.3.0f1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\Emscripten\\src\\compiler.js', 'C:\\Users\\Pingu\\AppData\\Local\\Temp\\tmpgfibrz.txt', 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.3.0f1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\lib\\Audio.js', 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.3.0f1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\lib\\Cursor.js', 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.3.0f1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\lib\\Eval.js', 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.3.0f1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\lib\\FileSystem.js', 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.3.0f1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\lib\\Logging.js', 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.3.0f1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\lib\\Profiler.js', 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.3.0f1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\lib\\SystemInfo.js', 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.3.0f1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\lib\\UnetWebSocket.js', 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.3.0f1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\lib\\Video.js', 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.3.0f1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\lib\\WebCam.js', 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.3.0f1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\lib\\WebRequest.js', 'D:\\UNITY\\UNITY - PROJECTS  - UNITY2018\\WebglGLTF\\Assets\\TriLib\\Plugins\\WebGL\\JsHelperNative.jslib', 'C:\\Program Files\\Unity\\Hub\\Editor\\2019.3.0f1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\Emscripten\\src\\library_pthread_stub.js'] to finish with return code 0, but it returned with code 1 instead! Output: // The Module object: Our interface to the outside world. We import// and export values on it. There are various ways Module can be used:// 1. Not defined. We create it here// 2. A function parameter, function(Module) { ..generated code.. }// 3. pre-run appended it, var Module = {}; ..generated
    5. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    6.  
     
  26. SivaVelusamy

    SivaVelusamy

    Joined:
    Jun 20, 2019
    Posts:
    6
    Hi richomax :)!
    • Initially I used trlib 1.9 version in my project. Now i tried to replace it with trilib 2.0(beta version)as you suggested it does not replaces the old version. New folder was created in name of TriLibCore.
    • I have called the LoadFromFile() in the trilib 1.9, but in trilib 2.0 it is renamed as LoadModelFromFile() with different parameters. I am unable fix the issues :( with this new parameters and I kindly look forward for your help.
    It would be helpful, if you suggest how to fix this issue.
    Thanks in advance :).
     
  27. All_American

    All_American

    Joined:
    Oct 14, 2011
    Posts:
    1,528

    You have to get rid of 1.9 all together 2.0 is a different build all together. Going forward you can just overwrite it when updating. After you install 2.x
     
  28. Malley13

    Malley13

    Joined:
    Jul 15, 2018
    Posts:
    5
  29. deanryanvr2019

    deanryanvr2019

    Joined:
    Apr 12, 2019
    Posts:
    15
    Hi Rickomax,

    Can you show me an example of a collection of models being loaded in at once, please

    having a lot of issues trying to load more than one model in a loop

    on complete function in the

    is there going to be a fix for this or how do we get around it

    Code (CSharp):
    1.   public static async Task<AssetLoaderContext> LoadModelFromFile(string path, Action<AssetLoaderContext> onLoad, Action<AssetLoaderContext> onTexturesLoad, Action<float> onProgress,
    2.                 Action<object> onError = null, GameObject wrapperGameObject = null, AssetLoaderOptions assetLoaderOptions = null, object customContextData = null)
    3.             //public static async Task<AssetLoaderContext> LoadModelFromFile(string path, Action<VREAssetLoaderContext> onLoad, Action<AssetLoaderContext> onTexturesLoad, Action<float> onProgress, Action<object> onError = null, GameObject wrapperGameObject = null, AssetLoaderOptions assetLoaderOptions = null, object customContextData = null)
    4.         {
    5.             var newAssetLoaderContext = new AssetLoaderContext
    6.             {
    7.                 Options = assetLoaderOptions ? assetLoaderOptions : CreateDefaultLoaderOptions(),
    8.                 BasePath = FileUtils.GetFileDirectory(path),
    9.                 OnTexturesLoad = onTexturesLoad,
    10.                 OnLoad = onLoad,
    11.                 OnProgress = onProgress,
    12.                 CustomData = customContextData
    13.             };
    14.             ThreadUtils.RunThread(newAssetLoaderContext, delegate(object context)
    15.             {
    16.                 var assetLoaderContext = (AssetLoaderContext) context;
    17.                 if (assetLoaderContext.Options.MaterialMappers != null)
    18.                 {
    19.                     Array.Sort(assetLoaderContext.Options.MaterialMappers, (a, b) => a.CheckingOrder > b.CheckingOrder ? -1 : 1);
    20.                 }
    21.                 else
    22.                 {
    23.                     Debug.Log("Warning: your AssetLoaderOptions instance has no MaterialMapper. TriLib can't process materials without them.");
    24.                 }
    25.  
    26.                 var fileExtension = FileUtils.GetFileExtension(path, false).ToLowerInvariant();
    27.                 using (var fileStream = new FileStream(path, FileMode.Open))
    28.                 {
    29.                     var reader = Readers.FindReaderForExtension(fileExtension);
    30.                     if (reader != null)
    31.                     {
    32.                         assetLoaderContext.RootModel = reader.ReadStream(fileStream, assetLoaderContext, path, onProgress);
    33.                     }
    34.                 }
    35.             }, delegate(object context)
    36.             {
    37.                 var assetLoaderContext = (AssetLoaderContext) context;
    38.                 ProcessModel(assetLoaderContext, wrapperGameObject);
    39.                 if (assetLoaderContext.Options.AddAssetUnloader && assetLoaderContext.RootGameObject != null)
    40.                 {
    41.                     assetLoaderContext.RootGameObject.AddComponent<AssetUnloader>();
    42.                 }
    43.  
    44.                 if (assetLoaderContext.OnLoad != null)
    45.                 {
    46.                     assetLoaderContext.OnLoad(assetLoaderContext);
    47.                 }
    48.  
    49.                 if (assetLoaderContext.LoadingTextures.Count == 0 && assetLoaderContext.OnTexturesLoad != null)
    50.                 {
    51.                     assetLoaderContext.OnTexturesLoad(assetLoaderContext);
    52.                     Debug.Log("COMPLETED TAKED WHEN ALL DONE");
    53.                 }
    54.             }, onError);
    55.             return newAssetLoaderContext;
    56.         }
     
  30. AP-3

    AP-3

    Joined:
    Dec 10, 2019
    Posts:
    3
    Howdy! I was wondering if it's possible to configure TriLib to ignore attributes and nodes in X3D files during the initial import process. Assimp and TriLib don't like the model I'm currently using for testing and I get this error:

    Exception: Error loading asset. Assimp returns: [Node <Shape> has incorrect attribute "render".]
    TriLib.ThreadUtils+<>c__DisplayClass0_1.<RunThread>b__1 () (at Assets/TriLib/TriLib/Scripts/Extensions/ThreadUtils.cs:57)
    TriLib.Dispatcher.Update () (at Assets/TriLib/TriLib/Scripts/Extensions/Dispatcher.cs:79)


    Likewise, I get this error for files that include a DepthField node. However, if I remove these attributes manually in a text editor, the X3D files import fine. With that in mind, is there a way to define a list of attributes and nodes to ignore during the import process?
     
  31. AnthonyKozak

    AnthonyKozak

    Joined:
    Feb 4, 2019
    Posts:
    6

    Does anyone succeed to compile trilib for webgl ? Which Unity version should be used & settings ?
    Thanks !
     
  32. AP-3

    AP-3

    Joined:
    Dec 10, 2019
    Posts:
    3
    Ricardo can correct me if I'm wrong, but it doesn't work in Unity 2019:
    WebGL:
    Unity 2019 is not supported at the moment. We are working on a solution for this issue.
    Unity support link: https://fogbugz.unity3d.com/default.asp?1163092_ata4ac2o89voc2fn


    https://ricardoreis.net/?p=127
     
  33. deanryanvr2019

    deanryanvr2019

    Joined:
    Apr 12, 2019
    Posts:
    15
    zip file do not work either, i have a zip with 2 files in it but only loads 1 of the files
     
  34. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,279
    TriLib is useful but you can end up with a big tree of transforms and multiple meshes (even with combineMeshes set to true). Is there an easy way to combine all this into 1 game object with no tree of parts?
     
  35. smartinetz

    smartinetz

    Joined:
    Dec 8, 2017
    Posts:
    49
    Downloaded the latest update but still having trouble with texture mapping. PNG or JPG files both don't seem to load properly. :(

    Regards

    Code (CSharp):
    1. IOException: Sharing violation on path /Users/......./Library/Application Support/....../....../AnimationObjects/RaspberryPiDiffuse.png
    2. TriLibCore.Utils.ThreadUtils+<>c__DisplayClass0_0`1[T].<RunThread>b__0 () (at Assets/TriLibCore/Scripts/Utils/ThreadUtils.cs:68)
    3. System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    4. System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    5. System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    6. System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    7. System.Threading.ThreadHelper.ThreadStart () (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    8. UnityEngine.UnhandledExceptionHandler:<RegisterUECatcher>m__0(Object, UnhandledExceptionEventArgs)
     
    Last edited: Dec 12, 2019
  36. reckodata

    reckodata

    Joined:
    Oct 21, 2017
    Posts:
    6

    Perfect. Thanks!

    it worked out for .obj model but i am still facing issue with .fbx file texture. Any suggestion?
     
  37. SivaVelusamy

    SivaVelusamy

    Joined:
    Jun 20, 2019
    Posts:
    6
    Thank you All_American for your kind reply :)
    I have tried to replace the trilib version but i could not. Sorry , I can't understand what you said in previous reply. Could you explain me in detail, how to replace the trilib verion 1.9 to trilib 2.0 (Beta Version) in my project.
    Thanks in Advance..
     
  38. All_American

    All_American

    Joined:
    Oct 14, 2011
    Posts:
    1,528

    In your project delete all the trilib files/folders and then instasll the trilib 2.0. Make a back up first.
     
  39. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    I'm working on TriLib 1.9.0 to even it with current Assimp branch, I'm also making some changes to make the code basically the same as Assimp one, so updating TriLib Assimp version will be easier.
     
    mfleurent likes this.
  40. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    have the iOS issues been fixed?
     
  41. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Not yet, but I will re-test every platform before the new 1x update, which should come next week.
     
  42. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Do you know if the textures are embedded or external files? If external, they should be at the same folder as the model.
     
  43. timoctrl

    timoctrl

    Joined:
    May 30, 2017
    Posts:
    5
    You can solve this by manually linking the Trilib iOS library files in XCode. For some reason they are not anymore linked automatically.

    EDIT: The reason is the line 133 in TrilibCheckPlugins.cs, which apparently should end with something like
    ? "release.a" : "debug.a";
    or it will not choose the correct versions and just disable all iOS dependencies. After this change the correct files are included and XCodes builds the project fine.
     
    Last edited: Dec 18, 2019
  44. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    The next TriLib update changes how the iOS plugins are handled.
    You will be able to switch from IOS Device to IOS Simulator on TriLib Settings area.
     
  45. timoctrl

    timoctrl

    Joined:
    May 30, 2017
    Posts:
    5
    That sounds great, the more straight forward the build process is, the better!

    Another thing, if anyone wants to use TriLib 1.9.0 with Unity 2019.3 and iOS, you need to make the following change to the same TriLibCheckPlugins.cs in order to set the correct XCode settings:

     
    #if UNITY_2019_3_OR_NEWER
    var targetGuid = pbxProject.GetUnityFrameworkTargetGuid();
    #else
    var targetGuid = pbxProject.TargetGuidByName (PBXProject.GetUnityTargetName ()); //Original line
    #endif
     
  46. SivaVelusamy

    SivaVelusamy

    Joined:
    Jun 20, 2019
    Posts:
    6
    Hi All_American !
    I have done what you have said in Previous replay . But inTrilib 2.x there is no function named LoadFromFile() , it was renamed to LoadModelFromFile() with new parameters. How can i call new function with new parameters from my old code.
     
    Last edited: Dec 23, 2019
  47. visualjoy

    visualjoy

    Joined:
    Aug 23, 2016
    Posts:
    38
    Olá Ricardo, tudo bem?

    Eu te mandei essas dúvidas por email, mas não tive retorno.

    1 - Estava fazendo uns testes e tentei importar um arquivo .glb
    As cores em si veio tudo certo, mas o alpha não foi aplicado, sendo que num arquivo collada(.dae) o alpha é aplicado. Isso seria algum bug no trilib ou é problema do arquivo em si que não tem essa opção?


    GetAssetLoaderOptions:
    var assetLoaderOptions = AssetLoaderOptions.CreateInstance();
    assetLoaderOptions.DontLoadCameras = false;
    assetLoaderOptions.DontLoadLights = false;
    assetLoaderOptions.UseOriginalPositionRotationAndScale = true;
    assetLoaderOptions.ApplyColorAlpha = true;
    assetLoaderOptions.ScanForAlphaMaterials = true;
    assetLoaderOptions.AddAssetUnloader = true;
    return assetLoaderOptions;

    2 - Eu queria verificar a cor do material no OnMaterialCreated, pegando o material, mas ele retorna sempre em branco (1.0, 1.0, 1.0, 1.0). Vi que não existe a propriedade _Color quando entra nessa função. Precisaria ativar alguma coisa no AssetLoader ou algum problema com a TriLib?

    assetLoader.OnMaterialCreated += LoadMaterial;
    private void LoadMaterial(uint materialIndex, bool isOverriden, Material material)
    {
    for (int i = 0; i < material.GetTexturePropertyNames().Length; i++)
    { Debug.Log(material.name + " : " + material.GetTexturePropertyNames());
    }
    Debug.Log(material.name + " : " + material.color);
    }
     
  48. All_American

    All_American

    Joined:
    Oct 14, 2011
    Posts:
    1,528

    I haven’t looked at that code yet. But it’s gotta be easier than the download from internet one.

    It was hard for me to understand it but once you work through the examples it will become clear.

    Use the example.
     
  49. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    683
    Hi!

    I've updated TriLib 2.0 beta version.

    Download link for existing users:
    https://ricardoreis.net?p=217

    Changelist:
    • Misc fixes.
    • Added non-default pipeline materials usage to the package (work in progress).
    • Added STL parser (work in progress).
    • Added initial GLTF 2.0 parser (work in progress).
    • Changed material creation pipeline to allow checking alpha pixels and fixing normal maps automatically.
    Regarding TriLib 2.0 usage, since it's a beta version, I haven't written any docs yet, besides some docs you will find on the sample scene scripts, the usage should be pretty straightforward when copying the code from the sample.

    I apologize for 1.9.1 legacy update, which should come with the latest Assimp fixes.
    The legacy update should be ready soon, I will answer the e-mails as soon as I have the 1.9.1 update out, so we can remove already fixed issues from the way.

    Best regards,
    Ricardo Reis.
     
    Bartolomeus755 and All_American like this.
  50. All_American

    All_American

    Joined:
    Oct 14, 2011
    Posts:
    1,528