Showing posts with label FBX. Show all posts
Showing posts with label FBX. Show all posts

Thursday, September 2, 2010

Exporting Simple Skeleton and Mesh data via FBX in Maya

Its something that you think should be really easy, taking your animated rig data and spitting out an nice clean fbx containing just the animated skeleton and mesh data, but in practice Fbx is such a beast it needs a little pre-setup to achieve. What you need to do is to first select the nodes you want to output. FBX has no concept of what it should, or shouldn't output, so use the export selected option from Maya.

If like most rigs you have a master bind skeleton, select it's root, then run something like this to select any joint and mesh data under it, you may need to shift select your skin, the key is to get what you want selected and nothing else:

import maya.cmds as cmds
meshes=[]
joints=cmds.ls(sl=True)

#find all joints
joints.extend(cmds.listRelatives(type='joint',allDescendents=True))

#find your Skinned Geo
for skin in cmds.listConnections(joints,type='skinCluster'):
    if skin:
        shape=cmds.skinCluster(skin,query=True,geometry=True)
        meshTransform=cmds.listRelatives(shape,parent=True)[0]
        if meshTransform not in meshes:
            meshes.append(meshTransform)

cmds.select(joints,meshes)

Right, now you have the nodes you actually want to go through for export. I should point out here that this only works from Maya2010 onwards, there was an FBX bug in older versions of the export selected.

Here's the key, in the FBX output options (use fbs not fbx_dae) you need to go to the Animation Options block and make sure that these 2 flags are set.

Bake-Animations = ON, InputConnections= OFF




That's it. You should end up with a nice clean fbx with JUST the data you wanted in it.

Friday, August 13, 2010

FBX Update Issues with Merge

Just thought I'd share an issue that's cropped up with the latest versions of the FBX plugins, from v2011.2 onwards.

In previous versions if you did an import and had the include set to 'Update scene elements' it would import onto nodes using a shortName match so that the path didn't get taken into account. This is NO LONGER the case, it now uses a full DAG path match.

Our main MoCap pipeline relies on the fact the we have data coming from MotionBuilder as such:

FBX_DATA_GameRoot
....>FBX_DATA_Root
........>FBX_DATA_Spine

But on our Maya binders we parent this hierarchy as we may need to scale the nodes to get a better remapping fit, so in Maya it looks like

ADJUSTER
....>FBX_DATA_GameRoot
........>FBX_DATA_Root
............>FBX_DATA_Spine

Now this has always worked, and it's been very successful, the animators just throw the fbx into the scene and they get a bound rig. But because it's now using a full dag path match the fbx will no longer bring any data in unless the entire paths match.

This is something that the FBX guys know about and hopefully will be resolved/roll-back to it's previous functionality soon.



UPDATE:
As of FBX version FBX 2011.3.1. the guys at Autodesk rolled the behaviour of this back to it's original, so nodes are updated based on node name NOT full Dag path. Thanks to Trevor Adams in the FBX team for this one.