Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

Unity Fbx Exporter - Export Meshes, Skinned Meshes, Terrains and Textures

Discussion in 'Assets and Asset Store' started by UnLogick, Oct 2, 2016.

  1. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    Adding support for this is trivial. I'll make a setting for it.
     
    Sheynes likes this.
  2. kobara-kazuki

    kobara-kazuki

    Joined:
    Apr 15, 2016
    Posts:
    8
    Looking forward to it! Best regards.
     
  3. vmc7

    vmc7

    Joined:
    May 5, 2018
    Posts:
    4
    The OS is windows.
    I installed it in a new project, so I think it's clean, but...
    The error is here.

    Assets\Plugins\UnLogickFactory\FbxExporter\Scripts\TextureExporter.cs(213,70): error CS1061: 'Shader' does not contain a definition for 'GetDependency' and no accessible extension method 'GetDependency' accepting a first argument of type 'Shader' could be found (are you missing a using directive or an assembly reference?)
     
  4. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    Oh really? That log message sounds like a bug. What version of Unity are you on?

    I'll have to add support for that version of Unity. You can get it working by replacing TextureExporter.cs line 220 with
    Code (CSharp):
    1. Shader shader = terrain.materialTemplate.shader;
    But this hotfix will break terrain texture exporting for terrains with more than 4 textures!
     
  5. vmc7

    vmc7

    Joined:
    May 5, 2018
    Posts:
    4
    The version is 2018.4.20f1.
    Line 220? There was only { there was
     
  6. Sheynes

    Sheynes

    Joined:
    Mar 27, 2017
    Posts:
    35
    Hello !
    I am working on a character creator, (it's showcased here, in case
    ) and I wanted to allow people to export their models as an fbx.
    So I purchased your package ! So far the script showcased in the example scene seem to work, if I do not put any HDRP material on the exported object or any subobjects. If the material is an HDRP material and I try to export with textures it tells me :
    'ArgumentException: RenderTextureDesc width must be greater than zero.
    Parameter name: desc.width'
    I'd like the texture exporting to work, but it's not the main problem i'm facing at the moment.

    In fact, no matter the scene, and even in an empty scene, whenever and however I try to export my own model, by code, or with the dedicaced window, it does crash my unity editor. I took a little video to showcase the problem.

    https://i.gyazo.com/ae33c5c250f624b405208b20ec3e5857.mp4

    I also joined the crash files as a zip in case it could help us to find the problem. But basically the error is :
    UnityFbxExporter_x86_64_v15.dll caused an Access Violation (0xc0000005)
    in module UnityFbxExporter_x86_64_v15.dll at 0033:4fbdedc0.

    I am using unity LTS 2019.4.8f1 along with windows 10. May you have an hint ?
     

    Attached Files:

  7. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    Wow that video looks awesome, well done!

    About your crash. never seen anything like it. Can you please pm that zip file, or even better a repro project, it can be the entire thing for your convenience or preferable a trimmed down version, working with reproducible results makes everything so much easier.
     
  8. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    Apologies, dunno how I could get that mixed up. The line that needs to be replaced looks like this.
    Code (CSharp):
    1. Shader shader = layer > 0 ? terrain.materialTemplate.shader.GetDependency("AddPassShader") : terrain.materialTemplate.shader;
    I just checked the unity documentation and it seems that line of code should have given me an error when I uploaded the project to the asset store... Dunno how that happened, but I will fix this immediately, unfortunately the fix will not be quite as flexible when it comes to terrain replacement shaders.

    EDIT: I figured out how this happened, Unity 2018.3 and 2018.4 uses the new terrain layers but doesn't have this api... I uploaded with 2018.1 which uses the old terrain code and such compiled just fine. I'll release a new version asap.
     
    Last edited: Dec 1, 2020
  9. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    Unity Fbx Exporter 1.6.0 is live on the asset store.
    Asset Store: Unity Fbx Exporter

    Changes
    • Added BlendShapeExportOptions.WriteDeformations
    • Fixed the Look in Unity Dark theme
    • Removed Warnings in newer versions of Unity
    • Fixed a broken script for 2018.3 and 2018.4
    Enjoy!
     
    kazuki1123 and wetcircuit like this.
  10. Artini

    Artini

    Joined:
    Jan 29, 2016
    Posts:
    45
    Does not export meshes at all - even example assets from Unity fail.
    Unity 2019.4.15f1. Windows 10 Pro, 64 bit
    Please help.
    WorkshopSet01a.png
    WorkshopSet02a.jpg
     
  11. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    The error says "Mesh not readable." Select the mesh importer and click the readable toggle in the inspector. Unity can optimizes the mesh for runtime and reduce memory usage by not making it readable.
     
  12. vmc7

    vmc7

    Joined:
    May 5, 2018
    Posts:
    4
    We have seen it in action.
    Thank you!
     
    UnLogick likes this.
  13. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    Found a serious crash bug, huge thanks to @manurocker95

    It seems skinned meshes not marked isReadable results in a hard native crash!

    Please insert this hotfix to FbxExporter.cs at line 872.
    Code (CSharp):
    1. if (!mesh.isReadable)
    2. {
    3.     Debug.LogErrorFormat(mesh, "Fbx Exporter, Mesh not marked isReadable, skipping mesh {0}", mesh);
    4.     return false;
    5. }
    6.  
    This will log each mesh as not readable, and if you click the log line the mesh asset will be pinged, making it easier for you to fix.
     
  14. yinch

    yinch

    Joined:
    Jun 18, 2016
    Posts:
    6
    Hi,

    Doing a standalone build for Windows 10 64-bit using Unity 2019.4.10f1.
    Using the just the vanilla Example scene, when running the standalone exe, the export process "Player.log" reports this:
    Code (CSharp):
    1. Fbx Custom Property Exporter Example - Exporting own GameObject with custom properties
    2. (Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
    3.  
    4. ArgumentNullException: Value cannot be null.
    5. Parameter name: shader
    6.   at (wrapper managed-to-native) UnityEngine.Material.CreateWithShader(UnityEngine.Material,UnityEngine.Shader)
    7.   at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00008] in <548b4fa0e7e04f27a1b7580930bfb7dc>:0
    8.   at UnLogickFactory.TextureExporter.Awake () [0x00023] in <ffb7da9e7b32413ab772826767b783c9>:0
    9. UnityEngine.Object:Internal_CloneSingle(Object)
    10. UnityEngine.Object:Instantiate(GameObject)
    11. UnLogickFactory.TextureExporter:CreateTextureExporter()
    12. UnLogickFactory.FbxExporter:Export(String, FbxExportSettings, Transform[])
    13. UnLogickFactory.FbxCustomPropertyExporterExample:Export()
    14. UnLogickFactory.FbxCustomPropertyExporterExample:Start()
    15. (Filename: <548b4fa0e7e04f27a1b7580930bfb7dc> Line: 0)
    The exporting works fine when run in Editor
     
    Last edited: Dec 3, 2020
  15. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    You need to force add the fbx exporter shaders to your build settings. On mobile now, will elaborate later.
     
  16. GiuseppeFerraro

    GiuseppeFerraro

    Joined:
    Dec 6, 2020
    Posts:
    2
    Hi, I am going to buy Unity Fbx Exporter. I would like to have some clarification: is it possible to export a single model runtime? that is, deploy and export directly from the executable. Is it possible to choose the destination folder and the model format (.fbx for example)? I should be using it with WebJL - could it cause problems? thanks a lot
     
  17. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    If you're making a Windows Standalone (both 32 bits and 64 bits) build you can export at runtime.

    However WebGL is a cross platform build target so it's NOT supported!
     
    GiuseppeFerraro likes this.
  18. Betzalel

    Betzalel

    Joined:
    Dec 3, 2017
    Posts:
    22
    Hello ! I am not getting a window to export in my UI. in a new project using latest version of 2019. is there something i have to enable/disable/ package manager dependencies? Please help.
     
  19. GiuseppeFerraro

    GiuseppeFerraro

    Joined:
    Dec 6, 2020
    Posts:
    2
    thank you so much
     
  20. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    No dependencies, but Windows only.
    Do you see the menu item "Window|Unity Fbx Exporter"?
    Do you see the editor window?
    Any console errors?
    What other packages are in the project, everything is in a namespace so there shouldn't be any conflicts. If you have a nearly empty project where it fails please send that to me for testing.
     
  21. joyrideapps

    joyrideapps

    Joined:
    Jul 12, 2018
    Posts:
    1
    Hi there. Can you please explain where I can locate the mesh importer? I`m quite new to Unity, and I`m gettint the same "Mesh not readable"-error, so I guess I have the same issue as mentioned previously in this thread. I just can`t find anywhere where it says mesh importer..
     
  22. bigd33103

    bigd33103

    Joined:
    Jul 22, 2019
    Posts:
    4
    Using FBX exporter in 2018.4.20f1 and i am selecting a model thats just a basic armature and mesh with textures ( its a character ) when i export it i get an error of ((
    OnRenderImage() possibly didn't write anything to the destination texture!
    UnityEngine.Camera:Render()
    UnLogickFactory.TextureExporter:performTextureExport(Int32, Int32) (at Assets/Plugins/UnLogickFactory/FbxExporter/Scripts/TextureExporter.cs:349)
    UnLogickFactory.TextureExporter:processMaterial(Material, Renderer, FbxTextureExportScheme, String) (at Assets/Plugins/UnLogickFactory/FbxExporter/Scripts/TextureExporter.cs:172)
    UnLogickFactory.FbxExporter:ExportSkinnedMeshOrCloth(SkinnedMeshRenderer, Transform, TextureExporter, String, Dictionary`2, Dictionary`2, FbxExportSettings, FbxExportCollection) (at Assets/Plugins/UnLogickFactory/FbxExporter/Scripts/FbxExporter.cs:467)
    UnLogickFactory.FbxExporter:Export(String, FbxExportSettings, Transform[]) (at Assets/Plugins/UnLogickFactory/FbxExporter/Scripts/FbxExporter.cs:155)
    UnLogickFactory.FbxExporterWindow:OnGUI() (at Assets/Plugins/UnLogickFactory/FbxExporter/Scripts/Editor/FbxExporterWindow.cs:275)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
    ))
    and then it only exports the textures from the model and nothing else.
     

    Attached Files:

  23. kazuki1123

    kazuki1123

    Joined:
    Apr 26, 2018
    Posts:
    1
    Hello.
    Is it possible to export FBX with constraint information for this asset in the same way that I export FBX with constraint in Maya?
     
  24. FuegoHD

    FuegoHD

    Joined:
    Jun 26, 2020
    Posts:
    2
    Windows only? Still not available for Mac?
     
  25. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    No and there is no active plans to add support for constraints.
     
  26. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    No I'm afraid not, I actually bought a mac with intent on getting this working and then it broke. :( If anyone knows how to fix a mac book that doesn't even blink when you attempt to charge it please let me know.
     
  27. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    I'm aware of this problem, next release should contain a fix.
     
    bigd33103 likes this.
  28. darryldmps

    darryldmps

    Joined:
    Mar 11, 2015
    Posts:
    6
    Hi, when I standalone build and run the runtime fbx exporter example scene (no fbx file is generated), what it supposed to happen? I checked the build folders.
    I made the DLL changes recommenced for Standlanone (it's windows, I've only ticked standalone and x86_64, the rest unchecked) .
    It seems to only work in editor play mode.
    Using unity 2020.1.17f1
    Thanks.
     
  29. kobara-kazuki

    kobara-kazuki

    Joined:
    Apr 15, 2016
    Posts:
    8
    Currently, the version of the output FBX data seems to be 2015, but I would like to specify the FBX version and output the model, is that possible?
     
  30. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    The Fbx Exporter was created with the 2015 sdk, you do have a selection of formats to choose from but obviously not anyone newer than 2015.
     
  31. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    Not the first time this broke, I wonder why this keeps changing. The quick solution is simply to move the UnityFbxExporter_x86_64_v16.dll next to the binary, this is one of the locations I'm looking for it. I will update the search logic.
     
  32. darryldmps

    darryldmps

    Joined:
    Mar 11, 2015
    Posts:
    6
    Hi, I have the fbx exporter working at runtime. I'm exporting UMA avatars. The exporter works as expected with any undressed base mesh (in so much that it correctly exports the model, rig and weighting). However when wardrobe items (clothing) are attached to the avatar upon exported the weighting breaks and the model deforms incorrectly. I have troubleshot with the standard included UMA included assets and demo scene but this problem persists.

    You provided an example of an UMA exported avatar, I notice this is just the base mesh, had you succeeded in having the exporter working with clothing items attach to the avatar?
     
  33. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    154
    I was hoping that I could export a model with multiple materials with textures, but I can't.
     

    Attached Files:

  34. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    That should work, please pm me that prefab for testing.
     
  35. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,740
    Apologies for the late reply, I was not aware of this problem, can you please pm me the uma recipe along with any custom slots/overlays that breaks.
     
unityunity