Search Unity

FBX Mesh Importer At Runtime

Discussion in 'Works In Progress' started by carlossarria00, Feb 26, 2014.

?

Why do you need an fbx importer at runtime if you can use unity editor or simply use AssetBundles?

  1. Customize models at runtime

    26.6%
  2. Exchange models on fly

    45.0%
  3. Visualize

    15.3%
  4. It's better than have to recompile the project

    12.2%
  5. I don't need it

    1.0%
  1. Bartolomeus755

    Bartolomeus755

    Joined:
    Jun 20, 2013
    Posts:
    240
  2. Barmouta

    Barmouta

    Joined:
    Sep 25, 2015
    Posts:
    6
    Hi Carlos,

    Have you tested on iOS (iPad)? In particular have you tested Maya (.ma) models on iOS? Really want to buy if iOS build is supported.
     
  3. Barmouta

    Barmouta

    Joined:
    Sep 25, 2015
    Posts:
    6
    Also I got the demo app and demo models. Yet the status is "FileNotFound". What am I doing wrong?
     

    Attached Files:

  4. Bartolomeus755

    Bartolomeus755

    Joined:
    Jun 20, 2013
    Posts:
    240
    Hi Barmouta, you need to set the filename of the FBX file in the tab with the "levelGeometry".

    Marko
     
    carlossarria00 likes this.
  5. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Hi Barmouta

    UniFBX (2) doesn't have dlls or plugins in native code for other platforms. So you can use it for iOS too. Models in Maya (.ma) doesn't work because the asset is specifically released for fbx files
     
  6. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    As Bartolomeus755 wrote you must to write the filename (without extension, because it search for fbx) in the tab "levelGeometry". In the first tab you put the path where your models are saved and in the second tab you put the path where your textures are save. However, you can load fbx with embedded textures in jpg, png, dds or tga formats.
     
  7. Barmouta

    Barmouta

    Joined:
    Sep 25, 2015
    Posts:
    6
    Great! Thanks for your answers. I exported my model from Maya in ascii format and got it to work in the Windows demo version like so:
    file:///c:/models/
    file:///c:/models/tex
    test

    However, when I tried the Mac version I'm still getting FileNotFound error. I specified paths like so:
    file:///Users/E-Learning/models
    file:///Users/E-Learning/models/tex
    test

    I also tried blocks.fbx (without the extension) that worked in the Windows demo version, but not on Mac. Can you tell me how paths should be specified on Mac?

    Also I noticed that in the Mac demo when I paste path (command+V) the text is pasted twice although I'm definitely coping it once.
    Thanks,
     
  8. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Hi Bermouta

    Please, download and try the demo again. I add some script that write in model path field Application.dataPath so you can copy and paste your models in those paths as shown above

    standalone_win.jpg standalone_mac.jpg
     
  9. BrightSoul

    BrightSoul

    Joined:
    Jun 6, 2016
    Posts:
    1
    Hello there, I'm evaluating this importer but I've encountered a problem with the sample application you provided. Some of the models, such as landscape_cams.fbx and rabbit2013.fbx get loaded instantly while others, such as rabbit.fbx, get stuck during the "loading" phase at 26%. I tried waiting a few minutes but the model just won't get loaded. See the attached screenshot.
    I also tried exporting a simple cube from Blender in the FBX 6.1 ASCII format and it gets stuck all the same.
    I'm a newbie at working with Unity and 3D engines in general, so I might be overlooking something. In that case, I'd like to learn what I'm doing wrong.

    Thanks in advance!
     

    Attached Files:

    makimatt likes this.
  10. Jean-Michel585

    Jean-Michel585

    Joined:
    Dec 9, 2014
    Posts:
    7
    Hi,

    I try to import my Glass_House.fbx (without the extension) (built with Maya that works very well in Unity)
    But it gives me such status: BinaryNotSupported

    Thanks
     
  11. kityanlam3

    kityanlam3

    Joined:
    Feb 2, 2016
    Posts:
    41
    Hi,

    If I buy your UniFBX, I can use it commercially right? Stupid question, just need a reply so I can show proof.

    Thanks.
     
  12. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Hi Jean Michel

    FBX files in binary format is not supported yet. Maya has an option in the export dialog for exporting in ASCCI format.
     
  13. lifeforce

    lifeforce

    Joined:
    Jun 9, 2016
    Posts:
    1
    In C4D export how to set up ASCCI format?
     
  14. Jean-Michel585

    Jean-Michel585

    Joined:
    Dec 9, 2014
    Posts:
    7
    OK Thanks Carlo, It works in ASCII.

    Everything works on Windows
    I want to try on Mac but I do not understand your response #158
    Where put my file against your app?
    Why do not I give a full path?

    Thanks a lot
     
    Last edited: Jun 10, 2016
  15. Lesbordes

    Lesbordes

    Joined:
    Jul 2, 2015
    Posts:
    3
    Hello,

    I have buy your asset for importing FBX file, but I have few issues and I think you could really help me on it.
    My goal is to import a lot of planes in my scene during runtime. In your tutorial, it's more a loading at the launch of the scene, but nothing after.

    What's the best solution if I want to import several fbx file (and sometimes the same fbx file 3-4 time) during runtime, and manipulate easily the game object produce by your asset ?
     
  16. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Hi lifeforce

    fbx_export_dialog_ascci_c4d.jpg
     
  17. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Hi Jean Michel

    You must put your models folder inside content folder. By default, the path is in "Application.dataPath" so then you've got "Application.dataPath + "/models/"
     
    Jean-Michel585 likes this.
  18. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108

    Hi Lesbordes

    You can put in the scene several UniFBXImport Game Object and load them in diferent times. For expample, in a IEnumerator routine.

    public UniFBXImport UniFBXImports;

    IEnumerator LoadScene(){
    for(int i = 0; i < UniFBXImports.Length; i++){
    If(UniFBXImports != null){
    UniFBXImports.Load();
    yield return;
    }
    }
    }

    You can You can manipulate the Global Game Object.


    See: Tutorial 8

     
  19. Lesbordes

    Lesbordes

    Joined:
    Jul 2, 2015
    Posts:
    3
    Ok, is there a way to only have one UniFBXImport, and to import only by it several gameobject. What disturb me, is that your Load() function doesn't return a GameObject, so we can't directly manipulate it in our code.
     
  20. SandZ

    SandZ

    Joined:
    Mar 27, 2014
    Posts:
    1

    I also have this issue. FBX exported from blender don't work.
     
    makimatt likes this.
  21. vispan

    vispan

    Joined:
    Jun 11, 2016
    Posts:
    5
    Hello carlossarria00
    Is there anyway to import binary fbx files using UniFBX?
     
    Last edited: Jun 14, 2016
  22. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Lesbordes:

    In UniFBXImport.cs script there is a function call public "public GameObject GetObject ( )". It returns the GameObject created after Load() function. You must wait until GameObject (fbx file) is created then call the GetFunction() to get the GameObject. You can use a IEnumerator routine to wait for GameObject (FBX) is done
     
  23. Lesbordes

    Lesbordes

    Joined:
    Jul 2, 2015
    Posts:
    3
    Thanks for the reply, getObject() works fine, but I have one last problem, let me explain what I'm doing, I receive trough an UDP protocol position of a lot of planes. If the plane doesn't exist yet in my scene, I load his FBX file with your asset to manipulate it. It loads me one plane, but not the rest.
    Here's a short example, instead of my plane, I use your cube.fbx to taste it, everytime I receive a plane, this line of code are called :
    //This code should load a GameObject cube every time I receive one plane, but it only load one cube
    ufbx.setting.paths.urlModels = pathModel;
    ufbx.setting.paths.filename = "cube";
    ufbx.Load();
    GameObject g = ufbx.GetObject();
    g.name = newPlane.Callsign; ​

    I'm afraid that I need to have a unifbximport per plane, which is impossible, am I missing something ?
     
  24. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Hi Lesbordes

    No, in fact, you can set in the scene several planes with its own material. If you export the scene as "scene.fbx" (for example), you can import the file with the asset but take in account:

    When the FBX file is imported you have the GameObject that contains all objects inside. The GameObject (scene.fbx) is the root of the hierachy. So you can add a script to get all sub gameobjects.

    Ex:
    Transform[] trs = ufbx.GetObject(). GetComponentInChildren<Transform>();
     
  25. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Hi People:

    Working in UniFBX (2) for loading by streaming mode. The adventage of this method is the memory consumption comparing it with the text file mode.

    Some results are shown below

    Text file method
    indoor.fbx (238MB)
    UniFBX (2)
    GameObjects: 5566
    Polygones: 511227
    Time: 10.3 seconds
    Memory Used Total: ~1.50 GB
    Memory amount: 1500 MB - 120 MB = 1380 MB

    UniFBX_Mem001.jpg


    Streaming Method
    indoor.fbx (238MB)

    UniFBX (2)
    GameObjects: 5566
    Polygones: 511227
    Time: 17.1 seconds
    Memory USed Total: ~340 MB
    Memory amount: 340 MB - 120 MB = 220 MB

    UniFBX_Mem002.jpg

    Note:
    the importer just import mehses, materials and textures
     
    Last edited: Jun 22, 2016
    Bartolomeus755 and SAOTA like this.
  26. aherka

    aherka

    Joined:
    Jul 1, 2016
    Posts:
    1
    Hi carlossarria00,
    I've tried UniFBX(2) demo and had some troubles. Even though it says success on status, there is no visible mesh. I use my own fbx exporter. I can import any file that I export with my own exporter in 3ds max 2017 without any trouble. I added the file I'm trying to import with some screenshots. Any help would be appreciated.
     

    Attached Files:

  27. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108

    Hi Aherka:

    Your model is ok. Try to set a bigger scale either in your 3D model or in the field global scaling (for example 0.5 or 1.0)
     
  28. XenonSpher

    XenonSpher

    Joined:
    Dec 11, 2015
    Posts:
    29
    not supported? and binary not supported?
     

    Attached Files:

    Last edited: Jul 12, 2016
  29. Sword-Li

    Sword-Li

    Joined:
    Jul 12, 2016
    Posts:
    2
    Hi Carlos:
    Can you give me your email? We have bought your unifbx from asset store using the account 'Xingyu Yu', for our company's unity project ,our company named 'SinoSoft' in China, but it's very difficult to download form unity, it's very slow to download by unity in China, hardly move at all. can you sent this unifbx package to my email or Xingyu Yu's email ? my email is 'lijiabin102@sinosoft.info', Xingyu Yu's email is 'yuxingyu@sinosoft.info' ,you can see the downloading is too slow from the attachment pic, we have wait 1 hour, and retry many times, still less then 10%. QQ截图20160712161026.png
     
  30. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108

    Hi XenonSpher
    Yes, binary fbx files is not suported yet. For NGons we can export triangulated meshes.
     
    XenonSpher likes this.
  31. XenonSpher

    XenonSpher

    Joined:
    Dec 11, 2015
    Posts:
    29
    thanks already tried importing fbx files from cinema 4d with no problem what so ever thanks to your videos that you uploaded telling us to set text files when you export an fbx

    Now can you import scripts at runtime?
     
    carlossarria00 likes this.
  32. Sword-Li

    Sword-Li

    Joined:
    Jul 12, 2016
    Posts:
    2
    we have downloaded it last night, thanks.
     
    carlossarria00 likes this.
  33. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    What do you mean with "import scripts" at runtime?
     
  34. XenonSpher

    XenonSpher

    Joined:
    Dec 11, 2015
    Posts:
    29
    Exactly what it says.. runtime importing scripts so that we can use at realtime runtime.
     
  35. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108

    Yes, we can import the fbx scripts or fbx files ar tuntime
     
  36. G33RT

    G33RT

    Joined:
    Dec 27, 2013
    Posts:
    20
    Carlos, any particular reason why binary format is not supported? Plans on supporting it in the near future?
     
  37. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    HiG33RT

    Yes, of course binary format will be supported. I try to solve some issues with some data the vertices binary data (damn!)
     
  38. An-Red-Sky

    An-Red-Sky

    Joined:
    Jul 28, 2016
    Posts:
    1
    1. Hello carlossarria00
    2. I need import the model at runtime.,the model through the code into a prefab and and stored in a local file.
    3. I have already finished this function by other plug-ins,but the prefab is this:
    4. upload_2016-7-28_15-11-31.png
    5. the right model is this:
    6. upload_2016-7-28_15-23-26.png
    7. I need the prefab having the right meshfilter.The unifbx2 can do this?Please tell me,because I need to decide whether to buy this plug-in.
     

    Attached Files:

  39. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Hi An-Red-Sky

    UniFBX (2) doesn't work with prefabs. Prefabs are other data structure. UniFBX (2) just can load models exported from 3d editors like Maya, 3DMax, C4D. These FBX files can stored in a local disc
     
  40. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,105
    Very interested in your product, any way to provide a demo (Win / Android / iOS) with the lastest features?

    And is this tool still in progress / development so that we can rely on improvements, support and updates?
     
    Last edited: Aug 8, 2016
  41. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108

    In fact, it is already uploaded in asset store. There are some links for testing demos.

    UniFBX (2) [Release]
     
  42. novodev

    novodev

    Joined:
    Jul 24, 2015
    Posts:
    1
    Hi Carlos,

    I am using your Plugin and it is quite great.

    But I am having difficulties with some files. I have the original FBX in binary and I am using the AutoDesk FBX converter. It generates a new Ascii FBX.

    two things

    1) Some models are imported with all meshes messed around, example: (If I import the Ascii into unity it shows perfectly)

    http://www.turbosquid.com/FullPreview/Index.cfm/ID/351015



    2) It gives this error:

    KeyNotFoundException: The given key was not present in the dictionary.
    System.Collections.Generic.Dictionary`2[System.String,UnityEngine.GameObject].get_Item (System.String key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
    UniFBX.SetLclTransform (Int32 i) (at Assets/CSUE/UniFBX/Lib/UniFBX.cs:287)
    UniFBXImport+<ILoad>c__Iterator2.MoveNext () (at Assets/CSUE/UniFBX/Lib/UniFBXImport.cs:387)
    UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    UniFBXImport:Load() (at Assets/CSUE/UniFBX/Lib/UniFBXImport.cs:50)
    UniFBXLoader:OnGUI() (at Assets/CSUE/UniFBX/Scripts/UniFBXLoader.cs:23)

    Could you take a look into this?

    Thank you
     

    Attached Files:

  43. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108

    Hi novodev

    Try to move the pivote from meshes to their geometrical center
     
  44. rafaelferrari1

    rafaelferrari1

    Joined:
    Jan 6, 2014
    Posts:
    7
    Hi Carlos,

    I'm trying to use your plugin, but now, I can get 100% on load, but never adds on the scene. Seems like the proccess never ends or never change to isDone. You have some idea?

    I'm using FBX from blender in ASCII format.
     
    makimatt likes this.
  45. gallianne

    gallianne

    Joined:
    Aug 4, 2015
    Posts:
    1
    Hi Carlos,

    I just started to use your plugin it looks great but it seems that it crash when 2 items of the fbx file share the same name.

    Unity Console :
    do you have any solution to fix it ?

    regards,
     
  46. freseco

    freseco

    Joined:
    May 6, 2015
    Posts:
    4
    Hi carlossarria00,

    I am trying the plugin and it works almost well with your fbx models. I tried to use simple models(cube, esphere) from Blender(2.77) and it doesn't work().

    I would like to use the asset to import fbx with animation PRS from Blender/Maya.

    Could you tell us a example of how create a fbx file with animation PRS that it works with the asset?

    I found terrain4.fbx has animation in one light and it is imported.

    Also I have problem with android. It doesn't render well with shader type standard or legacy, I had to add Mobile unlit.

    Do you know when you will have binary format support?

    Thank you.

    regards,
     
  47. NeedHydra

    NeedHydra

    Joined:
    Sep 18, 2016
    Posts:
    2
    Hi Carlos
    In a post from last year you said you where working on blend shapes. Does UNIFBX support blend shapes at the moment?
     
  48. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Hi NeedHydra:

    Unfortunately, not yet. I'm working in real improves about memory and processing times
     
  49. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Hi, when you build a project with this asset you must to add the shaders you work with

    graphics.jpg

    Every 3D editor has its own "tool" for animation. I have to do a tutorial with some basic samples but in this moment is out of the reach
     
  50. LiuMinZhi51

    LiuMinZhi51

    Joined:
    Oct 12, 2016
    Posts:
    2
    Why I have "Binary format not supported" ?