How to: Maya -> Unity - mesh skinning info, no bones?

I have a multiple meshes in Maya skinned to a character’s joint hierarchy, and I want to export those individual meshes with their skinning information and without the bones. The idea is that we can load up at runtime a number of different meshes which we can fit onto the single skeleton.

Whenever we export a component of the mesh, and load it up, it’s importing it as a non skinned Mesh, presumably because we’re not doing something quite right at export. I can export the whole model and it’s as it should be, with a bone structure, and then individual components that are imported with Skinned Mesh Renderer on them, but I want to separately export and import these. Is this possible?

afaik I have all the right maya export settings, skinning being the main one, using .FBX.

Curious if this can be achieved, waiting to see how others respond. Speaking of which, can the ‘Copy From Other Avatar’ option when importing an FBX meet the requirements?

I was playing around with the avatar but didn’t have any luck, I’d need to dig into it a bit to really figure out what is going on there. I don’t think it would though, I think it’s more about joint remapping for mecanim.

So far I’m just exporting the parts with the entire skeleton, and then throwing the bones away when I attach the part. Seem to work well enough, and the main thing I wanted was an additive workflow so I didn’t have to export the character each time I add a new piece of gear. It’s almost what I want, there’s just a bit of extra stuff to discard. Main downside I guess is each piece of gear is like 80kb instead of 3kb. Not much to gripe about I guess.

Still curious if this is possible, if anyone has any ideas? I’m not sure where exactly the skin weights are stored. I thought they were in the verts. Does anyone know where I can read about the relationship between them and the bone hierarchy in the fbx? Does unity delete them in the optimization process if there’s no bones?

This thread is marked as 2D, but your question seem to be more related to 3D.

As far as I know it’s not possible to remove the skeleton using import settings. If the Rig import setttings are set to None, the weight informations are not imported.

If you are comfortable writing some C# scripts, you should be able to use the AssetPostprocessor.OnPostprocessModel to achieve the desired effect. Maybe something like this:

using UnityEngine;
using UnityEditor;

public class SkeletonRemover : AssetPostprocessor
{
    void OnPostprocessModel(GameObject fbxModel)
    {
        if (assetPath.EndsWith(".fbx") && assetPath.Contains("path-to-your-fbx-folder"))
        {
            var skeletonRoot = fbxModel.transform.Find("Your Skeleton Root Bone Name");
            if(skeletonRoot == null)
                return;

            Object.DestroyImmediate(skeletonRoot);

            var skinnedMeshes = fbxModel.GetComponentsInChildren<SkinnedMeshRenderer>();
            foreach (var skinnedMesh in skinnedMeshes)
            {
                skinnedMesh.bones = null;
                skinnedMesh.rootBone = null;
            }
        }
    }
}


1 Like