Monday 12 May 2014

Blender to Mixamo to Blender to Unity

As with all 3D modelling one of the biggest problems is transferring models between applications and still retain all the details.

The following is what works for me to get a mesh modeled in Blender 2.70a in to Mixamo to create the rig and then back in to Blender and on in to Unity 4.3 still in a state to animate.

You may not need to get your model back in to Blender but I need to add some simple animations not available from Mixamo yet.

Blender to Mixamo

Export from Blender using the FBX exporter that ships with Blender 2.70a.

You only need the mesh but the settings matter little.  Mixamo appears to sort out most things.  I used the defaults of -Z Forward and +Y Up.  I do change the Path Mode to 'Strip Path' so the FBX expects the texture file in the same folder as the FBX file.

Compress the FBX file and the texture file in to a zip file and upload just that Zip file in to the Rig upload of Mixamo.

It took me several variations of file types before I worked out the above that worked.  Even the zip file was a problem.  For some reason a zip file created with 7zip did not work but a zip created with WinRar did.

Once in Mixamo the Auto-Rigging worked very well.  Mixamo does a much better job of weight painting than I can manage.

The next trouble was exporting in a format that I could read back in to Blender.

Mixamo To Blender

I found the standard Collada worked with Blender 2.70a, not the version for use with the older version of Blender.

I added the T-pose animation and downloaded it as a zipped Collada file.

I then imported that in to Blender using the Collada (Default) importer shipped with version 2.70a of Blender.

I never understand why most importers change the scale to 0.01.

I simply change the scale for all three axes back to 1.0 and the model and the armature are as I expect.

I downloaded a version with an Idle animation and that worked as well.

Blender to Unity

Blender to Unity poses few problems.  Export to FBX and drag in to Unity.

Again I use the standard settings in Blender, I only include the Armature and Mesh and change the Path Mode to 'Strip Path'.

In Unity, drag the FBX file exported from Blender in to a folder in Unity.

The model imports face down but the armature and animation will make the model face the correct way up without having to rotate the imported mesh.

Like other importers Unity also imports at a scale of 0.01 so it needs to be changed to a scale of 1.0.

If necessary drag the texture in and create a material using that then drag the material in to the mesh renderer for the model.

Prepare to Animate

To use any of the animations it will be necessary to configure the Avatar Rig in Unity.

Select the model and press the Rig button.

Change the animation type to Humanoid and press Apply.

The chances are it will work it all out itself but if necessary you can press the configure button.

At this point you should be able to use Mecanim animations on the imported model.  Job done.

No comments: