AutoAvatarFixer is a Blender script that automatically fixes 3D avatars from Character Creator 4 that have been rigged with Mixamo.
The objective for this script is to standardize 3D avatars obtained from multiple sources. Our use case has been avatars from the software Character Creator 4 (CC4) however it works for other sources too.
This is why there are two different scripts:
- CC4_script.py - Intended for CC4 avatars.
- General_script.py - A more general script that needs to be manually filled with additional information at the beginning of the script.
For the general script The idea is to load an avatar after applying the Mixamo rigging and run the script.
The CC4_script needs the Mixamo rigged avatar loaded first in the blender scene and after the original avatar that was exported from CC4 as it uses the original hands rig for the final version.
Here's an outline of all the process that this script does:
This script is divided into various steps,
-
Fix and Merge Armature:
- Applies transforms to all objects in the scene and sets all objects to visible.
- Transfers shape keys from one armature to another, and removes meshes from armature_CC4.
-
Armature Cleanup:
- Delete hands bones on the mixamo armature.
- Delete all bones but the hand ones on the cc4 armature.
-
Skeleton Join:
- Joins two armatures, armature_CC4 and armature_mixamo, and parents hands bones.
-
Add Fingers & Rename:
- Renames specific bones.
- Modifies the armature and creates additional bones for fingers (end sites).
-
Correct Materials:
- Updates materials to ensure they have the correct textures, shaders, and naming.
-
Rigging:
- Copies the body mesh, merges its vertices, and applies automatic rigging to it.
- Transfers weights between the copied body and other objects (clothing).
- Merges vertices of all objects.
-
Reduce Blendshapes:
- Removes shape keys (blendshapes) from objects, except for face-related shape keys.
- Separates parts of the mesh based on materials and renames the objects.
-
Eye Bones & Rename Armature:
- Renames bones in the armature and creates eye bones.
- Assigns vertex groups for the eyes and positions the eye bones.
-
Fix Skeleton Position:
- Aligns the arms positions to point at the desired vector (1,0,0).
Finally, as this is a script to help obtain a well-configurated avatar for our applications, here's an example pipeline to be followed from obtaining an avatar to fixing it:
We rely on the software Character Creator 4 to generate a good quality avatar but you can use avatar from other sources using the general script. Here are the steps to follow:
-
Generate Avatar in Character Creator 4:
- Create a high-quality avatar in Character Creator 4.
- Export the avatar as a
.fbx
file.
-
Prepare Avatar in Blender:
- Load the
.fbx
file into Blender. - Delete the armature and any useless information.
- Ensure that the blendshapes are preserved.
- Export the model again as a
.fbx
file. - Leave the Blender project open for later use.
- Load the
-
Auto-Rigging in Mixamo:
- Import the
.fbx
file into the Mixamo website. - Perform the Auto-Rigging process.
- Download the rigged character from Mixamo.
- Import the
-
Run AutoAvatarFixer Script:
- Load the rigged character back into Blender.
- Run the appropriate script (
CC4_script.py
orGeneral_script.py
) to fix the avatar.
Here's a diagram of the process: