FBX Mesh Importer At Runtime (530158)

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 Unity - Manual: Introduction to AssetBundles 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.

2 Likes

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

1581795--94416--$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

This looks very useful!

This component is exactly what we need. What is the status of this project. Is it available on AssetStore?

Looks very promising! When will this be released? :slight_smile:
Also, is it possible for models to load in as humanoids (animation wise) so they can use ‘Animator’ instead of ‘Animation’?

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)

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.

1882639--121095--ufi.jpg

Hello Unity community:

Let me show you about some testings I did in WebPlayer compilation. You just write the filename at the top in text field and then you clic in “Load” button.

Files you can load were uploaded are
cube001.fbx
cube002.fbx
cube003.fbx
cube004.fbx
cube005.fbx
dino_high.fbx
dino.fbx
landscape.fbx
palm.fbx
rabbit.fbx
spline.fbx
terrain.fbx

And here is the link for you test by yourself UniFBX



Cool, will it be available for mac osx?

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

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

Thank you very much for your quick answer! When will your asset be available? and what about the price?? Thanks!

very interesting, also as it works with Unity Free…
Will source code be available ?

thanks!
Fred

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

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

1882639--121095--ufi.jpg

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?

1 Like

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

Any updates on skinned mesh and animation support? :slight_smile:

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

********************************************************************************************************************
UniFBX Settings
********************************************************************************************************************

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

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
********************************************************************************************************************