Moho to FBX to Unity

General Moho topics.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
solidgoldrobot
Posts: 3
Joined: Tue Aug 22, 2017 9:41 pm

Moho to FBX to Unity

Post by solidgoldrobot »

I've been trying to develop a pipeline for running extended sequences of complex 2D animation in Unity. I thought Moho's FBX export was gonna be the answer, but it's not quite there yet.

I LOVE Moho... but the FBX feature (which is probably not used by most people) just needs some work before it's ready for primetime, I think.

I thought I would document my findings here in case it's helpful to anyone else. If anyone knows a solution to the limitations I'm running into, feel free to chime in!

Things to know in Moho:
  • You might want to animate at 30fps. Unity always assumes 30fps no matter what. So that will make it easier for you to keep track of start and end points.
  • Buggy: Use "FBX Preview Mode" under the View menu. It's not very accurate, but it helps
  • Bug: Layer transform animation doesn't export to FBX. Only bone animation. (not disabled in FBX Preview Mode)
  • Bug: Bone scaling doesn't export to FBX. (does get disabled in FBX Preview Mode)
  • Bug?: Bone offset doesn't export to FBX, which eliminates a very useful rigging approach. (not disabled in FBX Preview Mode)
  • Bug: Animation created using smart bones and their actions doesn't export to FBX (not disabled in FBX Preview Mode)
  • Bug: Masking doesn't seem to export to FBX (I thought I had this working, but it doesn't seem to work now)
  • Bug: Bitmaps generate 2,700 polys each in your FBX, regardless of size. I know SmithMicro's working on this. But avoid for now.
  • Layers that aren't bound to a bone will come into Unity as a Mesh instead of a Skinned Mesh (not desirable in my opinion; see below)
  • Buggy: I've found that Moho's easing doesn't carry over to FBX / Unity accurately. "Linear" seems the safest bet, but not a great option for most animation. Moho's easing is probably my chief complaint about the software. It doesn't use the same paradigms or interface that every other animation software I've ever used does (After Effects, Flash/Animate, Harmony, Blender, Unity, etc.)
Things to know in Unity:
  • Moho comes with a script (at least I think it does) that does a little setup of your FBX in Unity "AnimeStudioFBXImporter.cs". It relies on the order in which materials occur to determine the order in which elements get rendered. So if / when you combine all of your animation's materials into an atlas, the sort order is lost and things are drawn in arbitrary order. Fix this by changing line ~75 from "r.sharedMaterial.renderQueue = renderOrder;" to this: "r.sortingOrder = renderOrder;". This will use Unity's built in sorting.
  • Depending on your target platform, your Unity project may default to a low "bone quality" when importing FBX. For your FBX animation to resemble what you saw in Moho, you'll want to use a quality setting of at least "2 bones" possibly "4 bones". You can change this under your Project Settings, on a case-by-case basis per skinned mesh, or you can add it into that same importer script ^ like so "r.quality = UnityEngine.SkinQuality.Bone2;". I added that around line 65.
  • By default, every mesh from your Moho FBX will have its own material, creating its own draw call. You might want to combine them to improve performance.
    One of the (many) versions of this script might be helpful: https://forum.unity.com/threads/script- ... es.123649/ This only works on Skinned Meshes, so, might be nice if that's all Moho's FBXs used (not sure if that determination is made by Moho or Unity).
If easing, masking and smart bone actions were solved, I think I'd be able to start using Moho in the kind of pipeline I need. However, it can work fine as-is for simple animations.

I hope that in the future Moho will include an FBX Export dialog with options (for global scale and orientation, to atlas materials, set level of mesh complexity, etc.).

Anyway. Maybe this will be useful to someone, and I'd be happy to hear solutions if anybody knows of them!
Post Reply