Wednesday, December 15, 2021

Custom JCMs and Adjusters

Recently some problems with loading custom JCMs (Joint Corrective Morphs) were reported. It turned out that the code contained a hack to avoid problems with reloading JCMs, and that piece of code didn't work well. The problem should be resolved in the latest development version, but looking into this made me better understand how custom JCMs work and how they are related to the corresponding FBMs (Full Body Morphs).

First we import Aiko into Blender with Mesh Fitting set to DBZ File.

Import the standard JCMs (Import JCMs button) and bend the left elbow. The corrective shapekeys are driven by the bone rotation as expected. However, these shapekeys where made for the basic Genesis 8 Female, and we get better deformation if we import the JCMs that were designed specifically for Aiko.
For this we use the Import Custom Morphs tool. In the file selector, use "pjcm" as the filter to limit the selection to the JCMs (more precisely to the pJCMs, eJCMs are not imported), and import everything.
And we see that the Aiko-specific shapekeys are also driven by the bone rotations.

However, there is a catch. The final shapekey values are multiplied with the strength of the Aiko FBM (Full Body Morph). If the Aiko FBM is not imported, which it wasn't since we only imported the pJCMs, behind the scenes the FBM strength is set to 1, and everything is fine. But let's see what happens if we import the Aiko morphs.

So we import the Aiko FBM and FHM, and suddenly the Aiko corrective shapekeys are set to zero.
What happens was that by importing the Aiko FBM, we created a new property that multiplies the strength of the JCMs, and since that property was set to zero, the JCMs are zero too.
So if Aiko 8 Body = 0, the left forearm JCMs are zero too, even if the elbow is bent.
If we set Aiko 8 Body = 1, the non-zero JCM values reappear.
Alas, we can not set the Aiko FBM and FHM to one, because the Aiko morphs were already baked into the mesh when it was loaded with Mesh Fitting set to DBZ File, and thus the Aiko morphs are applied twice.

The way to decouple the JCM strength from the FBM strength is to use adjusters. Let us go back and import the Aiko JCMs again, but this time we enable the Use Adjusters option.
Now a new slider called Adjust Custom/aiko appears at the to of the aiko category. This property replaces the FBM value as a JCM multiplier. So if Adjust Custom/aiko = 1.0, the Aiko JCMs have the right values even if the Aiko FBM = 0.
If we reduce the value of the adjuster, the morph values are reduced accordingly. This can be used if you have mixed character. If you create a character which is 30% Aiko and 70% Victoria, say, you can import both the Aiko and Victoria custom JCMs, and set Adjust Custom/aiko = 0.3 and Adjust Custom/victoria = 0.7, to get the JCM mix which is right for that character.