Do you need to load FBX at runtime? (Any comments about fbx are welcomed.)

Join discord of RuntimeFbx

RuntimeFbx handles FBX at runtime without dependency on FBX SDK in 2022.
https://assetstore.unity.com/packages/slug/137338

---------------- old post content below ------------------

Some VR app developers said they need it desperately because they don’t want to convert fbx files to Unity3D format at runtime any more. They just want to load and display them directly without conversion.

Do you need a runtime FBX loader? Why? And for what platform?

I’m thinking of writing a plugin for this if it is really needed by many people. (I know there exist some runtime FBX importer. But it seems that they are not maintained, undocumented or buggy.)

For VR? That seems like a ridiculous choice. I can understand the point on a PC.

The main reason to load models at runtime without routing them through Unity is to allow mod support. I suppose it was only a matter of time before people start modding VR games.

1 Like

No. I could write one if I wanted, but I’d try to use some other format. Any other format, pretty much. FBX is quite messy, undocumented, and is tied to proprietary sdk (which is why runtime loader is buggy and unmaintained). Anything would be better than it, even Collada.

I’d probably go either with a custom format (based on json) or something like gltf. gltf had some interesting ideas in it, even though it is quite obviously heavily tied to OpenGL API.

Sometimes you cannot control the formats of 3D model files from your clients. They just insist on using FBX.

In that case I’d provide a separate conversion tool for the one and only format app supports.

Skyrim and fallout doesn’t use fbx for its models. That didn’t stop people from modding the game and creating custom meshes for it (aaand they reverse engineered the mesh format).


Also, keep in mind that to properly support fbx, you’ll need to use fbx sdk which will require native plugin written in C++. One fun thing about native plugins in unity is that while the game usually can survive C# exception being thrown, when native plugin goes down, it often takes the application with it.

So, definitely does not look like a good idea.

1 Like

Sure that’s fine, but why the runtime loading? Its a very specific edge case where runtime loading makes any sense.

Thank you, @neginfinity and @Kiwasi . Very helpful comments!

I’m just very familar with FBX SDK and want to make something useful based on it in case some people need that. Would you please give me some advice? I’m also thinking of making an editor plugin that can modify or create fbx files in Unity3D editor.

I believe for editing meshes from within the editor there’s already “Pro Core” suite of plugins (they are not my kind of thing, though). There are probably couple of FBX exporters on asset store as well. If you’re looking for money, you could try undercutting their prices by large factor. If you’re looking for helping people you could try releasing an mit/zlib licensed plugin on github/bitbucket, although since FBX sdk is not opensource, there will be some difficulties.

Personally, I’d be much more interested in a tool that can export files from blender into unity without using fbx (there are issues with coordinate space conversion). I could write that myself, if I had the time, that is.

Another issue you could look at is that standard unity fbx importer handles coordinate conversion by introducing rotations on some bones. That occasionally causes trouble.

That’s all I can think of without being asked a specific question.

1 Like

I can see reasons for other than VR to do runtime loading outside of pre-processing with Unity.

The difficulties though IMO wouldn’t be with mesh itself, but handling all the other useful things you can do with it pre-processed such as animators, material re-assignments, etc…

how would you handle that part of the workflow?

In all 3D software I know of there is a very useful feature that allows the skin to deform based on the angle of two bones. In 3D Max this feature is called joint angle deformers - and as the name implies when 2 bones bend from a set angle - to another set angle - the bones deform the mesh. This is great for things like bulging muscles and also great for correcting problem areas in the mesh (mostly arm pits and hips/pelvis area).
And to top this feature off - this handy and useful feature is built right into the skin modifier in 3D Max. There is no additional hooks, no additional meshes needed (like a morph/blend shape), no additional game objects or additional extra stuff needed for these joint angle deformers to work as expected. And lastly these awesome angle deformers have been around since Max version 5 or 6 = 2003 or 2004.

For some STUPID unknown illogical reason fbx rips this data out of (used by all engines) the skin data upon export from all 3D packages.

This would be a super awesome addition to fix in the fbx export process. I don’t know how this could be done.
I don’t know if you could create this or not but it is an extremely VERY helpful feature that would be great to have if we could get the support for it in fbx format.

A distant second request would be if Unity supported twist bones, especially for the forearms. It’s not really needed for any other bones in a humanoid setup, but could be useful for other rigs, like tentacles. I don’t think this is a fbx limitation - but is a limitation in Unitys humanoid rig setup.

What should be done when loading fbx at runtime is just contructing Unity3D object directly from data read from the FBX file.

As for the skin-mesh animation, to construct a SkinnedMeshRenderer and its animation (AnimationClip and AnimationCurve), we need:

  • the skinning info(weights of bones and related vertices) per skin-mesh
  • the transformation info(translation, rotation and even scaling) every frame per animation.

