Skip to content

Using customTRS to adapt animations from one character to another

eArmada8 edited this page Feb 22, 2024 · 3 revisions

Using customTRS to adapt animations from one character to another

Using ED8Inject, it is possible to replace one character with another without too much effort. However, sometimes animation incompatibilities really ruin the effect, especially if the skeletons differ significantly between characters. For example, in a rather extreme character replacement, here I have attempted to replace Randy with Nadia.

As you can see, some of Randy's animations involve bone stretching, and that effect does not look good when applied to Nadia as her body size is completely different.

Using a custom version of my merge animation script, we can attempt to remove node translation / scaling from the animations, allowing only for joint rotations. While this would never pass for a professional animator's work, it does allow for rapid automatic repair of animations.

Left, applying Randy's original animation to Nadia's model. Right, Randy's animation after filtering through customTRS.

Preparing the animations for customTRS

Grab my customTRS_ani_model_merge.py script. (Right click, Save As)

The first steps are the same as the steps for importing animations into Blender. Grab all the animation .pkgs that you plan to convert. Here I have all of Randy's .pkg files (from CS4 where I am doing this mod) except his face animations.

Instead of adapting C_CHR042_FC1.pkg, I will simply replace it with Nadia's facial expressions (C_CHR111_FC1.pkg) as described in my ED8Inject tutorial. In total, I used ED8 Inject to replace C_CHR042.pkg with C_CHR111.pkg {including automatic shader replacement}, C_CHR042_FC1.pkg with C_CHR111_FC1.pkg, and FC_CHR042.pkg with FC_CHR111.pkg.

A list of Randy's animations from CS4:

C_CHR042_BT1.pkg - Battle animations
C_CHR042_BT3.pkg - More battle animations
C_CHR042_DF1.pkg - Basic animations (Idle stance, walk, run, etc)
C_CHR042_EV.pkg  - Cut scene / event animations
C_CHR042_FC1.pkg - Facial expressions
C_CHR042_HS1.pkg - Riding horses, bikes, etc
C_CHR042_SC1.pkg - S-craft animations (including camera angles)

I will also need Nadia's character model, since I am going to adapt Randy's animations to Nadia's model.

C_CHR111.pkg - Nadia's base model, in her default costume

Run ed8pkg2gltf.py on all of them.

From this point on, I am going to work on animation pkg files one at a time. I started with C_CHR042_DF1.pkg, which are the basic animations. The screenshots show me working on C_CHR042_BT1.pkg, but only because I forgot to take screenshots of C_CHR042_DF1. I always recommend starting with basic animations. From this point on, when I refer to the work folder, I am referring to the folder with all the .glb files from C_CHR042_DF1.

NOTE: customTRS, just like the merge animation script, changes the animation .glb files. Nadia's model will remain unchanged.

I want to merge Nadia's model into Randy's animations, but my script expects the model to be named chr042.glb since the animations are all chr042_xxxxxx.glb. So rename chr111.glb to chr042.glb. Put a copy of chr042.glb inside the work folder (C_CHR042_DF1).

Setting your settings customTRS

Put customTRS_ani_model_merge.py in the work folder (C_CHR042_DF1) along with your renamed chr042.glb and all the files you need to recompile (build_collada.py etc). Open customTRS_ani_model_merge.py up in Notepad or another python editor (e.g. Notepad++, VS Code, etc). The default settings makes the script identical to merge_model_into_animations.py - we need to set customTRS_ani_model_merge.py up to be custom.

I find a sane place to start experimenting is to set preserve_translation and preserve_scale to True, and to leave everything else alone.

# Set to True to prevent overwriting the model bind pose with the animation pose
preserve_translation = True
preserve_rotation = False
preserve_scale = True
# If True, locators will be transformed regardless of above.  Nodes in always_transform_nodes will always be applied. 
always_transform_locators = True
always_transform_nodes = ['up_point']

Run customTRS_ani_model_merge.py (preferably from the command line so you can see error messages).

Just like importing animations into Blender, expect to see the file size jump as Nadia's model gets merged into each animation.

Recompile the animation files by running build_collada.py and RunMe.bat as usual. You should now have a new C_CHR042_DF1.pkg.

Test your new C_CHR042_DF1.pkg animations in the game. If you are lucky, you will be able to immediately enjoy your new animations!

Adjusting customTRS

You may need to experiment to find good settings for your character. I ended up needing to also set always_transform_locators to False to get a good result with Nadia as Randy, because Randy's weapons would always be in the wrong place without that setting.

Once you are happy with your settings, repeat the same process for all your other animation .pkg files. I repeated the process with my finalized settings on C_CHR042_BT1.pkg, C_CHR042_BT3.pkg, C_CHR042_EV.pkg, C_CHR042_HS1.pkg, and C_CHR042_SC1.pkg. Remember, for C_CHR042_FC1.pkg, I just used the injection method.

Enjoy your mod!