Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

FBX Mesh Importer At Runtime

Discussion in 'Works In Progress - Archive' 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

    28.3%
  2. Exchange models on fly

    45.1%
  3. Visualize

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

    11.4%
  5. I don't need it

    0.8%
Thread Status:
Not open for further replies.
  1. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Sometimes, we need to load 2D/3D assets at runtime in our unity application. We can do this by saving it into the "Resources" folder in the unity editor and they'll be availables after compilation to load them at anytime. The Asset Bundles https://docs.unity3d.com/Documentation/Manual/AssetBundlesIntro.html is an option to store assets and load them from a hard disk, a sdcard or, even, a server location. However, all these options need to use unity editor and, in the asset bundle case, Unity Pro Edition is required.

    This thread talks about a fbx format mesh importer. We can run in unity either free or pro editions since 3.5.6 version.
     
    Last edited: Dec 9, 2014
    Root_Admin and RichardCNN like this.
  2. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    First of all, let me show you the FBX Mesh Importer configuration in unity editor to load FBX files (at runtime) as shown above:

    $fbx_importer_inspector_001.jpg


    Current Important Features:

    1. This script works with 3D models imported from FBX SDK 2011, 2012, 2013.

    2. ASCII importation from 3D Editors (3DMax, Maya, CINEMA4D, Blender).
    Almost all editors have this feature: binary or ascci importation.

    3. Setting folder or url containing fbx files

    4. Setting folder or url containing *.jpg or *.png textures

    5. Setting the maximum vertices for imported models containing geometry meshes
    Remember that unity allows to import 64K vertices per geometry mesh. It is very recommended allow upto 16K vertices per geometry mesh for this script version. Is it useful for you?

    6. Webplayer, Standalone, Android, iOS (not tested yet) supported. Unity Free and Pro editions since 3.5.6 version

    7. Async load mode implemented


     
    Last edited: Dec 9, 2014
  3. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    This looks very useful!
     
  4. killroy

    killroy

    Joined:
    Nov 8, 2011
    Posts:
    16
    This component is exactly what we need. What is the status of this project. Is it available on AssetStore?
     
  5. ZeoWorks

    ZeoWorks

    Joined:
    Dec 13, 2012
    Posts:
    76
    Looks very promising! When will this be released? :)
    Also, is it possible for models to load in as humanoids (animation wise) so they can use 'Animator' instead of 'Animation'?
     
  6. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    ZeoWorks:

    By this moment I use animation compenent for TRS animations. Humanoids is more complicated because of bone weights. And remember that fbx format is given in indexed information which it means that number of vertices (in fbx format) could differ from unity mesh vertices. I am working now in exhaustive tests and error treatments in order to avoid game crashes. I think that in two weeks will be realese ina first function version only with TRS animations (in unity it'll work with "animation" component for now)
     
    Last edited: Dec 9, 2014
  7. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Killoroy:

    I've been working on some improves. Now, it's working at runtime in WebPlayer, Standalone, Android and FlashPlayer (though it will be removed). I have to say that it doesn't work yet for skinned meshes but for Filter meshes do and TRS animation (Translation, Rotation, Scaling). Now, working for FBX SDK 2012, 2013, 2014.


     

    Attached Files:

    • ufi.jpg
      ufi.jpg
      File size:
      104.8 KB
      Views:
      2,082
    Last edited: Dec 9, 2014
  8. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108

    Attached Files:

  9. stevenapolo7

    stevenapolo7

    Joined:
    Aug 15, 2012
    Posts:
    24
    Cool, will it be available for mac osx?
     
  10. carlossarria00

    carlossarria00

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

    In my first testings it's working for:
    • WebPlayer (main thread and async)
    • Standalone_Win (main thread and async)
    • Android (main thread and async)
    • FlashPlayer (main thread). However, high poly models cause that game crashes. It's not really recommended but it could be work for some low poly models
    • Standalone_MacOSX is not tested completly but I hope that it works and for iOS as well
     
    Last edited: Dec 11, 2014
  11. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Hi carlossarria00,

    If I understand correctly we'll be able to import Translation,Rotation and Scale keyframes in an fbx file via this asset. Do you think camera animation will work ? a free camera should not be a problem but a look at camera might be a problem.
    Have you made any tests with an animated camera?

    When do you think it'll be available and what is your estimated price for the final asset?

    Do you have plans to add support for skinned animation (and use animator), blendshape in future releases?

    Thanks
     
  12. stevenapolo7

    stevenapolo7

    Joined:
    Aug 15, 2012
    Posts:
    24
    Thank you very much for your quick answer! When will your asset be available? and what about the price?? Thanks!
     
  13. Frednaar

    Frednaar

    Joined:
    Apr 18, 2010
    Posts:
    153
    very interesting, also as it works with Unity Free...
    Will source code be available ?

    thanks!
    Fred
     
  14. carlossarria00

    carlossarria00

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

    Thanks for you interest in these posts about current Thread.

    1. In a first release of this asset we can import Translation, Rotation and Scaling keyframes from a fbx file.
    Translation, Rotation and Scaling are working well for all type of gameObject as long as fbx exported file allow it.
    For example: we can animate a translation of a null object or animate a scaling of a mesh model.

    About cameras: I understand that you mean TRS animation for cameras. FBX file exports camera information. So we can extract some values like FieldOfView, Aspect, Position, Rotation, Scaling and Look At, which can be compatible with Unity Camera. So we can have our customized cameras from a fbx file and, why not, a visualization path. I had left this option because of project target but I'll take it in account for the final release.

    2. The asset will be available in Asset Store if they allow and I have not decided about the price becase it depends on diffrent issues. I think it could be oscilate about $40 - $80 (what do you think about?). I will be alertting about that

    3. In future release, I hope make some improves like load times, and some util features. Skinned animation is very complex issue even when unity doesn't load a pure data from fbx file. We must to add information for a correct hierarchy or uv mapping for correct texturing In fact, unity skinned mesh renderer uses 4 bone weights for each vertex. Some geometry meshes have worked well but is not complete so in a first release the asset woudn't include skinned animation although we can choose mesh filter or skinned mesh renderer for "static meshes".
    In a future release I hope delivery this feature. Moreover, it's a feature that I need too.

    I hope answer your questions about this Thread and I hope feedbacks constantly.
    Thanks
     
    Last edited: Dec 11, 2014
  15. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Frednaar

    The source files will be available so we can edit it as desired according our needs.
    Note: the image down containing source files does not represent the final release

     

    Attached Files:

    • ufi.jpg
      ufi.jpg
      File size:
      104.8 KB
      Views:
      1,827
    Last edited: Dec 11, 2014
  16. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Thanks for your reply,

    I think a price for such an asset depends on a few things, mostly around how much time you'll be giving to this asset:

    availability of the new features
    -frequency of the updates
    -the time you'll be supporting through feature Unity releases

    You can always start with a lower price and go higher with new features. And I think this is the best approach while you're growing your user base.

    By the way, have you made any tests with Unity5 and Blender .fbx exports?
     
    carlossarria00 likes this.
  17. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    gurayg

    I have not made any test with Unity 5. I suppose that for WebGL applications we won't need some external asset for importing fbx files on fly. There are some scripts and tools that works for WebGL not only for FBX but OBJ, DAE as well. However, we'll need for other platforms. I hope be testing as soon as posible with Unity 5.

    Not yet with Blender, but I'm working exhaustively the file exportation with Maya and Cinema 4D because they have some differences in the data struct. Like axis orientation and materials.

    All of this, I'll be explaining in the next posts.
    Thanks for your feedback
     
    Last edited: Dec 30, 2014
  18. ZeoWorks

    ZeoWorks

    Joined:
    Dec 13, 2012
    Posts:
    76
    Any updates on skinned mesh and animation support? :)
     
  19. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    ZeoWorks

    Yes, of course. it will have skinned mesh update as long as skinned mesh animation like humanoid works perfectly with its bone weights.
    Animator Integration at runtime as long as Unity realse allow it
     
  20. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    ***************************************************************************************************************************
    UniFBX Settings

    ***************************************************************************************************************************

    This is the script that contains all settings for a fbx file to be imported in the scene of a unity level


    ufbx_setting_main.JPG ufbx_setting_load.JPG

    Setting


    Paths:

    Paths where fbx files and texture files are saved. If you use a WebPlayer or Standalone Platform, you can access to the hard disc for fbx models located there.

    Examples:
    For URL the fbx file location would be
    "http://localhost/unifbx/models/land.fbx"
    and for textures
    "http://localhost/unifbx/models/tex/land_tex_cm.jpg"

    Main Thread:
    FBX files are loaded in the main thread where other GameObjects are processed

    All platforms

    Async Thread:

    FBX files are loaded in a independent thread and let the game flows normal
    Platform tested: WebPlayer, Standalone, Android, iOS


    Meshes:

    • Import meshes or not
    • Scale model
    • Mesh Methode: Unity or FBX
    • Unity requires to calculate more for set the normals, tangents and/or uvs correctly. FBX is faster than Unity Method, that is ideal if your meshes are planes for example
    • Normal Methode: Imported, Calculated or Do nothing
    • Tangent Methode: Imported, Calculated or Do nothing. This is important if you want to use normalmaps on meshes
    • Collider Type: None, Box Collider, Sphere Collider, Mesh Collider
    • Convert To: None, Terrain. This is suitable if you want to load a mesh as a terrain. You should know in advance that your mesh will be a terrain to make used of this property

    Materials:
    • Import or not materials
    • Use a default material. This is materials with a basic Diffuse Shader.
    • Use All shader in materials: this is material according with the FBX file

    Textures:
    • Import or not textures
    • Texture compression: ARGB or DTX
    • Texture mipmaps: this is suitable if you want to load a mesh as a terrain and want to use normalmaps
    • Colormaps, Normalmaps, Bumpmaps, Scpecularmaps (maybe others) if they are available in the FBX file
    Here is a sample for Standalone_Win. You just open the "UniFBX.exe" and write the filename in the textarea filed at the top.
    If you want to check your own models you must to copy in models folder
    /UniFBX StandaloneWin Test/UniFBX_Data/models/

    and textures copied in tex folder
    /UniFBX StandaloneWin Test/UniFBX_Data/models/tex/.

    ***************************************************************************************************************************
    Check that out and comment me possible improves
    UniFBX StandaloneWin Test.zip
    ***************************************************************************************************************************
     
    Last edited: Jan 5, 2015
  21. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    Really looking forward to this, as the other runtime fbx importers in the asset store seem to be abandoned.
     
    carlossarria00 likes this.
  22. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    this sounds good. Is it available yet?
     
  23. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    rahuxx

    Not available yet. I must to test in other expected platforms
     
  24. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Thanks Korindian

    I hope to delivery as a good and useful scripting tool as soon as posible
     
    Last edited: Jan 27, 2015
  25. ZeoWorks

    ZeoWorks

    Joined:
    Dec 13, 2012
    Posts:
    76
    All the other fbx importers have been abandoned, I've purchased them myself, the creators do not support them any more.

    Also, carlossarria00 you are making great progress! Will there be a 'load from bytes[]' function as well as the 'load from string function' you've shown us? If not, it should be easy to implant ourselves right? :)
     
    carlossarria00 likes this.
  26. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    ZeoWorks:

    Thanks for your comment.
    Bytes[] function will be considered in a update. I know it is really necesary. For example, Blender exports models in FBX SDK 2010 with ASCII method which is not provided in this release. But it exports models in FBX 2011 (and higher) only in binary format. And anyway,the source code will be available for editing by yourself
     
    Last edited: Jan 25, 2015
  27. carlossarria00

    carlossarria00

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

    I have made some improves in materials and textures loading. Also, we will be able to import Lights and Cameras from fbx files if availables.

    More info next
     
  28. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Hello carlossarria00,
    So using FBX 7.4 Binary in Blender is OK.

    It's great if we can import Lights and cameras from the .fbx.
    How is the skinned animation coming along. Will it be in an update or with the first released version?
    When do you think you'll be releasing fbx mesh importter?
     
  29. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    gurayg

    Skinned mehs and/or animation will be available in an update.
     
  30. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Hi People

    Here is this little demo about lights and cameras for you test by yourselft

    Remember:

    If you want to check your own models you must to copy in models folder
    /UniFBX_Lights_Cameras/UniFBX_Data/models/

    and textures copied in tex folder
    /UniFBX_Lights_Cameras/UniFBX_Data/models/tex/.


    UniFBX Lights & Cameras
     

    Attached Files:

    Last edited: Feb 20, 2015
  31. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Hello carlossarria00,
    When I run the application, it defaults to "landscape_cams.fbx" and if I run it; top and bottom GUI elements disappear when scene loads (that's OK) but If I run a custom file (default Blender scene exported as ascii fbx) bottom GUI says "Success" but all elements stay on screen. Nothing big, but I wanted you to know.

    Also I've tried a big .fbx file (616MB) just to see if it works; but It didn't. Just stayed in " Loading..." for 10-15 mins before I closed it.
     
  32. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    gurayg

    Yes, that's right. The little demo is just to see how many lights and cameras are into the scene. That's why element bar GUI desapears. Big files should be treated differently because basicly, what the scripts do is parse fbx information. Oh, I forgot, the little demo load the scene in mode "main thread". I gonna upload the lil' demo in "Async Thread" for you can load models while run the application.

    If you read the beginning of this thread, I specify the maximum vertices for imported models containing geometry meshes. However, this value can be modified. But anyway, I'm gonna take in account the loading of big files if it is suitable to work it at runtime

    Thank you for your feedback gurayg

    PD: Could you send me or give me a link of your big fbx file?
     
    Last edited: Feb 20, 2015
  33. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Hi!
    Its good to see that you're making progress. Hopefully we'll be able to test this closer when its released.

    I can not give the same file but I can prepare another big fbx file for you (not sure how big its gonna be)
    Will send you a pm for the link when its done.
     
  34. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    240
    The survey asks "Why do you need an fbx importer at runtime if you can use unity editor or simply use AssetBundles?" I think the biggest need is for those that can't afford all the pro licenses for each device just to use asset bundles. The goal on mobile devices is to keep file size small, a cache based fbx importer at runtime that support skinned meshes with animations would be a game changer esp. at a reasonable price.
     
    carlossarria00 likes this.
  35. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    productofself

    In fact, we will be able to use it for free unity edition with the advantage to replace models out of need to recompile project for generate the current asset for the game or application. Some features will be done as updates

    Target platform
    WebPlayer
    Standalone (Win, Mac, Linux)
    Android
    Flash Player (Unity 3.5 and above if available)
    iOS (not tested yet)

    We have to say that small models or small file size should be use for mobile platforms. However, some big files have beed loaded successful. I continue doing testings.

    Thanks for your answer to the survey
     
  36. SAOTA

    SAOTA

    Joined:
    Feb 9, 2015
    Posts:
    220
    This can be very useful. Good Job. Let us know when we can throw some money at you!!

    Also let me know If you need a mac tester. I have access to both mac and pc.
     
    Last edited: Feb 23, 2015
    carlossarria00 likes this.
  37. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    Hi People
    About Lights and Cameras

    I'm uploading a little demo sample about importing lights and cameras. It has a correction of an error I found in the last upload above. Also I pass you the links for Stanalone_Win and Standalone_Mac for you test by yourself
    I hope your feedback that help for enhance and improve the asset

    Remember again:

    If you want to check your own models you must to copy in models folder

    ****************************************************************

    WIN
    ****************************************************************
    /UniFBX_Lights_Cameras/UniFBX_Data/models/

    and textures copied in tex folder
    /UniFBX_Lights_Cameras/UniFBX_Data/models/tex/

    UniFBX Lights & Cameras (Win)


    ****************************************************************
    MAC
    ****************************************************************
    /UniFBX_Lights_Cameras.app/Contents/models/

    and textures copied in tex folder
    /UniFBX_Lights_Cameras.app/Contents/models/tex/

    UniFBX Lights & Cameras (Mac)
     
    GibTreaty likes this.
  38. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    240
    great and i have a windows phone to test on if that is a desired platform. do you have a goal date for a code preview or asset store release? I am currently messing with morph targets as a way around using asset bundles (don't have pro on all platforms) and I can just put that on hold and risk waiting for your asset if it had a due date that was reasonably soon or provided alpha access. this is a really interesting item to me, it fits a huge hole in my pipeline.
     
  39. SAOTA

    SAOTA

    Joined:
    Feb 9, 2015
    Posts:
    220
    I'm having some issues with my fbx files. I have converted them to acsi, but then some of my models are over 300mb. Is there a way to import Binary format Files?
     
  40. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    productofself

    I've been trying to solve all questions or some requirements that people let me know with their feedback. So I've been working on some improves always trying to reach the main goal of this work. The asset will be available when most of all test running well. One more month I think. When you get it you will have all source code. This is an attractive of this work.
     
  41. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    SAOTA

    I haven't considered binary format for this release. Also, I haven't considered long text (or binary) files. You should take in account most of runtime games model, files are serialized which it means that they are converted in a convenient format either to store or to read or to copy faster. FBX format has a structure well defined and what these scripts do is to translate that information to an object (mesh, light, camera, etc) that we can load in unity application at runtime without to have to recompile the project for load a different object, for example. So, 300 MB is a very long file for this approach.
     
  42. carlossarria00

    carlossarria00

    Joined:
    Feb 25, 2014
    Posts:
    108
    SAOTA

    What we can do, if it's useful for you, is to load every object or some objects grouped in a different fbx format file and load them in a interval time. For example, every frame or every 100 miliseconds
     
  43. CWolf

    CWolf

    Joined:
    Oct 24, 2011
    Posts:
    106
    I'm interested in this asset. I've already written my own Collada runtime importer, including animations, for our game but would like to expand support to FBX where possible. We use our model importer it for importing models (with their animations) into our game as part of a given mod. Animation support for this asset would be great.

    Look forward to release =).
     
    carlossarria00 likes this.
  44. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    Hey, any chance you would release that too?

    And to OP: when can we expect release?
     
  45. CWolf

    CWolf

    Joined:
    Oct 24, 2011
    Posts:
    106
    @slimshader: We have been considering it but it's a lot of work to support an asset properly. At the moment the Collada importer supports what we need from the format but may not cover what others need. Collada is so verbose it can express anything relating to the model. We'll probably gauge is there is a demand for it first.
     
  46. S_P_S

    S_P_S

    Joined:
    Feb 25, 2015
    Posts:
    91
    Nice Asset, I would definitely buy it.

    Is there already an approximately release date?

    Also it would be very cool if the Importer supports binary format. (Because of the flexibility that you don't have to convert the existing models)

    An important point for me is, that also the textures should be imported correctly. I tried most of the existing FBX Importer in the Asset Store and I have many troubles with them.

    So I hope this Asset changes it all :D

    Regards
     
    carlossarria00 likes this.
  47. ZeoWorks

    ZeoWorks

    Joined:
    Dec 13, 2012
    Posts:
    76
    Any more updates?
    I'm excited for the runtime humanoid/avatar feature.
     
  48. sz-Bit-Barons

    sz-Bit-Barons

    Joined:
    Nov 12, 2013
    Posts:
    150
    Hey carlossarria00,
    Will you ever release this? Everone here is waiting for it. Even if not everything is supported yet it would be super useful for me. Actually I need to struggle with Asset Bundles if you will not release it... this would be super annoying extra work for our team... :(
    So please release something :)
     
    carlossarria00 likes this.
  49. Aurecon_Unity

    Aurecon_Unity

    Joined:
    Jul 6, 2011
    Posts:
    241
    Yep, any updates? I'd pay good money for a reliable runtime FBX importer.
     
    ina, carlossarria00 and alcamedes like this.
  50. nawash

    nawash

    Joined:
    Jan 29, 2010
    Posts:
    166
    Hi all,
    Any news about a release of this nice project ?
     
    carlossarria00 likes this.
Thread Status:
Not open for further replies.