Thursday, April 22, 2021

Importing an Animation Back into DAZ Studio

Update 2021-04-23: 

This method is obsolete. The new way to get an animation from Blender to DAZ Studio is to save it as a pose preset, see https://diffeomorphic.blogspot.com/2021/04/save-pose-preset.html.
 

Original post:

There was a request to import an animation made in Blender back into DAZ Studio. This turned out to be quite difficult, but I came up with a method that works, at least in some cases. However, there are glitches, which may be due to bugs to my code, or to imperfections in Blender's BVH exporter or in DAZ Studio's BVH importer, or some incompatible settings.
Import a DAZ character into Blender and animate her. Before exporting the animation, we need to create a modified action with the new tool Unflip Action, which is found near the bottom of the Pose panel.
The tool options lets us specify the start and end frames. By default both equal one, which corresponds to exporting a single pose. In this case we change the end frame to 250 to export the entire animation. A new, "unflipped", action is created, but nothing has happened to our character. The unflipped action is not meant for her.
 
We need to import the character again, but first we must change some global settings. Set
  • Unit Scale = 1.0
  • Z Up = off
  • Orientation = DAZ Unflipped
These are debug settings which we normally would not use for something that is to be used in Blender. However, in this case we want an armature with the same size and orientation as in DAZ Studio.
Here we have imported Aiko again with the new settings. Note that the new character is 100 times bigger than the original one (the units are centimeters, not meters), that the Y axis points up and the Z axis points forward, and that the bone orientations are weird. This is how the bones are oriented in DAZ Studio, which unlike Blender does not demand that the bones are directed along the local Y axis.
We now open the Action editor. The Unflip Action tool created a new action, whose name ends with "_Unflipped". Select it.
The unflipped rig now has a version of the animation that works for it.
Export the animation as a BVH file (File menu > Export > Motion Capture (.bvh)).
In DAZ Studio, import the BVH file.
And now the animation has been transferred to DAZ Studio.

There are a number of issues with the animation in DAZ Studio. E.g., in Blender Aiko is turning around several times, but in DAZ Studio she is stuck after making half a turn. It seems like the hip bone can not be rotated more than 180 degrees, at least if we use the default settings.