Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. 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 Loading Package

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

  1. deadlyGolum

    deadlyGolum

    Joined:
    Dec 31, 2013
    Posts:
    8
    Found the AssetLoaderAsync, but it still lags for sometime..... and in the profiler, Dispatcher.Update is around 2900 ms.

    The model tris count is around 180k.

    what could be the problem?
     
  2. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Unfortunately Unity is not thread-safe at the moment, so there still main thread stuff to do on dispatcher calls, which could eventually freeze the main thread. I'm studying new possibilities to improve loading performance/memory usage.
     
  3. unity_pp

    unity_pp

    Joined:
    May 9, 2013
    Posts:
    2
    Hello all.
    There is a problem.
    Why do LoadFromFile() method use FileUtil.GetFileDirectory()?
    Just return wrong directory name.
    So I can't load Texture files.
    You had better use Path.GetDirectoryName method.
     
  4. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    That's a hand-made method to get the directory name on platforms that doesn't accepts the Path.GetDirectoryName and to deal with URLs. What's the platform you're using?
     
  5. unity_pp

    unity_pp

    Joined:
    May 9, 2013
    Posts:
    2
    I am using Unity2018.2.0f2 on Windows10.
    The texture file can not be read even at runtime.
     
  6. Tauto17

    Tauto17

    Joined:
    May 17, 2018
    Posts:
    1
    hi Ricardo, i'm writing you becuse we bought the triLib pro package, for loading some fbx runtime, but with only one fbx gives us error.
    We're thinking about the space in the file path becuse only this object has space in the name, so we're asking if there are some problems with objcet that has space in the name.
    I post you the error that unity give to me
    ArgumentException: Illegal characters in path.

    We are searching something to fix it becuse we have to see the customers soon.
     
  7. jcbadboy

    jcbadboy

    Joined:
    Mar 24, 2010
    Posts:
    48
    Still no support to Webgl?
     
  8. divdanila

    divdanila

    Joined:
    Apr 23, 2015
    Posts:
    3
    Добрый день. Хочу купить но даже в демо не получается загрузить модель.
    Качал тут https://ricardoreis.net/trilib/trilibtest.zip
    В папку Win64\Models\ ложил модель akn_10.fbx. Запускаю AssetLoader.exe. При нажатии на кнопку "Load local Asset (HD, Storage)" ничего не происходит, модель не загружается.
     
  9. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Not yet, gonna focus on that.
     
  10. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    The "Models" folder is used only on "AvatarLoader.exe" sample, which takes characters rigged from Mixamo, or 3Ds Max Bipped and let you control them. On the "AssetLoader.exe" sample, you should select the file you want to load on the file panel that will open as soon as you click the "Load Local Asset" button.
     
  11. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Hi, you have been answered by e-mail, but just to keep a record for another users, TriLib has an issue on Windows which wont recognize non-ASCII characters on paths, but space in the filename should work fine.
     
  12. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Hi. I will be testing it soon, and if needed, I'll add that as a fix on the next update. Is "Path.GetDirectoryName" working for you?
     
  13. divdanila

    divdanila

    Joined:
    Apr 23, 2015
    Posts:
    3
    Мой порядок действий чтобы загрузить модель fbx следующий:
    1) В папку Models положить файл , какой? Положить например model.fbx ?
    2) Запустить AvatarLoader.exe
    3) Запустить AssetLoader.exe
    Если я не правильно что-то делаю то распишите пожалуйста по порядку все действия чтобы загрузить модель например формата fbx.
     
  14. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    1) On the model folder, you can put any model downloaded or rigged from www.mixamo.com, for instance, or any model rigged with 3Ds Max Biped.
    2) Run AvatarLoader.exe to be able to play with this character on a sample scene
    3) AssetLoader.exe is an application that uses TriLib and let you load models from local storage or from a web URL. After running it, click on "Load local Asset (HD, Storage" to be able to load the previous character or any other model within the formats TriLib accepts. You could also load any model from the web when clicking in "Load Remote Asset (URI)" and pass the model URL on the input box that will be opened.
     
  15. DenverIW

    DenverIW

    Joined:
    May 27, 2018
    Posts:
    3
    Overall, great work. I'm very much enjoying the capabilities of this asset and look forward to seeing what further features you add to it. Now on to some hopefully helpful optimizations you can consider/use :)

    I've been working on optimizing the texture loading on my end as this seems to be where Async currently stutters heavily (profiling shows 200ms for one model that has 3 512x512 textures on it). It appears these are created on the main thread and there are two separate Texture2Ds generated during this time (meaning each image file is processed 3 times). My recommendation would be getting these loaded through UnityWebRequestTexture for texture types Unity handles. Behind the scenes these textures are decompressed and decoded on a worker thread giving significant gains (https://docs.unity3d.com/ScriptReference/Networking.DownloadHandlerTexture.html). I believe loading with this method may also allow you to take advantage of Asynchronous Texture uploads but don't count me on that.

    For instances where GetAllBytes is necessary with DevIL, the File.ReadAllBytes can be moved to the worker threads you already have running. I have this bit working with a bit of copy-paste of your code and attached below. I simply took advantage of the [...]EmbeddedTextureData when I could get the path and it was previously empty.

    Finally, re-using the previous texture in ProcessTextureData seems possible as it's creating extra garbage and GetPixels32 and SetPixels32 are super slow. I'm trying this out today.

    The following is called after each internal load inside the worker threads: ProcessTextures(basePath);
    Code (CSharp):
    1.  
    2. void ProcessTextures(string basePath = null) {
    3.     Dictionary<string, byte[]> loadedByteArrays = new Dictionary<string, byte[]>();
    4.     foreach (MaterialData materialData in MaterialData) {
    5.         if (materialData.DiffuseInfoLoaded) {
    6.             LoadTextureFromFile(
    7.                 materialData.DiffusePath, ref materialData.DiffuseEmbeddedTextureData, basePath, loadedByteArrays
    8.             );
    9.         }
    10.  
    11.         if (materialData.EmissionInfoLoaded) {
    12.             LoadTextureFromFile(
    13.                 materialData.EmissionPath, ref materialData.EmissionEmbeddedTextureData, basePath, loadedByteArrays
    14.             );
    15.         }
    16.  
    17.         if (materialData.SpecularInfoLoaded) {
    18.             LoadTextureFromFile(
    19.                 materialData.SpecularPath, ref materialData.SpecularEmbeddedTextureData, basePath, loadedByteArrays
    20.             );
    21.         }
    22.  
    23.         if (materialData.NormalInfoLoaded) {
    24.             LoadTextureFromFile(
    25.                 materialData.NormalPath, ref materialData.NormalEmbeddedTextureData, basePath, loadedByteArrays
    26.             );
    27.         }
    28.  
    29.         if (materialData.HeightInfoLoaded) {
    30.             LoadTextureFromFile(
    31.                 materialData.HeightPath, ref materialData.HeightEmbeddedTextureData, basePath, loadedByteArrays
    32.             );
    33.         }
    34.     }
    35. }
    36.  
    37. protected virtual void LoadTextureFromFile(string path, ref EmbeddedTextureData embeddedTextureData,
    38.     string basePath, Dictionary<string, byte[]> loadedByteArrays
    39. ) {
    40.     if (embeddedTextureData != null) {
    41.         return;
    42.     }
    43.  
    44.     byte[] texture;
    45.     if (loadedByteArrays.ContainsKey(path)) {
    46.         texture = loadedByteArrays[path];
    47.     } else {
    48.         texture = LoadByteArrayFromFile(path, basePath);
    49.         if (texture != null) {
    50.             loadedByteArrays.Add(path, texture);
    51.         }
    52.     }
    53.  
    54.     if (texture == null) {
    55.         return;
    56.     }
    57.  
    58.     embeddedTextureData = new EmbeddedTextureData {
    59.         Data = texture,
    60.         IsRawData = false,
    61.         Height = 0,
    62.         Width = 0
    63.     };
    64. }
    65.  
    66. /// <summary>
    67. /// Code copied from <see cref="Texture2DUtils.LoadTextureFromFile"/>. Lines 65 - 89
    68. /// </summary>
    69. /// <param name="path"></param>
    70. /// <param name="basePath"></param>
    71. /// <returns></returns>
    72. public static byte[] LoadByteArrayFromFile(string path, string basePath = null) {
    73.     var finalPath = path;
    74.  
    75.     string filename = null;
    76.     byte[] data = FileUtils.LoadFileData(finalPath);
    77.     if (data.Length == 0 && basePath != null) {
    78.         finalPath = Path.Combine(basePath, path);
    79.         data = FileUtils.LoadFileData(finalPath);
    80.     }
    81.  
    82.     if (data.Length == 0) {
    83.         filename = FileUtils.GetFilename(path);
    84.         finalPath = filename;
    85.         data = FileUtils.LoadFileData(finalPath);
    86.     }
    87.  
    88.     if (data.Length == 0 && basePath != null && filename != null) {
    89.         finalPath = Path.Combine(basePath, filename);
    90.         data = FileUtils.LoadFileData(finalPath);
    91.     }
    92.  
    93.     if (data.Length == 0) {
    94. #if TRILIB_OUTPUT_MESSAGES || ASSIMP_OUTPUT_MESSAGES
    95.         Debug.LogWarningFormat("Texture '{0}' not found", path);
    96. #endif
    97.     }
    98.  
    99.     return data;
    100. }
    101.  
    102. /// <summary>
    103. /// Loads the image data from Byte input into Texture2D.
    104. /// </summary>
    105. /// <param name="bytes">Image data.</param>
    106. /// <param name="length">Image data length.</param>
    107. /// <param name="texture2D">The <see cref="UnityEngine.Texture2D"/> to draw the image into.</param>
    108. /// <returns>True if succeed. Otherwise, false.</returns>
    109. public static bool LoadTexture2DFromByteArray(byte[] bytes, int length, out Texture2D texture2D) {
    110.     texture2D = null;
    111.     var loaded = false;
    112.     try {
    113.         IlInterop.ilInit();
    114.         IlInterop.ilEnable(IlInterop.IL_ORIGIN_SET);
    115.         IlInterop.ilOriginFunc(IlInterop.IL_ORIGIN_LOWER_LEFT);
    116.         var image = IlInterop.ilGenImage();
    117.         IlInterop.ilBindImage(image);
    118.         if (IlInterop.ilLoadL(IlInterop.IL_TYPE_UNKNOWN, bytes, length)) {
    119.             IlInterop.ilConvertImage(IlInterop.IL_RGBA, IlInterop.IL_UNSIGNED_BYTE);
    120.             var imageWidth = IlInterop.ilGetInteger(IlInterop.IL_IMAGE_WIDTH);
    121.             var imageHeight = IlInterop.ilGetInteger(IlInterop.IL_IMAGE_HEIGHT);
    122.             var dataLength = imageWidth * imageHeight * 4;
    123.             var intPtr = IlInterop.ilGetData();
    124.             var data = new byte[dataLength];
    125.             Marshal.Copy(intPtr, data, 0, dataLength);
    126.             loaded = true;
    127.         }
    128.  
    129.         IlInterop.ilDeleteImages(1, ref image);
    130.     } catch { }
    131.  
    132.     return loaded;
    133. }
     
    Last edited: Aug 21, 2018
  16. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Hi!

    Thank you for your contribution!
    I've already implemented a similar solution for the next TriLib update.
     
    Last edited: Aug 29, 2018
  17. Hex0dus

    Hex0dus

    Joined:
    May 2, 2018
    Posts:
    2
    What the matter with WebGL? I mean what exactly is the issue? In my understanding in WebGL you can't load files form disc because it's restricted by browsers "same origin policy" (to prevent CORS attacks). But files from the same folder as the application should work just fine. Otherwise your server should enable the request i.e. via ".htaccess" like this:

    Code (CSharp):
    1. Header set Access-Control-Allow-Origin "*"
    2. #or:
    3. Header set Access-Control-Allow-Origin "http://www.example.com/"
    So I suspect that with that WebGl should work just fine but I don't wanna buy the plugin to just test my theory. Could you please give it a try and tell me if it works?
     
  18. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Just got the first WebGL build working:


    Gonna add it as an experimental platform on the next update.
     
    Bartolomeus755 likes this.
  19. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    More WebGL tests, this time, with FBX models:
    upload_2018-9-7_0-41-40.png
     
  20. andre-ivankio

    andre-ivankio

    Joined:
    Mar 29, 2010
    Posts:
    53
    Last edited: Sep 13, 2018
  21. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
  22. andre-ivankio

    andre-ivankio

    Joined:
    Mar 29, 2010
    Posts:
    53
    .NET? In case these project settings are relevant:
    Scripting Runtime Version: .NET 3.5 Equivalent
    Scripting Backend: IL2CPP
    Api Compatibility Level: .NET 4.x

    Scripting define symbols (without ZIP loading):
    VRTK_DEFINE_SDK_WINDOWSMR;VRTK_VERSION_3_3_0;VRTK_VERSION_3_3_0_OR_NEWER;VRTK_VERSION_3_1_0_OR_NEWER;VRTK_VERSION_3_2_0_OR_NEWER;VRTK_VERSION_3_2_1_OR_NEWER;TRILIB_USE_DEVIL

    I'm getting these:

    Anyway, inside the editor the obj is being imported without texture.
    I'm guessing Trilib's automation doesn't like that the source zips have the OBJ MTL and JPG not in the root of the zip (3rd party provided, can't be changed). I'm surprised that Trilib found it at all. So would you suggest I study how to develop my own management of download and local copy? I'd be willing to pay for a quick consultation call if you are available for those.
     
  23. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    About the OBJ loading, there are some known issues with it on Assimp.
    I'm working on an IO system to allow TriLib loading data from external files (like MTL files) when the data isn't available at the common file system.

    I have tested these settings on Unity 2017 and the ZIP library was available.
    Which Unity version are you using?
     
  24. andre-ivankio

    andre-ivankio

    Joined:
    Mar 29, 2010
    Posts:
    53
    Forgot that important detail, sorry. 2018.2.2f1
     
  25. look001

    look001

    Joined:
    Mar 23, 2017
    Posts:
    65
    Asset is realy awesome! But one question: When i import Animations from .fbx file for example, an animaiton component will be added automaticaly. Can i somehow get the AnimationCurve out of the imported model? I want to modify the curves after importing. Getting curves from an Animation Component seems to be possible in Editor only
     
  26. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Hi!

    AssetLoader and AssetLoaderAsync are inherited from AssetLoaderBase.
    You can duplicate the AssetLoader or AssetLoaderAsync classes to create your own AssetLoader version,
    then override the TransformAnimationData method, this is the method that creates the curves.

    Best regards,
    Ricardo Reis.
     
  27. JenniB

    JenniB

    Joined:
    Feb 15, 2018
    Posts:
    62
    Hello :)
    Is it somehow possible to get the progress of the async loader? So i can show some progress bar to the user.
     
  28. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Hi!

    I can add a progress tracker to TriLib.
    Gonna add this feature on the next update.

    Best regards,
    Ricardo Reis.
     
    JenniB likes this.
  29. fueldown_

    fueldown_

    Joined:
    Mar 21, 2018
    Posts:
    23
    Hi @rickomax ,
    I just bought TriLib and needed to import some fbx files at runtime. I am getting this error when I try to load them from dropbox/gdrive:

    System.Exception: Error loading asset. Assimp returns: [FBX-Tokenize (line 1 <<  col 31) unexpected double-quote]
    at TriLib.AssetLoaderBase.InternalLoadFromMemory (System.Byte[] fileBytes, System.String filename, System.String basePath, TriLib.AssetLoaderOptions options, System.Boolean usesWrapperGameObject) [0x0005a] in /Users/fueldown/Documents/UnityProjects/Percept Projects/Demos/OGO_Test/Assets/TriLib/TriLib/Scripts/AssetLoader/AssetLoaderBase.cs:552
    at TriLib.AssetLoaderBase.InternalLoadFromMemoryAndZip (System.Byte[] data, System.String assetExtension, System.String basePath, TriLib.AssetLoaderOptions options, System.Boolean usesWrapperGameObject) [0x0004d] in /Users/fueldown/Documents/UnityProjects/Percept Projects/Demos/OGO_Test/Assets/TriLib/TriLib/Scripts/AssetLoader/AssetLoaderBase.cs:658
    at TriLib.AssetLoader.LoadFromMemoryWithTextures (System.Byte[] fileData, System.String assetExtension, TriLib.AssetLoaderOptions options, UnityEngine.GameObject wrapperGameObject, System.String basePath) [0x0000f] in /Users/fueldown/Documents/UnityProjects/Percept Projects/Demos/OGO_Test/Assets/TriLib/TriLib/Scripts/AssetLoader/AssetLoader.cs:101
    at TriLib.AssetDownloader+<DoDownloadAsset>c__Iterator0.MoveNext () [0x0012a] in /Users/fueldown/Documents/UnityProjects/Percept Projects/Demos/OGO_Test/Assets/TriLib/TriLib/Scripts/AssetLoader/AssetDownloader.cs:208


    any help would be appreciated.
     
  30. CAD_Schroer_GmbH

    CAD_Schroer_GmbH

    Joined:
    Jan 23, 2017
    Posts:
    12
    Hi,

    i found an Error in FileUtils.cs:

    Code (CSharp):
    1. public static string GetFilenameWithoutExtension(string filename) {
    2.             var indexOfDot = filename.LastIndexOf('.');
    3.             if (indexOfDot < 0)
    4.             {
    5.                 return null;
    6.             }
    7.             var indexOfBackslash = filename.LastIndexOf ("\\");
    8.             if (indexOfBackslash >= 0) {
    9.                 //return filename.Substring(indexOfBackslash + 1, indexOfDot - 1);
    10.                 return filename.Substring (indexOfBackslash + 1, indexOfDot - indexOfBackslash - 1);
    11.             }
    12.             var indexOfSlash = filename.LastIndexOf ("/");
    13.             if (indexOfSlash >= 0) {
    14.                 return filename.Substring(indexOfSlash + 1, indexOfDot - indexOfSlash - 1);
    15.             }
    16.             return null;
    17.         }
    The wrong line is a comment and the fixed line is under the comment.

    Regards,
    CAD Schroer GmbH
     
  31. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Hi, could you send your model for testing to: contato@ricardoreis.net?
     
  32. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Thank you!

    Gonna add this fix on the next update.
     
  33. LuisCarlosContreras

    LuisCarlosContreras

    Joined:
    Aug 7, 2018
    Posts:
    3
    Hi, is there a way to avoid files with more than a determined vertex numbers?
    Here is my case, I'm building an Android App which you can load models freely, but the Avanced config does not avoid the model to load if for example I try to load a 2 Million vertex model. I am using FBX models and sometimes OBJ.

    Here is my Code.


    Code (CSharp):
    1.    
    2.  
    3.     IEnumerator LoadModelCoroutine(string path)
    4.     {
    5.         yield return new WaitForSeconds(0.05f);
    6.         //Load the Model
    7.         PreLoadSetup();
    8.         AssetLoaderOptions assetLoaderOptions = GetAssetLoaderOptions();
    9.  
    10.         using (var assetLoader = new AssetLoader())
    11.         {
    12.             assetLoader.OnMetadataProcessed += AssetLoader_OnMetadataProcessed;
    13.             try
    14.             {
    15.                 var fileInfo = new FileInfo(path);
    16.                 Debug.Log(fileInfo.Length);
    17.                 if (fileInfo.Length > 40000000)
    18.                 {
    19.                     throw new Exception("File is too heavy");
    20.                 } else
    21.                 {
    22.                     LoadedGameObject = assetLoader.LoadFromFile(path, assetLoaderOptions);
    23.                 }
    24.  
    25.             }
    26.             catch (Exception exception)
    27.             {
    28.                 ErrorDialog.Instance.ShowDialog(exception.Message);
    29.             }
    30.         }
    31.  
    32.         if (LoadedGameObject != null)
    33.         {
    34.             // PostLoadSetup();
    35.             OnPostprocessModel(LoadedGameObject);
    36.         }
    37.         controlButtons.SetActive(true); //Activate canvas
    38.         loadingScreen.SetActive(false);
    39.     }
    40.  
    41. public List<AssetAdvancedConfig> AdvancedConfigs = new List<AssetAdvancedConfig>
    42.         {
    43.             AssetAdvancedConfig.CreateConfig(AssetAdvancedPropertyClassNames.SplitLargeMeshesVertexLimit, 10000),
    44.             AssetAdvancedConfig.CreateConfig(AssetAdvancedPropertyClassNames.SplitLargeMeshesTriangleLimit, 10000),
    45.             AssetAdvancedConfig.CreateConfig(AssetAdvancedPropertyClassNames.FBXImportReadLights, false),
    46.             AssetAdvancedConfig.CreateConfig(AssetAdvancedPropertyClassNames.FBXImportReadCameras, false)
    47.         };
    48.  
    49.     private AssetLoaderOptions GetAssetLoaderOptions()
    50.     {
    51.  
    52.         AssetLoaderOptions assetLoaderOptions = AssetLoaderOptions.CreateInstance();
    53.         assetLoaderOptions.DontLoadCameras = false;
    54.         //assetLoaderOptions.RotationAngles = Vector3.zero;
    55.         assetLoaderOptions.DontLoadLights = false;
    56.         assetLoaderOptions.UseCutoutMaterials = true;
    57.         assetLoaderOptions.AddAssetUnloader = true;
    58.         assetLoaderOptions.AutoPlayAnimations = true;
    59.         assetLoaderOptions.AdvancedConfigs = AdvancedConfigs;
    60.         return assetLoaderOptions;
    61.     }
    PD: Trilib is an amazing tool, thank you RickoMax
     
  34. andre-ivankio

    andre-ivankio

    Joined:
    Mar 29, 2010
    Posts:
    53
    Did you get to test ZIP for UWP in 2018.2?
     
  35. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Hi!

    Next TriLib update will have improvements on OBJ files loading speed/memory usage.

    You can copy the code from AssetLoader.cs or AssetLoaderAsync.cs and override the TransformNodeData method to something like that:

    Code (CSharp):
    1. private const int MaxVertexCount = 1000000000;
    2. protected override GameObject TransformNodeData(NodeData nodeData, AssetLoaderOptions options, GameObject existingGameObject = null) {
    3.  GameObject gameObject = new GameObject {
    4.   name = nodeData.Name
    5.  };
    6.  var parentGameObject = existingGameObject != null ? existingGameObject : (nodeData.Parent == null ? null : nodeData.Parent.GameObject);
    7.  if (parentGameObject != null) {
    8.   gameObject.transform.SetParent(parentGameObject.transform, false);
    9.  }
    10.  gameObject.transform.LoadMatrix(nodeData.Matrix);
    11.  if (nodeData.Meshes != null && nodeData.Meshes.Length > 0 && MeshData != null && MeshData.Length > 0) {
    12.   var vertexCount = 0;
    13.   foreach(var meshIndex in nodeData.Meshes) {
    14.    var meshData = MeshData[meshIndex];
    15.    vertexCount += meshData.Vertices.Length;
    16.   }
    17.   if (vertexCount > MaxVertexCount) {
    18.    throw new TooManyVerticesException();
    19.   }
    20. #if UNITY_2017_3_OR_NEWER
    21.   var useCombineInstances = options == null || options.Use32BitsIndexFormat && options.CombineMeshes || vertexCount < 65536 && options.CombineMeshes;
    22. #else
    23.    var useCombineInstances = vertexCount < 65536 && (options == null || options.CombineMeshes);
    24. #endif
    25.   if (useCombineInstances) {
    26.    Material lastMaterial = null;
    27.    List < string > combinedNodeNames = null;
    28.    var singleMaterial = true;
    29.    var combineInstances = new CombineInstance[nodeData.Meshes.Length];
    30.    var combinedMaterials = new Material[nodeData.Meshes.Length];
    31.    for (var i = 0; i < nodeData.Meshes.Length; i++) {
    32.     var meshIndex = nodeData.Meshes[i];
    33.     if (meshIndex >= MeshData.Length) {
    34.      continue;
    35.     }
    36.     var meshData = MeshData[meshIndex];
    37.     if (meshData.HasBoneInfo && meshData.BoneNames.Length > 0) {
    38.      if (combinedNodeNames == null) {
    39.       combinedNodeNames = new List < string > ();
    40.      }
    41.      combinedNodeNames.AddRange(meshData.BoneNames);
    42.     }
    43.     var combineInstance = new CombineInstance {
    44.      mesh = meshData.Mesh,
    45.       transform = Matrix4x4.identity
    46.     };
    47.     combineInstances[i] = combineInstance;
    48.     if (MaterialData == null || MaterialData.Length == 0 || meshData.MaterialIndex >= MaterialData.Length) {
    49.      continue;
    50.     }
    51.     var materialData = MaterialData[meshData.MaterialIndex];
    52.     var material = materialData.Material;
    53.     if (lastMaterial != null && material != lastMaterial) {
    54.      singleMaterial = false;
    55.     }
    56.     combinedMaterials[i] = material;
    57.     lastMaterial = material;
    58.    }
    59.    var combinedMesh = new Mesh();
    60. #if UNITY_2017_3_OR_NEWER
    61.    if (options == null || options.Use32BitsIndexFormat) {
    62.     combinedMesh.indexFormat = IndexFormat.UInt32;
    63.    }
    64. #endif
    65.    combinedMesh.CombineMeshes(combineInstances, singleMaterial);
    66.    combinedMesh.name = FixName(nodeData.Name) + "_Mesh";
    67.    CreateMeshComponents(gameObject, options, combinedMesh, HasBoneInfo, combinedMaterials, combinedNodeNames, singleMaterial ? combinedMaterials[0] : null);
    68.   } else {
    69.    for (var i = 0; i < nodeData.Meshes.Length; i++) {
    70.     var meshIndex = nodeData.Meshes[i];
    71.     var meshData = MeshData[meshIndex];
    72.     var material = MaterialData == null ? null : MaterialData[meshData.MaterialIndex].Material;
    73.     var subGameObject = new GameObject {
    74.      name = "SubMesh_" + i
    75.     };
    76.     subGameObject.transform.SetParent(gameObject.transform, false);
    77.     CreateMeshComponents(subGameObject, options, meshData.Mesh, HasBoneInfo, null, meshData.BoneNames, material);
    78.    }
    79.   }
    80.  }
    81.  nodeData.GameObject = gameObject;
    82.  if (nodeData.Children != null) {
    83.   foreach(var childNodeData in nodeData.Children) {
    84.    TransformNodeData(childNodeData, options);
    85.   }
    86.  }
    87.  return gameObject;
    88. }
    Also create a class to identify the high vertex count error:
    Code (CSharp):
    1.  public class TooManyVerticesException : Exception {
    2.  
    3.  }
    You can then catch the TooManyVerticesException error when loading your file to identify there are too many vertices.
     
  36. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Hi, not yet. Gonna do that today!
     
    andre-ivankio likes this.
  37. mmortall

    mmortall

    Joined:
    Dec 28, 2010
    Posts:
    89
    I have OBJ model and textures in one zip archive.
    When I load these zip archive textures are ignored for some reason.

    I debugged this issue and found out that AssimpInterop.aiMaterial_GetNumTextureDiffuse() return 0 instead on 1. So like there is not textures. It happens only when loading from zip.
    Could you help me with this problem? Thanks

    Update:
    Plane obj file textures also not loaded using LoadFromFileWithTextures
    But all ok with LoadFromFile function
    Why is it like that? This functions internally pretty similar
     
    Last edited: Sep 24, 2018
  38. JenniB

    JenniB

    Joined:
    Feb 15, 2018
    Posts:
    62
    Hello :)
    Is it somehow possible to filter the FileOpenDialog in a way, that it just shows files with a specific type? for example just show JSON files.

    Oh i see now that JSON files will not be displayed. Can i change it?
     
    Last edited: Sep 25, 2018
  39. jcbadboy

    jcbadboy

    Joined:
    Mar 24, 2010
    Posts:
    48
    Hi,

    I have this error with the version 1.8.6 of Trilib:

    UnityLoader.js:4 exception thrown: TypeError: Cannot read property 'mainUpload' of undefined,TypeError: Cannot read property 'mainUpload' of undefined
    at _WebGL_SetupUploadEvent (blob:http://127.0.0.1:8080/6528abf0-4d12-4b74-a234-656bb722be34:2:180135)
    at Xtm (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:20:89092)
    at Ztm (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:20:89261)
    at Array.dsm (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:20:57956)
    at Array.yof (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:19:44788)
    at Object.fzw [as dynCall_iiiii] (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:43:182521)
    at invoke_iiiii (blob:http://127.0.0.1:8080/6528abf0-4d12-4b74-a234-656bb722be34:2:357716)
    at qTd (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:21:536050)
    at mxh (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:22:547564)
    at J$p (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:26:227422)
    at U_r (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:27:147623)
    at Aps (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:27:930530)
    at Array.tps (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:27:923341)
    at jwq (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:26:1069420)
    at Array.aps (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:27:917649)
    at Y0p (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:26:283111)
    at W0p (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:26:280800)
    at SYr (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:27:64653)
    at GYr (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:27:55572)
    at HYr (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:27:57083)
    at Array.CYr (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:27:51820)
    at pts (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:27:1053718)
    at ots (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:27:1052114)
    at mts (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:27:1051588)
    at its (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:27:1048648)
    at dts (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:27:1046954)
    at Ars (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:27:983529)
    at Object.zrs [as _main] (blob:http://127.0.0.1:8080/d57b8f27-ad23-4ad2-9a46-9c13ee9ab1e6:27:981568)
    at Object.callMain (blob:http://127.0.0.1:8080/6528abf0-4d12-4b74-a234-656bb722be34:4:53381)
    at doRun (blob:http://127.0.0.1:8080/6528abf0-4d12-4b74-a234-656bb722be34:4:54069)
    at run (blob:http://127.0.0.1:8080/6528abf0-4d12-4b74-a234-656bb722be34:4:54237)
    at runCaller (blob:http://127.0.0.1:8080/6528abf0-4d12-4b74-a234-656bb722be34:4:53000)
    at Object.removeRunDependency (blob:http://127.0.0.1:8080/6528abf0-4d12-4b74-a234-656bb722be34:2:26969)
    at blob:http://127.0.0.1:8080/6528abf0-4d12-4b74-a234-656bb722be34:2:413
    at doCallback (blob:http://127.0.0.1:8080/6528abf0-4d12-4b74-a234-656bb722be34:2:95005)
    at done (blob:http://127.0.0.1:8080/6528abf0-4d12-4b74-a234-656bb722be34:2:95143)
    at done (blob:http://127.0.0.1:8080/6528abf0-4d12-4b74-a234-656bb722be34:2:78086)
    at Object.storeLocalEntry (blob:http://127.0.0.1:8080/6528abf0-4d12-4b74-a234-656bb722be34:2:76546)
    at blob:http://127.0.0.1:8080/6528abf0-4d12-4b74-a234-656bb722be34:2:78318
    at IDBRequest.UnityLoader.acf91ec2eba17551b73e9cfa428e8f47.IDBFS.loadRemoteEntry.req.onsuccess (blob:http://127.0.0.1:8080/6528abf0-4d12-4b74-a234-656bb722be34:2:76896)

    ----------------------------------------
    Unity version: 2018.2.9
    Build Webgl
    Link target asm.js (not webassembly, it not even build)

    WebGL Assimp native plugin Requires Unity 2017.4.1f1 only?
     
  40. jcbadboy

    jcbadboy

    Joined:
    Mar 24, 2010
    Posts:
    48
    If you enable "Enable Debug" this errors shows on console:

    Assets/TriLib/TriLib/Scripts/Extensions/Texture2DUtils.cs(58,71): error CS0103: The name `path' does not exist in the current context

    Assets/TriLib/TriLib/Scripts/Extensions/Texture2DUtils.cs(68,66): error CS0103: The name `path' does not exist in the current context
     
  41. jcbadboy

    jcbadboy

    Joined:
    Mar 24, 2010
    Posts:
    48
    If I try to build a webgl project using linker target webassembly i get this error(Unity version: 2018.2.9):

    Failed running "C:\Program Files\Unity2018\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe" "C:\Program Files\Unity2018\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc" @"D:\Temp\teste\Teste\Assets\..\Temp\emcc_arguments.resp"

    stdout:(module
    (type $FUNCSIG$ii (func (param i32) (result i32)))
    (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
    (type $FUNCSIG$vii (func (param i32 i32)))
    (type $FUNCSIG$iiiiii (func (param i32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$viiiiii (func (param i32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$viii (func (param i32 i32 i32)))
    (type $FUNCSIG$vi (func (param i32)))
    (type $FUNCSIG$viijii (func (param i32 i32 i64 i32 i32)))
    (type $FUNCSIG$iii (func (param i32 i32) (result i32)))
    (type $FUNCSIG$iijii (func (param i32 i64 i32 i32) (result i32)))
    (type $FUNCSIG$iiiii (func (param i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$fii (func (param i32 i32) (result f32)))
    (type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
    (type $FUNCSIG$i (func (result i32)))
    (type $FUNCSIG$iif (func (param i32 f32) (result i32)))
    (type $FUNCSIG$viiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$v (func))
    (type $FUNCSIG$di (func (param i32) (result f64)))
    (type $FUNCSIG$vijji (func (param i32 i64 i64 i32)))
    (type $FUNCSIG$iifi (func (param i32 f32 i32) (result i32)))
    (type $FUNCSIG$iiifi (func (param i32 i32 f32 i32) (result i32)))
    (type $FUNCSIG$viiifi (func (param i32 i32 i32 f32 i32)))
    (type $FUNCSIG$iiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$viiiii (func (param i32 i32 i32 i32 i32)))
    (type $FUNCSIG$diii (func (param i32 i32 i32) (result f64)))
    (type $FUNCSIG$jiii (func (param i32 i32 i32) (result i64)))
    (type $FUNCSIG$fiii (func (param i32 i32 i32) (result f32)))
    (type $FUNCSIG$iiiiiii (func (param i32 i32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$viiiiiii (func (param i32 i32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$iiji (func (param i32 i64 i32) (result i32)))
    (type $FUNCSIG$jiiii (func (param i32 i32 i32 i32) (result i64)))
    (type $FUNCSIG$jiiiii (func (param i32 i32 i32 i32 i32) (result i64)))
    (type $FUNCSIG$viiiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$iiiiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$fiiii (func (param i32 i32 i32 i32) (result f32)))
    (type $FUNCSIG$iidi (func (param i32 f64 i32) (result i32)))
    (type $FUNCSIG$diiii (func (param i32 i32 i32 i32) (result f64)))
    (type $FUNCSIG$diiiii (func (param i32 i32 i32 i32 i32) (result f64)))
    (type $FUNCSIG$viji (func (param i32 i64 i32)))
    (type $FUNCSIG$vifi (func (param i32 f32 i32)))
    (type $FUNCSIG$vidi (func (param i32 f64 i32)))
    (type $FUNCSIG$iiiiiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$viiji (func (param i32 i32 i64 i32)))
    (type $FUNCSIG$viifi (func (param i32 i32 f32 i32)))
    (type $FUNCSIG$viidi (func (param i32 i32 f64 i32)))
    (type $FUNCSIG$jii (func (param i32 i32) (result i64)))
    (type $FUNCSIG$iiiji (func (param i32 i32 i64 i32) (result i32)))
    (type $FUNCSIG$iijji (func (param i32 i64 i64 i32) (result i32)))
    (type $FUNCSIG$iijjji (func (param i32 i64 i64 i64 i32) (result i32)))
    (type $FUNCSIG$viijji (func (param i32 i32 i64 i64 i32)))
    (type $FUNCSIG$viijjji (func (param i32 i32 i64 i64 i64 i32)))
    (type $FUNCSIG$viijijji (func (param i32 i32 i64 i32 i64 i64 i32)))
    (type $FUNCSIG$viiiji (func (param i32 i32 i32 i64 i32)))
    (type $FUNCSIG$iiiiiiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiiiiiiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiiiiiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$viiiiiiiiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$viiiiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$viiiiiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$viifiii (func (param i32 i32 f32 i32 i32 i32)))
    (type $FUNCSIG$viifii (func (param i32 i32 f32 i32 i32)))
    (type $FUNCSIG$dii (func (param i32 i32) (result f64)))
    (type $FUNCSIG$jijii (func (param i32 i64 i32 i32) (result i64)))
    (type $FUNCSIG$jiijiii (func (param i32 i32 i64 i32 i32 i32) (result i64)))
    (type $FUNCSIG$iiijii (func (param i32 i32 i64 i32 i32) (result i32)))
    (type $FUNCSIG$vijii (func (param i32 i64 i32 i32)))
    (type $FUNCSIG$viiijiii (func (param i32 i32 i32 i64 i32 i32 i32)))
    (type $FUNCSIG$vijiijiii (func (param i32 i64 i32 i32 i64 i32 i32 i32)))
    (type $FUNCSIG$viiijiiiiii (func (param i32 i32 i32 i64 i32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$vijjiiiiii (func (param i32 i64 i64 i32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$vijiji (func (param i32 i64 i32 i64 i32)))
    (type $FUNCSIG$viijijiii (func (param i32 i32 i64 i32 i64 i32 i32 i32)))
    (type $FUNCSIG$vijiii (func (param i32 i64 i32 i32 i32)))
    (type $FUNCSIG$jijjji (func (param i32 i64 i64 i64 i32) (result i64)))
    (type $FUNCSIG$jiji (func (param i32 i64 i32) (result i64)))
    (type $FUNCSIG$iiiiiijii (func (param i32 i32 i32 i32 i32 i64 i32 i32) (result i32)))
    (type $FUNCSIG$viiiiijiiii (func (param i32 i32 i32 i32 i32 i64 i32 i32 i32 i32)))
    (type $FUNCSIG$fiiffi (func (param i32 i32 f32 f32 i32) (result f32)))
    (type $FUNCSIG$iiiiijii (func (param i32 i32 i32 i32 i64 i32 i32) (result i32)))
    (type $FUNCSIG$viiijji (func (param i32 i32 i32 i64 i64 i32)))
    (type $FUNCSIG$iijjii (func (param i32 i64 i64 i32 i32) (result i32)))
    (type $FUNCSIG$jidi (func (param i32 f64 i32) (result i64)))
    (type $FUNCSIG$didi (func (param i32 f64 i32) (result f64)))
    (type $FUNCSIG$difi (func (param i32 f32 i32) (result f64)))
    (type $FUNCSIG$diji (func (param i32 i64 i32) (result f64)))
    (type $FUNCSIG$jifi (func (param i32 f32 i32) (result i64)))
    (type $FUNCSIG$fidi (func (param i32 f64 i32) (result f32)))
    (type $FUNCSIG$fifi (func (param i32 f32 i32) (result f32)))
    (type $FUNCSIG$fiji (func (param i32 i64 i32) (result f32)))
    (type $FUNCSIG$viiiiiiiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$diddi (func (param i32 f64 f64 i32) (result f64)))
    (type $FUNCSIG$fiffi (func (param i32 f32 f32 i32) (result f32)))
    (type $FUNCSIG$jijji (func (param i32 i64 i64 i32) (result i64)))
    (type $FUNCSIG$didii (func (param i32 f64 i32 i32) (result f64)))
    (type $FUNCSIG$didiii (func (param i32 f64 i32 i32 i32) (result f64)))
    (type $FUNCSIG$viidii (func (param i32 i32 f64 i32 i32)))
    (type $FUNCSIG$iiifii (func (param i32 i32 f32 i32 i32) (result i32)))
    (type $FUNCSIG$iiidii (func (param i32 i32 f64 i32 i32) (result i32)))
    (type $FUNCSIG$iifii (func (param i32 f32 i32 i32) (result i32)))
    (type $FUNCSIG$iidii (func (param i32 f64 i32 i32) (result i32)))
    (type $FUNCSIG$jiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32) (result i64)))
    (type $FUNCSIG$jidji (func (param i32 f64 i64 i32) (result i64)))
    (type $FUNCSIG$viffi (func (param i32 f32 f32 i32)))
    (type $FUNCSIG$viffffi (func (param i32 f32 f32 f32 f32 i32)))
    (type $FUNCSIG$vifffi (func (param i32 f32 f32 f32 i32)))
    (type $FUNCSIG$viiiifi (func (param i32 i32 i32 i32 f32 i32)))
    (type $FUNCSIG$vijiiii (func (param i32 i64 i32 i32 i32 i32)))
    (type $FUNCSIG$viifffi (func (param i32 i32 f32 f32 f32 i32)))
    (type $FUNCSIG$fifffi (func (param i32 f32 f32 f32 i32) (result f32)))
    (type $FUNCSIG$iiffi (func (param i32 f32 f32 i32) (result i32)))
    (type $FUNCSIG$fiffifffi (func (param i32 f32 f32 i32 f32 f32 f32 i32) (result f32)))
    (type $FUNCSIG$viiffi (func (param i32 i32 f32 f32 i32)))
    (type $FUNCSIG$viiiffi (func (param i32 i32 i32 f32 f32 i32)))
    (type $FUNCSIG$viiffii (func (param i32 i32 f32 f32 i32 i32)))
    (type $FUNCSIG$viijjii (func (param i32 i32 i64 i64 i32 i32)))
    (type $FUNCSIG$vifffii (func (param i32 f32 f32 f32 i32 i32)))
    (type $FUNCSIG$iiiiiiffiiiiiiiiiffffiiii (func (param i32 i32 i32 i32 i32 f32 f32 i32 i32 i32 i32 i32 i32 i32 i32 i32 f32 f32 f32 f32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiiiiffiiiiiiiiiiiiiii (func (param i32 i32 i32 i32 i32 f32 f32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$fiiffffiiiii (func (param i32 i32 f32 f32 f32 f32 i32 i32 i32 i32 i32) (result f32)))
    (type $FUNCSIG$fiiffffii (func (param i32 i32 f32 f32 f32 f32 i32 i32) (result f32)))
    (type $FUNCSIG$fiiffffiiiiii (func (param i32 i32 f32 f32 f32 f32 i32 i32 i32 i32 i32 i32) (result f32)))
    (type $FUNCSIG$viiiiiiffii (func (param i32 i32 i32 i32 i32 i32 f32 f32 i32 i32)))
    (type $FUNCSIG$fiifi (func (param i32 i32 f32 i32) (result f32)))
    (type $FUNCSIG$viffffii (func (param i32 f32 f32 f32 f32 i32 i32)))
    (type $FUNCSIG$viffffiii (func (param i32 f32 f32 f32 f32 i32 i32 i32)))
    (type $FUNCSIG$viiffffiiiii (func (param i32 i32 f32 f32 f32 f32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$iiifiii (func (param i32 i32 f32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiifiii (func (param i32 i32 i32 f32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiifii (func (param i32 i32 i32 f32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiifi (func (param i32 i32 i32 f32 i32) (result i32)))
    (type $FUNCSIG$iiifiiii (func (param i32 i32 f32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiiifiii (func (param i32 i32 i32 i32 f32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiiifii (func (param i32 i32 i32 i32 f32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiiifi (func (param i32 i32 i32 i32 f32 i32) (result i32)))
    (type $FUNCSIG$iiijjiiii (func (param i32 i32 i64 i64 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iifffi (func (param i32 f32 f32 f32 i32) (result i32)))
    (type $FUNCSIG$viifiiii (func (param i32 i32 f32 i32 i32 i32 i32)))
    (type $FUNCSIG$viffii (func (param i32 f32 f32 i32 i32)))
    (type $FUNCSIG$viiffiii (func (param i32 i32 f32 f32 i32 i32 i32)))
    (type $FUNCSIG$vifii (func (param i32 f32 i32 i32)))
    (type $FUNCSIG$fifii (func (param i32 f32 i32 i32) (result f32)))
    (type $FUNCSIG$fiiifi (func (param i32 i32 i32 f32 i32) (result f32)))
    (type $FUNCSIG$fiiifii (func (param i32 i32 i32 f32 i32 i32) (result f32)))
    (type $FUNCSIG$iiiifiiii (func (param i32 i32 i32 f32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$viiiifii (func (param i32 i32 i32 i32 f32 i32 i32)))
    (type $FUNCSIG$viiiiiffi (func (param i32 i32 i32 i32 i32 f32 f32 i32)))
    (type $FUNCSIG$iiiiiiiiiiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iiffii (func (param i32 f32 f32 i32 i32) (result i32)))
    (type $FUNCSIG$iiffiii (func (param i32 f32 f32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iifiii (func (param i32 f32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiffi (func (param i32 i32 f32 f32 i32) (result i32)))
    (type $FUNCSIG$f (func (result f32)))
    (type $FUNCSIG$fi (func (param i32) (result f32)))
    (type $FUNCSIG$vif (func (param i32 f32)))
    (type $FUNCSIG$viif (func (param i32 i32 f32)))
    (type $FUNCSIG$viiff (func (param i32 i32 f32 f32)))
    (type $FUNCSIG$iiiiiiffiiiiiiiiiffffiii (func (param i32 i32 i32 i32 i32 f32 f32 i32 i32 i32 i32 i32 i32 i32 i32 i32 f32 f32 f32 f32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$ji (func (param i32) (result i64)))
    (type $FUNCSIG$fiif (func (param i32 i32 f32) (result f32)))
    (type $FUNCSIG$viiijjii (func (param i32 i32 i32 i64 i64 i32 i32)))
    (type $FUNCSIG$viiiiifii (func (param i32 i32 i32 i32 i32 f32 i32 i32)))
    (type $FUNCSIG$iiijjii (func (param i32 i32 i64 i64 i32 i32) (result i32)))
    (type $FUNCSIG$vid (func (param i32 f64)))
    (type $FUNCSIG$viiiiiif (func (param i32 i32 i32 i32 i32 i32 f32)))
    (type $FUNCSIG$viiiiif (func (param i32 i32 i32 i32 i32 f32)))
    (type $FUNCSIG$fff (func (param f32 f32) (result f32)))
    (type $FUNCSIG$viiiif (func (param i32 i32 i32 i32 f32)))
    (type $FUNCSIG$iij (func (param i32 i64) (result i32)))
    (type $FUNCSIG$vij (func (param i32 i64)))
    (type $FUNCSIG$fif (func (param i32 f32) (result f32)))
    (type $FUNCSIG$iiif (func (param i32 i32 f32) (result i32)))
    (type $FUNCSIG$ff (func (param f32) (result f32)))
    (type $FUNCSIG$iiiiiiif (func (param i32 i32 i32 i32 i32 i32 f32) (result i32)))
    (type $FUNCSIG$viffff (func (param i32 f32 f32 f32 f32)))
    (type $FUNCSIG$vifff (func (param i32 f32 f32 f32)))
    (type $FUNCSIG$vff (func (param f32 f32)))
    (type $FUNCSIG$vffff (func (param f32 f32 f32 f32)))
    (type $FUNCSIG$vd (func (param f64)))
    (type $FUNCSIG$vf (func (param f32)))
    (type $FUNCSIG$iiij (func (param i32 i32 i64) (result i32)))
    (type $FUNCSIG$viiiiiiiiiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$viff (func (param i32 f32 f32)))
    (type $FUNCSIG$viifff (func (param i32 i32 f32 f32 f32)))
    (type $FUNCSIG$iiiiiifffiiifiii (func (param i32 i32 i32 i32 i32 f32 f32 f32 i32 i32 i32 f32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$vijj (func (param i32 i64 i64)))
    (type $FUNCSIG$viijj (func (param i32 i32 i64 i64)))
    (type $FUNCSIG$iifff (func (param i32 f32 f32 f32) (result i32)))
    (type $FUNCSIG$vifiiii (func (param i32 f32 i32 i32 i32 i32)))
    (type $FUNCSIG$iiiiifiiiiii (func (param i32 i32 i32 i32 f32 i32 i32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiifiiiii (func (param i32 i32 i32 f32 i32 i32 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiiifiif (func (param i32 i32 i32 i32 f32 i32 i32 f32) (result i32)))
    (type $FUNCSIG$iiiiiifiif (func (param i32 i32 i32 i32 i32 f32 i32 i32 f32) (result i32)))
    (type $FUNCSIG$viij (func (param i32 i32 i64)))
    (type $FUNCSIG$iiiiifiiiiif (func (param i32 i32 i32 i32 f32 i32 i32 i32 i32 i32 f32) (result i32)))
    (type $FUNCSIG$viiif (func (param i32 i32 i32 f32)))
    (type $FUNCSIG$fiiiiiiiifiiiif (func (param i32 i32 i32 i32 i32 i32 i32 i32 f32 i32 i32 i32 i32 f32) (result f32)))
    (type $FUNCSIG$fiiiiiifiiiiiif (func (param i32 i32 i32 i32 i32 i32 f32 i32 i32 i32 i32 i32 i32 f32) (result f32)))
    (type $FUNCSIG$viiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$vifiiiiiiiiiiiiiiiiii (func (param i32 f32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$vifiiiiiiiiiiiiiiiiiiiiiiiiiiii (func (param i32 f32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$vifiiiiiiiiiiiiiiiiiiiiiii (func (param i32 f32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32)))
    (type $FUNCSIG$iiiiiiiiiiffffii (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32 f32 f32 f32 f32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiiiiiiiiiiffffii (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 f32 f32 f32 f32 i32 i32) (result i32)))
    (type $FUNCSIG$ddi (func (param f64 i32) (result f64)))
    (type $FUNCSIG$fiff (func (param i32 f32 f32) (result f32)))
    (type $FUNCSIG$fiiiii (func (param i32 i32 i32 i32 i32) (result f32)))
    (type $FUNCSIG$if (func (param f32) (result i32)))
    (type $FUNCSIG$ifi (func (param f32 i32) (result i32)))
    (type $FUNCSIG$ifii (func (param f32 i32 i32) (result i32)))
    (type $FUNCSIG$iid (func (param i32 f64) (result i32)))
    (type $FUNCSIG$iiiif (func (param i32 i32 i32 f32) (result i32)))
    (type $FUNCSIG$iiiiid (func (param i32 i32 i32 i32 f64) (result i32)))
    (type $FUNCSIG$iiiiifiiiif (func (param i32 i32 i32 i32 f32 i32 i32 i32 i32 f32) (result i32)))
    (type $FUNCSIG$iiiiiid (func (param i32 i32 i32 i32 i32 f64) (result i32)))
    (type $FUNCSIG$iiiiiiijjiii (func (param i32 i32 i32 i32 i32 i32 i64 i64 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiiiijjii (func (param i32 i32 i32 i32 i32 i64 i64 i32 i32) (result i32)))
    (type $FUNCSIG$iiiiiijjiii (func (param i32 i32 i32 i32 i32 i64 i64 i32 i32 i32) (result i32)))
    (type $FUNCSIG$iiiiij (func (param i32 i32 i32 i32 i64) (result i32)))
    (type $FUNCSIG$iiiij (func (param i32 i32 i32 i64) (result i32)))
    (type $FUNCSIG$ijj (func (param i64 <message truncated>
     
  42. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Hi!

    Currently, there is no way to load an external dependency (like MTL files) from memory, besides texture files.

    I'm working on a new external file system to be included on the next TriLib update.
    That will fix these external dependendencies.

    Best regards,
    Ricardo Reis.
     
    mmortall likes this.
  43. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Hi, could you test the included sample on Unity 2017.4.1f1?
     
  44. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Hi, you can change the FileOpenDialog.Instance.Filter field from code:

    Code (CSharp):
    1. FileOpenDialog.Instance.Filter = "*.json";
     
    JenniB likes this.
  45. mmortall

    mmortall

    Joined:
    Dec 28, 2010
    Posts:
    89
    Thanks. I am currently using a workaround. Just unzip all into a temporal folder and load model from this folder directly.
     
  46. JenniB

    JenniB

    Joined:
    Feb 15, 2018
    Posts:
    62
    Hello :)
    When i load a GLTF 2.0 file, the rotation and scale in the gltf file will not be considered when loading.

    Code (CSharp):
    1. "nodes": [
    2.     {
    3.       "mesh": 0,
    4.       "rotation": [
    5.         0.0890866444,
    6.         -0.9960239,
    7.         0.000199955524,
    8.         -0.000164454948
    9.       ],
    10.       "scale": [
    11.         1.8782804,
    12.         1.87828028,
    13.         1.8782804
    14.       ],
    15.       "translation": [
    16.         -15.5318184,
    17.         -10.8044138,
    18.         7.523425
    19.       ],
    20.       "name": "meatal Chair.020"
    21.     }
    22.   ],
    23.  
    Just the translation is right in the loaded gameobject.
    Is it not supported or i made something wrong?

    I am loading the file with this method:
    Code (CSharp):
    1. assetLoader.LoadFromFile(modelBIMNode.path, assetLoaderOptions, null);
     
  47. federicoVS

    federicoVS

    Joined:
    Feb 8, 2017
    Posts:
    8
    Hi,

    I am on Mac OS (High Sierra 10.13.4) and I am using Unity version 2018.2.9f1.

    I have recently added TriLib to my project (in the Assets folder), and I want to create a project for WebGL.

    When I first imported TriLib to my project, I got the dialog:

    "TriLib was unable to find native plugins"

    and I clicked "Ask to save changes and restart".

    Then, when I tried to build for WebGL an empty build directory was created and the following errors appeared on the console:

    Failed running python "/Applications/Unity/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emcc"

    Exception: Failed building WebGL Player.

    UnityEditor.WebGL.ProgramUtils.StartProgramChecked (System.Diagnostics.ProcessStartInfo p) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/ProgramUtils.cs:48)

    UnityEditor.WebGL.WebGlBuildPostprocessor.EmscriptenLink (BuildPostProcessArgs args, Boolean wasmBuild, System.String sourceFiles, System.String sourceFilesHash) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:425)

    UnityEditor.WebGL.WebGlBuildPostprocessor.LinkBuild (BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:474)

    UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:937)

    UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at

    /Users/builduser/buildslave/unity/build/Editor/Mono/Modules/DefaultBuildPostprocessor.cs:27)

    UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTargetGroup targetGroup, BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:287)

    UnityEngine.GUIUtility

    Is there something I am missing?

    Thanks in advance
     
    Last edited: Oct 3, 2018
  48. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    Hi!

    Some improvements have been made to the GLTF 2 loader. They will be available on the next TriLib update which should be released till the end of the week. I suggest you to test your model after this release.
     
    Last edited: Oct 4, 2018
  49. rickomax

    rickomax

    Joined:
    Jun 11, 2013
    Posts:
    542
    I'm not sure about what is causing this issue, I haven't tested it on Unity 2018 yet.
    Is that the full error log you get?
     
    Last edited: Oct 4, 2018
  50. LuisCarlosContreras

    LuisCarlosContreras

    Joined:
    Aug 7, 2018
    Posts:
    3
    Hello, I'm having this error.
    This happens when I load a model from Android (Moto G5 2017). The model is OBJ format.
    At first, the model loads fine, but if I try to load the same model again I get this error for some reason(Check the image). error.png
    On Windows it works just fine for every model.

    Also I'm having issues with infinite loading time with this model on Android (21k Vertex, 3MB File Size, FBX and also I have it on OBJ), do you have any idea of what is happening?
    This is the model on the editor Debug.png
    I'm Using Unity 2018.1.6f1
    Thank you in advance.
     
unityunity