chloridrik Posted December 20, 2016 Share Posted December 20, 2016 Hi, I'm using Unity 5.5.0 f3 and I have many bugs with the exporter. #1 : backed lightmap : - I have started a new scene with a plan, box, directional light and a camera. - My light use backed light only - My meshes use static lightmap - one standard material for my objects with a texture - In the exporter window I have checked "export lightmap", synchronous backing enabled, embed shader files. ==> but all my objects are black in the babylonjs preview when I use backed light. #2 : objects export : - I have tested with this model : https://www.assetstore.unity3d.com/en/#!/content/61925 and when I export I have this message : FileNotFoundException: Resources/unity_builtin_extra does not exist System.IO.File.Copy (System.String sourceFileName, System.String destFileName, Boolean overwrite) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:107) BabylonExport.Entities.BabylonScene.AddTexture (System.String texture) Unity3D2Babylon.SceneBuilder.CopyTexture (System.String texturePath, UnityEngine.Texture2D texture2D, BabylonExport.Entities.BabylonTexture babylonTexture, Boolean isLightmap) (at Assets/Babylon/Source/SceneBuilder.Materials.cs:274) Unity3D2Babylon.SceneBuilder.DumpTexture (UnityEngine.Texture texture, UnityEngine.Material material, System.String name, Boolean isLightmap) (at Assets/Babylon/Source/SceneBuilder.Materials.cs:1060) Unity3D2Babylon.SceneBuilder.DumpTextureFromMaterial (UnityEngine.Material material, System.String name) (at Assets/Babylon/Source/SceneBuilder.Materials.cs:1032) Unity3D2Babylon.SceneBuilder.DumpPBRMaterial (UnityEngine.Material material, Int32 lightmapIndex, Vector4 lightmapScaleOffset, Boolean metallic, Int32 lightmapCoordIndex) (at Assets/Babylon/Source/SceneBuilder.Materials.cs:480) Unity3D2Babylon.SceneBuilder.DumpMaterial (UnityEngine.Material material, Int32 lightmapIndex, Vector4 lightmapScaleOffset, Int32 lightmapCoordIndex) (at Assets/Babylon/Source/SceneBuilder.Materials.cs:304) Unity3D2Babylon.SceneBuilder.ConvertUnityMeshToBabylon (UnityEngine.Mesh mesh, UnityEngine.Transform transform, UnityEngine.GameObject gameObject, Single progress, UnityEditor.UnityMetaData& metaData, System.Collections.Generic.List`1& particleSystems, System.Collections.Generic.List`1& lensFlares, System.String& componentTags, BabylonExport.Entities.BabylonMesh collisionMesh, UnityEngine.Collider collider) (at Assets/Babylon/Source/SceneBuilder.Meshes.cs:345) Unity3D2Babylon.SceneBuilder.ConvertFromUnity () (at Assets/Babylon/Source/SceneBuilder.cs:597) UnityEngine.Debug:LogException(Exception) Unity3D2Babylon.SceneBuilder:ConvertFromUnity() (at Assets/Babylon/Source/SceneBuilder.cs:806) Unity3D2Babylon.ExporterWindow:Export(Boolean) (at Assets/Babylon/Source/ExporterWindow.cs:736) Unity3D2Babylon.ExporterWindow:OnGUI() (at Assets/Babylon/Source/ExporterWindow.cs:573) UnityEditor.DockArea:OnGUI() I have the latest version of today, I have updated the plugin to 2.5 version. Can you help me to understand please ? Best regards, Jeremie. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 20, 2016 Share Posted December 20, 2016 Hey Jeremie , did you try the new one? https://github.com/BabylonJS/Babylon.js/tree/master/Exporters/Unity 5/EditorToolkit Ping @MackeyK24 Quote Link to comment Share on other sites More sharing options...
chloridrik Posted December 20, 2016 Author Share Posted December 20, 2016 I have found the problem with the cars models. It was because the car_glass material use "UIMask" texture lol not a real texture file ^^ I meet an other problem in this scene : https://www.assetstore.unity3d.com/en/#!/content/65679 and I have solved it by adding in Tools.cs line 1031 : if(!mesh) return; I don't know why a mesh is null in this scene... @Deltakosh I test the new exporter now :-) Quote Link to comment Share on other sites More sharing options...
chloridrik Posted December 20, 2016 Author Share Posted December 20, 2016 @Deltakosh I have tested with this version in my first post and I can't see backed light. all is black Quote Link to comment Share on other sites More sharing options...
chloridrik Posted December 20, 2016 Author Share Posted December 20, 2016 I know it's just the beginning of the new unity exporter and I would like contribute too. I have a bug with this car model (with the fbx version) http://tf3dm.com/3d-model/mitsubishi-lancer-evolution-x-98027.html I'm watching for this problem. Quote Link to comment Share on other sites More sharing options...
chloridrik Posted December 20, 2016 Author Share Posted December 20, 2016 ok I have found the problem, it's because in SceneBuilder.Meshes.cs in ConvertUnityMeshToBabylon you use renderer.sharedMaterial.name as key in multiMatDictionary. But I see the renderer.sharedMaterial.name is the name of the first material... In this case the model is not realy optimized and have many multi-material starting with the same first material. To solve that, I concatain all sub materials names in a key : string key = ""; for (int i = 0; i < renderer.sharedMaterials.Length; i++) { key+=renderer.sharedMaterials[i].name; } if (!multiMatDictionary.ContainsKey(key)) { bMultiMat = new BabylonMultiMaterial { materials = new string[mesh.subMeshCount], id = Guid.NewGuid().ToString(), name = key//renderer.sharedMaterial.name }; for (int i = 0; i < renderer.sharedMaterials.Length; i++) { var sharedMaterial = renderer.sharedMaterials[i]; BabylonMaterial babylonMaterial; babylonMaterial = DumpMaterial(sharedMaterial, renderer.lightmapIndex, renderer.lightmapScaleOffset); bMultiMat.materials[i] = babylonMaterial.id; } if (mesh.subMeshCount > 1) { multiMatDictionary.Add(bMultiMat.name, bMultiMat); } } else { bMultiMat = multiMatDictionary[key]; } MrVR 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 20, 2016 Share Posted December 20, 2016 Excellent please feel free to send a PR Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.