Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

TriLib - Model Loading Package

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

  1. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    681
    Hi!
    These are log messages the FBX loader generates when it can link objects (they generally object TriLib does not support anyway). I will remove these connection messages as they're meaningless to the loading process.
    Meanwhile, you could disable the messages by disabling the AssetLoaderOptions.ShowLoadingWarnings field.
     
  2. SFXMartinTuor

    SFXMartinTuor

    Joined:
    Mar 25, 2017
    Posts:
    4
    Hi! Unfortunately, for legal reasons, I can't do that. But I could provide you with file properties, or hierarchical informations, if that would be of any help.
     
  3. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    681
    Yes, that should help, but it seems that you have two models or resources with a large number sequence in its name (Ex: model987685421012345678901234567). TriLib renames duplicated model and resource names automatically by counting their occurrences and continuing from the largest number it finds. I have to find another solution for that.

    Edit: Enabling the AssetLoaderOption.DisableObjectsRenaming flag could help temporarly
     
    Last edited: Dec 21, 2021
  4. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    681
    Hi!
    The last version in Asset Store (2.1.4) has the AssetLoaderOption.DisableObjectsRenaming field that you can enable to disable objects renaming.
     
    karonte likes this.
  5. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    949
    Last edited: Dec 21, 2021
  6. SFXMartinTuor

    SFXMartinTuor

    Joined:
    Mar 25, 2017
    Posts:
    4
    It's true that some nodes contain very large numbers in their name. Thank you for the hint regarding the renaming. Enabling the flag indeed fixed the problem.
     
  7. unity_nbv4Yy5Z9DIxOA

    unity_nbv4Yy5Z9DIxOA

    Joined:
    Dec 28, 2021
    Posts:
    1
    Hi!
    As I noticed the vertices's indexes of the mesh are changed while loaded with Trilib (using v 2.1.4).
    So is there anyway to keep them as they are?

    @rickomax I also sent an email for more details.
     
  8. ZoroSrk

    ZoroSrk

    Joined:
    Mar 16, 2021
    Posts:
    6
    Hi, I am also facing the same issue. Were you able to fix this issue ?
     
  9. ZoroSrk

    ZoroSrk

    Joined:
    Mar 16, 2021
    Posts:
    6
    Hi, I am also facing the same issue. Where you able to fix this ?
     
  10. SceneForgeStudio

    SceneForgeStudio

    Joined:
    Feb 28, 2017
    Posts:
    467
    Looking through the website, I see that there once was an option to automatically combine submeshes, but it's now gone in v2.0.
    Is this something that can still be used? When importing high-poly models, there isn't much reason to keep the children separate for my cases.
     
  11. karonte

    karonte

    Joined:
    Jun 2, 2013
    Posts:
    48
    thanks!
     
  12. SceneForgeStudio

    SceneForgeStudio

    Joined:
    Feb 28, 2017
    Posts:
    467
    @lyflike

    Hey, I know it's a bit late, but I had the same problem. Turns out there's a specific method for ZIP imports:
    AssetLoaderZip.LoadModelFromZipFile

    It works the same way, just includes the code for unzipping and reading those formats.
    Hope that still helps!
     
    ZoroSrk likes this.
  13. ZoroSrk

    ZoroSrk

    Joined:
    Mar 16, 2021
    Posts:
    6
    yes, I too discovered this later. Thanks mate
     
  14. blanx

    blanx

    Joined:
    Feb 26, 2016
    Posts:
    72
    Hi,
    What kind of texture compression is used on Android when enabling "Texture Compression Quality".
    Is it something like ASTC? or if not would it be possible to use something like that as it would reduce memory usage quite a lot?
    There are some pretty fast compression libraries for astc that might be usable on a VR headset
     
  15. blanx

    blanx

    Joined:
    Feb 26, 2016
    Posts:
    72

    I also just found out about these texture formats and they seem to be pretty useful and cross platform
    https://github.com/atteneder/KtxUnity
     
  16. SceneForgeStudio

    SceneForgeStudio

    Joined:
    Feb 28, 2017
    Posts:
    467
    I have a quick question:
    I allow the user to open models at runtime using the file browser, configure the loaderOptions through a UI, then import them. I then store the paths to those files in a json object that I load back next time the game is open.
    Then, while showing a loading scene, I loop through these file paths and associated loader options and import them back into the scene for use again.
    The problem is, this results in super long load times.
    Is there a way to somehow either speed up this process or a better way to associate imported models with a save file that will decrease the load time?
    Thanks!
     
  17. simonejennings

    simonejennings

    Joined:
    Jan 11, 2017
    Posts:
    13
    Hi there :)

    I've noticed that this doesn't support FBX's of version 7 or higher, is there any plan to support them in the roadmap?
     
  18. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    Hi, have anyone experienced problems with loading models from file on IOS (via native file browser)?
    When I try to load avatar from file I get below error and nothing happens (IOS 15.1 on IPad Pro M1 and IOS 14 on IPad Air 3, Unity 2021.1.28f1):

    2022-01-12 15:57:11.475496+0100 TriLib[2184:1103034] CFURLResourceIsReachable failed because it was passed a URL which has no scheme
    2022-01-12 15:57:14.185306+0100 TriLib[2184:1102719] [DocumentManager] Failed to associate thumbnails for picked URL file:///private/var/mobile/Containers/Shared/AppGroup/D22A833D-49F5-4D68-8572-E8071E2CBFC8/FileProviderStorage/Korzeniowski.fbx with the Inbox copy file:///private/var/mobile/Containers/Data/Application/F5824A59-3076-4DBA-98DA-3DDEC254590E/tmp/com.DefaultCompany.TriLib-Inbox/Korzeniowski.fbx: Error Domain=QLThumbnailErrorDomain Code=102 "(null)" UserInfo={NSUnderlyingError=0x2835182d0 {Error Domain=GSLibraryErrorDomain Code=3 "Generation not found" UserInfo={NSDescription=Generation not found}}}

    Loading the same file from server via URL works fine.

    Thanks!
     
    RRD123 likes this.
  19. SceneForgeStudio

    SceneForgeStudio

    Joined:
    Feb 28, 2017
    Posts:
    467
    I don't have experience using Trilib on mobile devices, but is it possible that it's having trouble recognizing the iOS file system path naming convention?
     
  20. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
  21. SceneForgeStudio

    SceneForgeStudio

    Joined:
    Feb 28, 2017
    Posts:
    467
    Sorry, nothing comes to mind! I'm not experienced with iOS development.
     
  22. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    Not sure if this a bug, but TriLib 2.1.4 seems to ignore assetLoaderOptions.LoadTexturesAsSRGB = true; when using linear color space in player settings. I attached example project which shows how to reproduce issue.
     

    Attached Files:

  23. blanx

    blanx

    Joined:
    Feb 26, 2016
    Posts:
    72
    @rickomax
    Looks like my models don't get imported when "merge vertices" is turned off. I tried this in hope to speed up importing.

    An error occurred while loading your Model: System.InvalidCastException: Specified cast is not valid.
    at TriLibCore.Geometries.GeometryGroup`1[TVertexData].GenerateMesh (TriLibCore.AssetLoaderContext assetLoaderContext, UnityEngine.Matrix4x4[] bindPoses) [0x00599] in <bd04220af69f476bbe216264df549af8>:0
     
  24. giovannowarli

    giovannowarli

    Joined:
    Apr 2, 2020
    Posts:
    3
    Hi! I've been working with .obj to load with trilib. And this error appeared:

    An error occurred while loading your Model: System.Exception: Required token missing at row 0 and col 247
    at TriLibCore.Obj.ObjStreamReader.ReadToken (System.Boolean required, System.Boolean ignoreLineWrapChar, System.Boolean ignoreElementSeparatorChar, System.Boolean ignoreSpaces, System.Boolean stopOnHyphen) [0x0027f] in <586319da743a4434899921e1b2ca569e>:0
    at TriLibCore.Obj.ObjStreamReader.ReadTokenAsFloat (System.Boolean required, System.Boolean ignoreLineWrapChar, System.Boolean ignoreElementSeparatorChar) [0x00000] in <586319da743a4434899921e1b2ca569e>:0
    at (wrapper remoting-invoke-with-check) TriLibCore.Obj.ObjStreamReader.ReadTokenAsFloat(bool,bool,bool)
    at TriLibCore.Obj.ObjProcessor.ProcessMaterialLibrary (System.String mtLibName) [0x001bc] in <586319da743a4434899921e1b2ca569e>:0
    at TriLibCore.Obj.ObjProcessor.Process (TriLibCore.Obj.Reader.ObjReader reader, System.IO.Stream stream) [0x0011d] in <586319da743a4434899921e1b2ca569e>:0
    at TriLibCore.Obj.Reader.ObjReader.ReadStream (System.IO.Stream stream, TriLibCore.AssetLoaderContext assetLoaderContext, System.String filename, System.Action`2[T1,T2] onProgress) [0x00011] in <586319da743a4434899921e1b2ca569e>:0
    at TriLibCore.AssetLoader.LoadModel (TriLibCore.AssetLoaderContext assetLoaderContext) [0x000f7] in /Users/giovannow/Documents/Unity/3DViewerUploader/Assets/TriLib/TriLibCore/Scripts/AssetLoader.cs:993
    at TriLibCore.Utils.ThreadUtils.RequestNewThreadFor[T] (T context, System.Threading.CancellationToken& cancellationToken, System.Action`1[T] onStart, System.Action`1[T] onComplete, System.Action`1[T] onError, System.Int32 timeout, System.String name, System.Boolean startImmediately) [0x000ce] in <a7ee3af2cca246488fbe71636d737316>:0
    UnityEngine.Debug:LogError (object)
    LoadModelFromFile:OnError (TriLibCore.IContextualizedError) (at Assets/Scripts/LoadModelFromFile.cs:49)
    TriLibCore.AssetLoaderZip:OnError (TriLibCore.IContextualizedError) (at Assets/TriLib/TriLibCore/Scripts/AssetLoaderZip.cs:43)
    TriLibCore.General.ContextualizedAction`1<TriLibCore.IContextualizedError>:Invoke ()
    TriLibCore.Utils.Dispatcher:Update ()


    I also attached the 3D file that I am trying to load. Thanks!
     

    Attached Files:

  25. simonejennings

    simonejennings

    Joined:
    Jan 11, 2017
    Posts:
    13
    I have done further investigating here and found that its actually old FBX versions that aren't supported which is fine. Just might be worth making that error message clearer because it seems like its new fbxs that won't be supported.
     
  26. blanx

    blanx

    Joined:
    Feb 26, 2016
    Posts:
    72
    I think in AssetLoader.cs

    Code (CSharp):
    1. private static void FinishLoading(AssetLoaderContext assetLoaderContext)
    2. {
    3.     if (assetLoaderContext.Options.AddAssetUnloader && assetLoaderContext.RootGameObject != null || assetLoaderContext.WrapperGameObject != null)
    needs to be changed to

    Code (CSharp):
    1.         private static void FinishLoading(AssetLoaderContext assetLoaderContext)
    2.         {
    3.             if (assetLoaderContext.Options.AddAssetUnloader && (assetLoaderContext.RootGameObject != null || assetLoaderContext.WrapperGameObject != null))
    4.  
    otherwise the AssetUnloader always gets created even if the option is off
     
  27. unity_5F3233DDF34AF1474DBC

    unity_5F3233DDF34AF1474DBC

    Joined:
    Dec 11, 2021
    Posts:
    18
    hi guys very new to unity, and I want to use trilib to import a file from runtime but I can't find any tutorial on the internet. do you know any tutorial or documentation to start off with trilib?
     
  28. SceneForgeStudio

    SceneForgeStudio

    Joined:
    Feb 28, 2017
    Posts:
    467
    I suggest checking out the documentation site here:
    https://ricardoreis.net/trilibwiki/index.php?title=Main_Page
     
  29. SceneForgeStudio

    SceneForgeStudio

    Joined:
    Feb 28, 2017
    Posts:
    467
    I also want to put in a request for another file format if possible?
    DWG and STP/STEP Imports would be incredibly helpful for those in the CAD industry! :D
    Thanks so much for all the incredible work @rickomax
    PS: Being able to automatically combine all child meshes on import would be awesome as well ;)
     
  30. firdaussmpitlh

    firdaussmpitlh

    Joined:
    Jan 29, 2021
    Posts:
    2
    why when loading object, it freezes or hangs?
     
    Last edited: Feb 1, 2022
  31. look001

    look001

    Joined:
    Mar 23, 2017
    Posts:
    106
    Hey there, i realy love your asses! I use it to make a modable game where people can use custom models and it works wunderfully! I really apprechiate, that you published this for everyone to use. Do you plan to add support for the dae file format. I noticed a lot of models on sketchfab have this format. thank you!
     
  32. dflauzon

    dflauzon

    Joined:
    Jan 14, 2022
    Posts:
    3
    Hi there!

    So - I can't figure out a method for my use case.

    I'm loading an FBX file - and passing a big piece of JSON into Unity that has all the position data and everything like that. The Json has been deserialized into a C# object.

    Is there a way to pass that C# object into the OnLoad method using the context? The asynchronous nature of the call is making it a challenge.

    For reference in OnLoad I'm attaching a component to the created object, and trying to save some data to that component.

    I tried using the custom data parameter, I'm having casting issues.
     
    Last edited: Feb 3, 2022
  33. unity_5F3233DDF34AF1474DBC

    unity_5F3233DDF34AF1474DBC

    Joined:
    Dec 11, 2021
    Posts:
    18
    Hello, I have a problem that goes like this. I tried to make 2 buttons with different functions. 1 button will load the file picker and let me pick the file and all the stuff until to the point where it will just store it to the game object. the second button will handle the spawning of that game object. now the problem is after the object is loaded it was spawned right away without waiting for the button touch to spawn it. and as I pushed the spawn button it will add a clone of the spawned game object. this is far from what I want to achieve where I want the game object to spawn after I touch or click the button for spawning. By the way, I'm using the sample loadfromefilepicker. The modification that I have done is I made a button object inside the script loadmodelfromfilepickersample.cs and also I made a method which basically flashed the game object here it is.


    Code (CSharp):
    1.     public void Start(){
    2.         if (_loadedGameObject != null)
    3.             {
    4.                 Camera.main.FitToBounds(_loadedGameObject, 2f);
    5.             }
    And here is my full code

    Code (CSharp):
    1. #pragma warning disable 649
    2. using TriLibCore.General;
    3. using UnityEngine;
    4. using TriLibCore.Extensions;
    5. using UnityEngine.UI;
    6.  
    7. namespace TriLibCore.Samples
    8. {
    9.  
    10.     public class LoadModelFromFilePickerSample : MonoBehaviour
    11.     {
    12.      
    13.         private GameObject _loadedGameObject;
    14.  
    15.      
    16.         [SerializeField]
    17.         private Button _loadModelButton;
    18.  
    19.      
    20.         [SerializeField]
    21.         private Text _progressText;
    22.  
    23.      
    24.         public void Start(){
    25.         if (_loadedGameObject != null)
    26.             {
    27.                 Camera.main.FitToBounds(_loadedGameObject, 2f);
    28.             }
    29.  
    30.  
    31.         }
    32.         public void LoadModel()
    33.         {
    34.             var assetLoaderOptions = AssetLoader.CreateDefaultLoaderOptions();
    35.             var assetLoaderFilePicker = AssetLoaderFilePicker.Create();
    36.             assetLoaderFilePicker.LoadModelFromFilePickerAsync("Select a Model file", OnLoad, OnMaterialsLoad, OnProgress, OnBeginLoad, OnError, null, assetLoaderOptions);
    37.         }
    38.  
    39.        
    40.         private void OnBeginLoad(bool filesSelected)
    41.         {
    42.             _loadModelButton.interactable = !filesSelected;
    43.             _progressText.enabled = filesSelected;
    44.         }
    45.  
    46.      
    47.         private void OnError(IContextualizedError obj)
    48.         {
    49.             Debug.LogError($"An error occurred while loading your Model: {obj.GetInnerException()}");
    50.         }
    51.  
    52.      
    53.         private void OnProgress(AssetLoaderContext assetLoaderContext, float progress)
    54.         {
    55.             _progressText.text = $"Progress: {progress:P}";
    56.         }
    57.  
    58.         private void OnMaterialsLoad(AssetLoaderContext assetLoaderContext)
    59.         {
    60.             if (assetLoaderContext.RootGameObject != null)
    61.             {
    62.                 Debug.Log("Model fully loaded.");
    63.             }
    64.             else
    65.             {
    66.                 Debug.Log("Model could not be loaded.");
    67.             }
    68.             _loadModelButton.interactable = true;
    69.             _progressText.enabled = false;
    70.         }
    71.  
    72.      
    73.         private void OnLoad(AssetLoaderContext assetLoaderContext)
    74.         {
    75.             if (_loadedGameObject != null)
    76.             {
    77.                 Destroy(_loadedGameObject);
    78.             }
    79.             _loadedGameObject = assetLoaderContext.RootGameObject;
    80.        
    81.         }
    82.     }
    83. }
    84.  
    the
    LoadModelFromFilePickerSample script is just modified it a little from the original.
    attached are pictures of what is happening,
    picture 1- when starting
    picture 2- after I pushed load button and the file picker browser came out
    picture 3- after I selected and clicked "open" in the file browser- (here we can see the model is already loaded even tho I didn't pushed yet the other button )
    picture 4- after I pushed the button in the center, the 3d model corrected it self and flashed in the normal way of how should it be flashed.

    the problem is in the picture 3 where it flashed even if I didn't want it to flash. I've checked for instantiation
    or any other that could be a source for autoflashing. but i cant find any in the code.
     

    Attached Files:

    • 1.png
      1.png
      File size:
      4.7 KB
      Views:
      260
    • 2.png
      2.png
      File size:
      92.4 KB
      Views:
      252
    • 3.png
      3.png
      File size:
      99.8 KB
      Views:
      255
    • 4.png
      4.png
      File size:
      83.4 KB
      Views:
      258
    Last edited: Feb 6, 2022
  34. unity_5F3233DDF34AF1474DBC

    unity_5F3233DDF34AF1474DBC

    Joined:
    Dec 11, 2021
    Posts:
    18
    is there anyone here who happens to have a project that involves importing the 3d file using trilib and manipulating it such as scaling, moving,selecting and destroying the object? Or do you have any kind of idea about that?
     
  35. Yulian-Georgiev

    Yulian-Georgiev

    Joined:
    May 19, 2015
    Posts:
    2
    I use
    var myLoadedGameObject = assetLoaderContext.RootGameObject;
    in OnMaterialsLoad method to scale, move, etc.

    this is set in

    using TriLibCore;
    using TriLibCore.General;

    public void LoadModel (string url)
    {
    var assetLoaderOptions = AssetLoader.CreateDefaultLoaderOptions();
    var webRequest = AssetDownloader.CreateWebRequest(url);
    AssetDownloader.LoadModelFromUri(webRequest, OnLoad, OnMaterialsLoad, OnProgress, OnError, null, assetLoaderOptions, null, "fbx", null);
    }

    private void OnMaterialsLoad(AssetLoaderContext assetLoaderContext)
    {
    var myLoadedGameObject = assetLoaderContext.RootGameObject;
    // here goes transform
    }
     
  36. Yulian-Georgiev

    Yulian-Georgiev

    Joined:
    May 19, 2015
    Posts:
    2
    Hello. I have a project that loads a lot of .fbx models in a hall. I use TriLibCore.AssetDownloader and while the models are loading the application freezes. I have searched for async loading or some other solution with no luck. Is there an option I'm missing or some kind of workaround? If not I'll probably create a loading screen.
    Thanks.
     
  37. unity_5F3233DDF34AF1474DBC

    unity_5F3233DDF34AF1474DBC

    Joined:
    Dec 11, 2021
    Posts:
    18

    thank you sir, but what I want to do is after the 3d model was loaded in the scene, i want to create a button that will facilitate in the manipulating feature, such as a button to select a model and to scale up the 3d model itself.
     
    Last edited: Feb 8, 2022
  38. sally552

    sally552

    Joined:
    Dec 9, 2017
    Posts:
    1
    Hello, I have a problem that goes like this. we used URP. when i convert the model, all the textures in the material are good. but not emission. she is not. I have done further investigating here and found that MaterialMapper (TriLibCore.Mappers) in ApplyMaterialProperties apply all textures also emission to finalMaterial.

    My tests says: if i change the key "_EmissionMap" to any other ( For example "_MetallicGlossMap ") then the texture applies well ( apply metallic) - this is virtualMaterial.

    my loadOption:
    Code (CSharp):
    1. var loadOptions = AssetLoader.CreateDefaultLoaderOptions();
    2.             loadOptions.TextureCompressionQuality = TextureCompressionQuality.Best;
    3.             loadOptions.AlphaMaterialMode = AlphaMaterialMode.CutoutAndTransparent;
    4.             loadOptions.AddAssetUnloader = false;
    5.             loadOptions.UseMaterialKeywords = true;
    6.  
    Is there any way to fix this problem? mb did i something?
    Thanks!
     
    Last edited: Feb 10, 2022
    fra3point likes this.
  39. fra3point

    fra3point

    Joined:
    Aug 20, 2012
    Posts:
    267
    I can confirm that I have this issue, too (Unity 2021.2.9, URP).
    I'm importing this GLB model: all the maps are correctly imported, even the emissive map, but the material is missing the keyword "_EMISSION", and the emissive map is not shown as expected.

    I've patched this by putting the following code in the OnMaterialsLoad callback (hope this gets fixed soon by the developer!):

    Code (CSharp):
    1. /// <summary>
    2. /// Called when the Model (including Textures and Materials) has been fully loaded.
    3. /// </summary>
    4. /// <remarks>The loaded GameObject is available on the assetLoaderContext.RootGameObject field.</remarks>
    5. /// <param name="assetLoaderContext">The context used to load the Model.</param>
    6. private void OnMaterialsLoad(AssetLoaderContext assetLoaderContext)
    7. {
    8.     Debug.Log("Materials loaded. Model fully loaded.");
    9.     foreach (var kvp in assetLoaderContext.LoadedMaterials)
    10.     {
    11.         Material mat = kvp.Value;
    12.         if(mat.HasTexture("_EmissionMap"))
    13.         {
    14.             mat.EnableKeyword("_EMISSION");    
    15.         }
    16.         else
    17.         {
    18.             mat.DisableKeyword("_EMISSION");
    19.         }
    20.     }
    21. }
     
  40. unity_5F3233DDF34AF1474DBC

    unity_5F3233DDF34AF1474DBC

    Joined:
    Dec 11, 2021
    Posts:
    18
    Good day, I tried the basic sample of trilib which is to import using the file browser.
    is anyone here know how to use the generate colliders and convex colliders. I tried to do in the code

    var assetLoaderOptions = AssetLoader.CreateDefaultLoaderOptions();
    assetLoaderOptions.GenerateColliders=true;
    assetLoaderOptions.ConvexColliders=true;


    after I did this , I cannot find any changes in the inspector or being added, its the same as I import the 3d object it can be added to the hierarchy and as I inspect to it I cannot find any details about colliders or what ? Am I missing something?
     
  41. nethz

    nethz

    Joined:
    Oct 17, 2014
    Posts:
    3
    Hello, I use Trilib2 for HoloLens 2 development work, and it has been working well before, but when I upgrade to the recent version, the generated cpp project cannot be compiled with vs2019 or vs2022, and the compilation process will be stuck in Lump_libil2cpp_os .cpp this file. I have replaced several different versions of win sdk, and turned off many vc optimization options, but still can't compile.

    Has anyone encountered a similar problem? How to solve it, thank you very much.
     
  42. Quoellfrisch

    Quoellfrisch

    Joined:
    Feb 3, 2021
    Posts:
    8
    Small bug i had:
    EditorGUILayout.PropertyField(serializedObject.FindProperty("OptimizeMesh") ...
    should be
    EditorGUILayout.PropertyField(serializedObject.FindProperty("OptimizeMeshes")
     
    Chopium likes this.
  43. unity_5F3233DDF34AF1474DBC

    unity_5F3233DDF34AF1474DBC

    Joined:
    Dec 11, 2021
    Posts:
    18
    do you know how to generate colliders ?

    Code (CSharp):
    1. var assetLoaderOptions = AssetLoader.CreateDefaultLoaderOptions();
    2. assetLoaderOptions.GenerateColliders=true;
    3. assetLoaderOptions.ConvexColliders=true;
    I tried to use this call but I can't generate the colliders. the model that I'm importing is a robot model.
    first I did is I tried the basic script where I could import a 3d model then tried to run it in unity. as i import the 3d model was added to the hierarchy and i tried to examine it. it has various elements but nothing says about the colliders. so i tried to generate the colliders using the code above. and as i try again. there's still no colliders generated am I doing wrong?
     
  44. unity_5F3233DDF34AF1474DBC

    unity_5F3233DDF34AF1474DBC

    Joined:
    Dec 11, 2021
    Posts:
    18
    good day, so I tried to add the generate collider and found out that it was working, but it was applied to a child of the gameobject not to the parent. is there anyone know how to pass that colliders up or copy those colliders to the parent?
    attached is the picture where we can see that at the first picture we have the parent which do not contain any colliders or so what ever and the second picture where the collider is in the child. how can i elevate that collider or even copy that collider to the parent
     

    Attached Files:

  45. Aunpyz

    Aunpyz

    Joined:
    Jun 20, 2015
    Posts:
    1
    Hi!
    I do have unpredictable results from TriLib2.0's AssetLoader.LoadModelFromFile
    I try to load an fbx file using that method but cannot get it to work. I got either everything works, pink material, and System.ObjectDisposedException[1]
    It does seem to work on a sample scene, so I try to experiment if I do have a wrong setup
    1. load a model on MonoBehaviour's Start -> works
    2. load a model on coroutine(my desired method) -> pink material
    3. load models multiple times on MonoBehaviour's Start -> works up to 2 calls, pink material otherwise
    4. load a model on MonoBehaviour's Start then on coroutine I do load a model too -> first one works, the second one on coroutine throws exception[1]
    5. load an obj file on MonoBehaviour's Start -> another exception[2]
    *** I tried the same procedure with AssetLoader.LoadModelFromFileNoThread. all work without any problems
    Can you resolve the issue? I want to load a file asynchronously because I want to load a large file(I hope to not hit the upper limit of this tool)


    [1]
    Code (CSharp):
    1. System.ObjectDisposedException: The UNKNOWN_OBJECT_TYPE has been deallocated, it is not allowed to access it
    2.   at (wrapper managed-to-native) Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrowNoEarlyOut_Injected(Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle&)
    3.   at Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrowNoEarlyOut (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) [0x00000] in <15e405c9beda435fb78db5a973118bc4>:0
    4.   at Unity.Collections.NativeArray`1[T].CheckElementReadAccess (System.Int32 index) [0x0004c] in <15e405c9beda435fb78db5a973118bc4>:0
    5.   at Unity.Collections.NativeArray`1[T].get_Item (System.Int32 index) [0x00001] in <15e405c9beda435fb78db5a973118bc4>:0
    6.   at TriLibCore.Textures.TextureLoaders.ScanForAlphaPixels (TriLibCore.TextureLoadingContext textureLoadingContext) [0x0005d] in <ab0c8840c5c4492f83ad517eddf95a0c>:0
    7.   at TriLibCore.Textures.TextureLoaders.LoadTexture (TriLibCore.TextureLoadingContext textureLoadingContext) [0x00070] in <ab0c8840c5c4492f83ad517eddf95a0c>:0
    8.   at TriLibCore.Mappers.MaterialMapper.LoadTextureWithCallbacks (TriLibCore.MaterialMapperContext materialMapperContext, TriLibCore.General.TextureType textureType, TriLibCore.Interfaces.ITexture texture, System.Action`1[TriLibCore.TextureLoadingContext][] onTextureProcessed) [0x0003f] in <95af22140638421088b8a4b85a33dafc>:0
    9.   at TriLibCore.Mappers.StandardMaterialMapper.CheckDiffuseMapTexture (TriLibCore.MaterialMapperContext materialMapperContext) [0x0001a] in E:\SkullSurgerySimulator\Assets\TriLib\TriLibCore\Scripts\Mappers\StandardMaterialMapper.cs:66
    10.   at TriLibCore.Mappers.StandardMaterialMapper.Map (TriLibCore.MaterialMapperContext materialMapperContext) [0x00019] in E:\SkullSurgerySimulator\Assets\TriLib\TriLibCore\Scripts\Mappers\StandardMaterialMapper.cs:43
    11.   at TriLibCore.AssetLoader.ProcessMaterialRenderers (TriLibCore.AssetLoaderContext assetLoaderContext) [0x00078] in E:\SkullSurgerySimulator\Assets\TriLib\TriLibCore\Scripts\AssetLoader.cs:1138
    12.   at TriLibCore.General.ContextualizedAction`1[T].Invoke () [0x00000] in <95af22140638421088b8a4b85a33dafc>:0
    13.   at TriLibCore.Utils.ThreadUtils+<>c__DisplayClass0_0`1[T].<RequestNewThreadFor>b__0 () [0x0002f] in <95af22140638421088b8a4b85a33dafc>:0
    [2]
    Code (CSharp):
    1. System.ObjectDisposedException: The UNKNOWN_OBJECT_TYPE has been deallocated, it is not allowed to access it
    2.   at (wrapper managed-to-native) Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrowNoEarlyOut_Injected(Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle&)
    3.   at Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrowNoEarlyOut (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) [0x00000] in <15e405c9beda435fb78db5a973118bc4>:0
    4.   at Unity.Collections.NativeArray`1[T].CheckElementReadAccess (System.Int32 index) [0x0004c] in <15e405c9beda435fb78db5a973118bc4>:0
    5.   at Unity.Collections.NativeArray`1[T].get_Item (System.Int32 index) [0x00001] in <15e405c9beda435fb78db5a973118bc4>:0
    6.   at TriLibCore.Textures.TextureLoaders.ScanForAlphaPixels (TriLibCore.TextureLoadingContext textureLoadingContext) [0x0005d] in <ab0c8840c5c4492f83ad517eddf95a0c>:0
    7.   at TriLibCore.Textures.TextureLoaders.LoadTexture (TriLibCore.TextureLoadingContext textureLoadingContext) [0x00070] in <ab0c8840c5c4492f83ad517eddf95a0c>:0
    8.   at TriLibCore.Mappers.MaterialMapper.LoadTextureWithCallbacks (TriLibCore.MaterialMapperContext materialMapperContext, TriLibCore.General.TextureType textureType, TriLibCore.Interfaces.ITexture texture, System.Action`1[TriLibCore.TextureLoadingContext][] onTextureProcessed) [0x0003f] in <95af22140638421088b8a4b85a33dafc>:0
    9.   at TriLibCore.Mappers.StandardMaterialMapper.CheckDiffuseMapTexture (TriLibCore.MaterialMapperContext materialMapperContext) [0x0001a] in E:\SkullSurgerySimulator\Assets\TriLib\TriLibCore\Scripts\Mappers\StandardMaterialMapper.cs:66
    10.   at TriLibCore.Mappers.StandardMaterialMapper.Map (TriLibCore.MaterialMapperContext materialMapperContext) [0x00019] in E:\SkullSurgerySimulator\Assets\TriLib\TriLibCore\Scripts\Mappers\StandardMaterialMapper.cs:43
    11.   at TriLibCore.AssetLoader.ProcessMaterialRenderers (TriLibCore.AssetLoaderContext assetLoaderContext) [0x00078] in E:\SkullSurgerySimulator\Assets\TriLib\TriLibCore\Scripts\AssetLoader.cs:1138
    12.   at TriLibCore.General.ContextualizedAction`1[T].Invoke () [0x00000] in <95af22140638421088b8a4b85a33dafc>:0
    13.   at TriLibCore.Utils.ThreadUtils+<>c__DisplayClass0_0`1[T].<RequestNewThreadFor>b__0 () [0x0002f] in <95af22140638421088b8a4b85a33dafc>:0
    14.  
     
  46. Irideas

    Irideas

    Joined:
    Nov 8, 2017
    Posts:
    7
    Hello, does TriLib 2 have an import setting to reduce the animation curves? (similar to unity import setting with the animation compression and error parameters for rotation, translation and scale)
     
  47. visualjoy

    visualjoy

    Joined:
    Aug 23, 2016
    Posts:
    38
    Theres a error in Trilb StandaloneFileBrowser which sometimes did not catch the directory separators.
    Ex: Exception during processing System.UnauthorizedAccessException: Access to the path "C:UsersUserDesktopFolderFile.zip" is denied.

    The correct is "C:\Users\UserDesktop\Folder\File.zip". For now its only occurs in Windows Build 64.

    Do you have any idea what it is?
     
  48. WavyRancheros

    WavyRancheros

    Joined:
    Feb 5, 2013
    Posts:
    176
    I am trying to load some larger FBX (like 30MB) at runtime, and I notice that between the onLoad and onMaterialLoad callbacks the Main Thread is completely blocked. Why is that, and can I improve this somehow?
     
    USSHI- likes this.
  49. shibi2017

    shibi2017

    Joined:
    Jan 18, 2018
    Posts:
    153
    I bought it and I can not create avatar for humanoid type, why?
     
  50. SceneForgeStudio

    SceneForgeStudio

    Joined:
    Feb 28, 2017
    Posts:
    467
    I went through this same difficulty. It's important that Trilib can detect the humanoid bone configuration to properly build the avatar. To do this make sure your humanoid mapper contains names that correspond to the key bones of your rigged character.
    The default one includes mappings for Mixamo rigs, but you can just add more bone names to it.