As for the material, yes, the work flow should be adjusted. The developer should use some standardized shaders that make the mesh has the same looking as they are in 3D modeling software like 3DSMax. It’s very easy to extract material info from FBX files. So construct a Material is easy as long as we think of a way to use properly standardized shaders.

Do you mean Morph Angle deformer by deforming based on the angle of two bones? It seems to be a rendering technology that not supported by FBX. I’m not familiar with that, but I can imagine the usage somehow.

Morph Angle deformer


Bending the arm without the Morph Angle deformer causes the sleeve to crumple.


Using the Morph Angle deformer creates a smooth bend in the sleeve.

I also found some posts about this:
https://feedback.unity3d.com/suggestions/bone-driven-morphs
http://answers.unity3d.com/questions/874461/does-morph-angle-deformer-in-skin-modifier-of-3ds.html
https://forum.unity3d.com/threads/3dsmax-fbx-import-morph-angle-deformer.130963/

Unity3D just doesn’t support this feature. But I think it can be implemented in Unity3D with some special shader and runtime scripts just like how Unity3D implements their SkinnedMeshRenderer. As of FBX, it is just a file with data created by FBX exporters of 3D modeling softwares.

To achieve that, we have to write some tools first. First, write a exporter for 3D modeling softwares that can export customized data file (or customized FBX or the Unity3D asset file) contatining the morph angle data. Then write a importer for Unity3D to read the morph angle data file (or customized FBX using a customized FBX importer-not the offical one-or the asset file directly). Finally load the data into the runtime scripts, send them to GPU and render them and the mesh with some deforming shaders.

The big problem is the runtime script. I really worry about whether one can have enough access to GPU efficiently via Unity3D APIs.

Twist bones? Did you mean making the vertices between two joints deform along a curve (e.g. nurbs) from joint A to joint B, and so the bone from A to B was not straight but twisted?

Similar concept, but no - I’m talking about joint angle deformers, which is basically the same, but they are different. The joint angle deformer is (imo) simpler and could be included in the fbx file without any extra file size.
The info you linked to is built into the skin modifier as well, but that info is directly related to another modifier which morphs the skin based on bone angle. This is essentially the same concept, but the only two modifiers that are export/import supported through fbx is skin and morphs (blend shapes) so that process would not work.
Anyway - just a suggestion.

No - twist bones are bones between two joints (wrist and elbow) that increment there rotation based on the lower bones full rotation. So if 2 twist bones were used and the wrist bone rotated 60 degrees, the upper wrist bone would rotate 20 degrees and the second bone would rotate 40 degrees. This gives great falloff of the skin to deform properly around the axis point down the main bone, without the skin collapsing upon itself - if no twist bones are used.
An experienced rigger/skinner/animator can make the skin behave as it is supposed to - but the process is iterative, more time consuming and isn’t as easy as skinning verts to the twist bones and good to go.

Since you are discussing more run-time concepts these enhancements to the fbx export/import process really isn’t relevant. Though improving the base fbx export/import support I would argue is more important and would be more beneficial to the community.

Oh… that seems too much for me because as a programmer I don’t have any experience in creating skin-mesh animation.

I’ll make some small FBX editor plugin first. For example, a node renamer of FBX hierchary or node transformation adjuster inside the Unity3D editor.

Bumping an old thread, but I wanted to comment that as an AR developer having users be able to display their self made or other custom 3D models with their phones would be very useful. Unity is useful and easy for AR, but not being able to download and display .fbx files in runtime restricts use cases.

Current Asset Store solutions seem buggy, undocumented and not updated often which is a shame because, if there was a proper runtime importer, we would surely buy it and I believe many other AR and VR developers would find it very useful.

2 Likes

@TeroKuparinen The main obstacle of runtime fbx loading is that FBX is a proprietary file format and can only correctly read by FBX SDK.

Let’s have a look at what kind of platforms does FBK SDK support:

  • Windows
  • Windows Store and Windows Universal App Platform
  • Mac
  • iOS
  • Linux

Do them contain the AR platform you are using?

1 Like

Some use glTF now for streaming (is designed for it), open spec, and there’s a FBX to glTF converter that has worked well for us so far with some pretty simple buildings in city models. Is a commandline tool so you could maybe run it as a part of your AR solution somehow.

https://github.com/cyrillef/FBX-glTF

Apparently there is active work on a Unity glTF runtime loader now too,
https://github.com/KhronosGroup/UnityGLTF

1 Like

@zwcloud i notice this thread has been going on for a while… so have you written this asset yet? where can i grab a beta?

p.s. fbx importer for Unity WebGL would be great! :slight_smile:

especially if it supports blend shapes (SkinnedMeshRenderer)!

Thanks for your attention. But as what I have replied before, that’s impossible because FBX SDK doesn’t support WebGL. Fbx is not designed for runtime loading. It is just an interchange format between 3d modeling softwares.

Port fbx parser to WebGL?

Also, skinned mesh renderer? (particularly blend shapes)