Thursday, October 10, 2024

Diffeomorphic Add-Ons version 4.2.1 Released

It is time for a new stable release of the DAZ Importer and the other Diffeomorphic add-ons. The main novelty is that the add-ons have been converted to Blender extensions in Blender 4.2, cf the posts on Blender Extensions and GPL and Addon Scripting and Blender Extensions. The add-ons can also be installed in earlier versions of Blender. As usual, several bugs have also been fixed.

The DAZ Studio export script (export_to_blender.dsa) has also been updated and should be copied to the Scripts folder in a DAZ Studio directory. The specialized HD export script (export_highdef_to_blender.dsa) has been merged with the main export script and is now obsolete. Old versions of the script still work in most situations.

DAZ Importer

The DAZ Importer is a Blender add-on for importing native DAZ Studio files (.duf, .dsf) into Blender. It also contains some tools to make the assets more animation friendly.
Download:
https://www.dropbox.com/scl/fi/hka5ej1dv65gk04p1pn5x/import_daz-4.2.1.zip?rlkey=9ukju1y5zai4pryp5atblcbe9
Documentation:
https://bitbucket.org/Diffeomorphic/import_daz/wiki/Home

MHX Runtime System

The MHX Runtime System is a Blender add-on for posing the MHX rig, that can be generated by the DAZ Importer.
Download:
https://www.dropbox.com/scl/fi/ry8nwojh62s3y23w4g5bp/mhx_rts-4.2.1.zip?rlkey=mx0worrq46afetxumvmo8yhg8
Documentation:
https://bitbucket.org/Diffeomorphic/mhx_rts/wiki/Home

BVH and FBX Retargeter

The purpose of the BVH and FBX Retargeter is loading animations from BVH or FBX files to a given armature, and editing these animations in various useful ways. It can also import facial animations in FaceCap, LiveLink, VMD and FBX formats.
Download:
https://www.dropbox.com/scl/fi/qh6czqobslto9q0ea6kh6/retarget_bvh-4.2.1.zip?rlkey=g9xpumgp6xzh94frzromb8psy
Documentation:
https://bitbucket.org/Diffeomorphic/retarget_bvh/wiki/Home


The next two add-ons were recently spawned from the DAZ Importer in order to keep down its size somewhat. They contain rather specialized tools that are probably not of interest to most users. They are also poorly documented and result in warnings about policy errors. The the previous release there was a third add-on for exporting pose presets back to DAZ Studio, but that has been merged with the main DAZ Importer add-on again.

Important: The DAZ Importer must be enabled first, before any of these two add-ons can be used.

DAZ Rigging

Some specialized tools for rigging certain types of figures, link chains and tails.
Download:
https://www.dropbox.com/scl/fi/xqgb698891hlwqr3bon7z/rig_daz-4.2.1.zip?rlkey=k5mhdxlwi7civx5uzrozk6svz
Documentation:
https://bitbucket.org/Diffeomorphic/rig_daz/wiki/Home

Shell Editor

Contains some tools for manipulating shells imported from DAZ Studio.Download:
https://www.dropbox.com/scl/fi/bqh6cu4o33jdpwr4nspct/shell_edit-4.2.1.zip?rlkey=09ls8m6em95dicc4kvk54r000
Documentation:
https://bitbucket.org/Diffeomorphic/shell_edit/wiki/Home

Wednesday, October 2, 2024

Addon Scripting and Blender Extensions

As mentioned in the previous post on Blender Extensions and GPL, the DAZ Importer is now a Blender extension under Blender 4.2. It still works as a legacy addon in earlier Blender versions. This poses some challenges when using the addon in scripts. Here is an example.

import bpy
import import_daz

relpath = "/scenes/aiko-basic-wear.duf"
abspaths = import_daz.get_absolute_paths([relpath])
import_daz.set_selection(abspaths)
bpy.ops.daz.easy_import_daz(
   useExpressions = True,
   useJcms = True,
   clothesColor = (0,0,1,1.000),
   useTransferClothes = True,
   useMakePosable = True,
)
print("Loaded %s" % import_daz.get_selection())


This script loads a scene with Aiko dressed in Basic wear. The scene is located in the scenes directory under one of the DAZ root paths. The corresponding absolute path depends on the root paths specified in the global settings, and we use the import_daz.get_absolute_paths() function to retrieve it. Since a relative path may correspond to multiple absolute paths, this function returns a list.

Easy import is done with the bpy.ops.daz.easy_import_daz() operator, but we have to tell it which files to import first. This is done with the import_daz.set_selection() function, which should be called before any operator that acts on a list of strings.

The script above works fine in Blender 4.1 and earlier versions of Blender (some keyword argument may be different in very old addon versions), but in Blender 4.2 it causes an error:

ModuleNotFoundError: No module named 'import_daz'

The culprit is the line

import import_daz

which doesn't work because the import_daz module is not in the Python path anymore. To resolve this, we first notice that the entire DAZ Importer API is located in the import_daz.api submodule, which can be imported into the script with the line

from bl_ext.user_default.import_daz import api

Since we have imported the api module rather than the import_daz one, all function calls must change. E.g.,

abspaths = import_daz.get_absolute_paths([relpath])

is replaced by

abspaths = api.get_absolute_paths([relpath])


With these modifications, the full script becomes

import bpy
from bl_ext.user_default.import_daz import api

relpath = "/scenes/aiko-basic-wear.duf"
abspaths = api.get_absolute_paths([relpath])
api.set_selection(abspaths)
bpy.ops.daz.easy_import_daz(
   useExpressions = True,
   useJcms = True,
   clothesColor = (0,0,1,1.000),
   useTransferClothes = True,
   useMakePosable = True,
)
print("Loaded %s" % api.get_selection())

The new script works fine in Blender 4.2, but now we get an error when running the script in Blender 4.1.

ModuleNotFoundError: No module named 'bl_ext.user_default'; 'bl_ext' is not a package

To make the script work both in Blender 4.2 and earlier Blender versions, we can replace the code at the top with

try:
    from import_daz import api
except ModuleNotFoundError:
    from bl_ext.user_default.import_daz import api





Saturday, August 17, 2024

Blender Extensions and GPL

In Blender 4.2 a new feature was introduced: Blender Extensions. The Blender Extensions platform is the online directory of free and Open Source extensions for Blender. The goal of this platform is to make it easy for Blender users to find and share their add-ons and themes, entirely within the Free and Open Source spirit. 

DAZ Importer version 4.1.0 is a legacy add-on, but the next release will be an extension, which I eventually hope to upload to the Blender extensions site. As a first step the Diffeomorphic add-ons have now been converted to extensions in the development version.

Download the development versions of the DAZ Importer and the other Diffeomorphic scripts. We see that Bitbucket adds some extra stuff to the file names. Before installing the new add-ons, make sure that no old add-ons remains, following the instructions in Safely Installing a New Version .

In Blender 4.2, open the Blender preferences window and go to the Get Extensions tab. Press on the arrow at the top right and choose Install from Disk.
Navigate to the place where the downloaded files are saved, and install the import_daz zip file. The default settings work fine.
And the new extension is installed.

We can now repeat the procedure to install the remaining add-ons.
If we switch to the Add-ons tab we see that the extension appear here too.

The add-ons are installed in the Blender/4.2/extensions/user_default directory. This is the location of Blender extensions. Legacy add-ons, like previous versions of the DAZ Importer, would be placed in the Blender/4.2/scripts/addons folder. Make sure that the same add-on does not appear in both locations.

The Diffeomorphic add-ons are backwards compatible and the same files can be installed  on Blender 4.1. The main ones are even compatible all the way back to Blender 2.83, although some features may not work correctly. Let us review how to install the add-ons on Blender 4.1.

Here we go to the Add-ons tab and press the Install button.
Select the import_daz file and install it. It is not enabled by default, so we press the checkbox to the left.
However, when we repeat the same process with one of the dependent add-ons like the Shell Editor, the add-on can not be enabled. Instead there is an error message.
The reason is that this add-ons uses the DAZ Importer, which much be named import_daz. When we look in the addons directory, we see that the add-on is named like the zip file. With extensions this problem doesn't arise.

 

GNU Public License

The Blender Extensions platform only accepts GNU GPL compliant software. Previous versions o fthe Diffeomorphic add-ons were released under a FreeBSD license. Although BSD is GNU GPL compliant, GPL is preferred, and therefore I chose to change the licence of the Diffeomorphic add-ons to GPL, more precisely GNU General Public License v2.0 or later. This change should not affect the end user in any way.

Sunday, August 11, 2024

Single DBZ Export Script and the HD Convention

The dedicated HD export script has been removed from the Diffeomorphic scripts in the development version. Instead the ordinary Export To Blender script can handle both plain and HD export. It is in fact more powerful than before because the user can now decide which figures should be exported as HD meshes.

In the Diffeomorphic folder, the Export HD To Blender script is gone (you have to remove it manually, but it is not part of the import_daz repo anymore).
We are going to export the Victoria 9 HD figure with some clothes and hair. As is often the case for HD figures made for DAZ Studio, the name of the main figure ends with "HD". The full figure consists of several subfigures, and we notice that none of them have names that end with "HD".

Now double-click on the Export Blender icon, or select Export Blender from the File menu if you have run the Setup Menus script. After confirming the file path of the dbz file, we are prompted with another popup dialog with three options:

  • Export HD. If disabled, no HD data is saved in the dbz file, and the other two options have no effect. This corresponds to the behaviour of the old "Export Blender" script.
  • HD Convention. If Export HD is enabled, HD data is only exported for figures whose names end with the letter "HD", otherwise it is exported for all figures.
  • Export HD UVs. Export the UV map for HD meshes. This is the same option as in the old dedicated HD exporter.

When we now import the file in Blender, all meshes are imported at base resolution. The Victoria 9 HD mesh is renamed to "Victoria 9 Mesh".
Let us now export the DBZ file again, but this time we turn on the Export HD option, while leaving the HD Convention option disabled. Now HD data is exported for all figures. This is what the old "Export HD to Blender" script did.
When we import the file into Blender, two collections are created. The Victoria 9 collection contains all the base meshes, and the Victoria 9 HD collection contains the HD objects. They base and HD objects are different, except for the line meshes that lack faces.
We can see the difference between the base and HD meshes in the modifier tab. The base mesh typically has a subsurf modifier, whereas the HD mesh has a multires modifier.
Finally let us export the file with both Export HD and HD Convention enabled. The HD convention is that HD data is only exported for figures that end with the letters "HD". Many modern DAZ figures that have interesting HD data are already named thus.
The only figure in our scene that ends with "HD" is Victoria 9 HD. When imported into Blender, this is the only mesh which has a multires modifier. All the other meshes are imported at base resolution with subsurf modifiers.
We can use the HD convention to select which meshes that we want to export HD data for, and thus which meshes will have a multires modifier in Blender. Simply add a "HD" to the end of the figure name. Here we added "HD" to the eyes, bikini and bra.
In Blender there are again two collections. The base collection contains the base versions of the bikin, bra and eyes, and the HD collection contains the HD versions of the same meshes.
And if we look in the modifier tab, the HD meshes have a multires modifier instead of a subsurf modifier.

Friday, July 26, 2024

Diffeomorphic Add-Ons version 4.2.0 Released

 DAZ Importer version 4.1.0 did not work at all with Blender 4.2. The reason is that Blender 4.2 has a strong (or less weak) typing system, which causes almost every button in the DAZ Importer to crash. Therefore it is time for a new stable release of the DAZ Importer and the other Diffemorphic add-ons. The add-ons have been tested with Blender 4.1.0 and 4.2.0 and also briefly with Blender 2.83, and there is a good chance that they will work with intermediate Blender versions too.

Apart from making it possible to use the DAZ Importer in Blender 4.2 at all, there are also some other improvements:


The DAZ Studio export scripts (export_to_blender.dsa and export_highdef_to_blender.dsa) have also been updated and should be copied to the Scripts folder in a DAZ Studio directory. Old versions of the scripts still work in most situations, but the new versions are needed for the improvements of rigid followers and HD import.


DAZ Importer
The DAZ Importer is a Blender add-on for importing native DAZ Studio files (.duf, .dsf) into Blender. It also contains some tools to make the assets more animation friendly.
Download:
https://www.dropbox.com/scl/fi/5xh2xun51kn3c851y85ju/import_daz_v4_2_0.zip?rlkey=uapugueahv4otj7q07aliocyc
Documentation:
https://bitbucket.org/Diffeomorphic/import_daz/wiki/Home


MHX Runtime System

The MHX Runtime System is a Blender add-on for posing the MHX rig, that can be generated by the DAZ Importer.
Download:
https://www.dropbox.com/scl/fi/wi5x9m7phck8yxjme42tz/mhx_rts_v4_2_0.zip?rlkey=fy6dkyj04ueloygbvvemjb3ft
Documentation:
https://bitbucket.org/Diffeomorphic/mhx_rts/wiki/Home


BVH and FBX Retargeter
The purpose of the BVH and FBX Retargeter is loading animations from BVH or FBX files to a given armature, and editing these animations in various useful ways.
Download:
https://www.dropbox.com/scl/fi/5qvty2bnvp3x6bs6ido67/retarget_bvh_v4_2_0.zip?rlkey=lmk28nweryfkdzic0cnn54c82
Documentation:
https://bitbucket.org/Diffeomorphic/retarget_bvh/wiki/Home


The next three add-ons were recently spawned from the DAZ Importer in order to keep down its size somewhat. They contain rather specialized tools that are probably not of interest to most users. They are also poorly documented.

Important: The DAZ Importer must be enabled first, before any of these three add-ons can be used.

DAZ Preset Exporter
This add-on contains some tools for creating pose presets and other assets that can be used in DAZ Studio. It has not been updated for Blender 4.2.0.
Download:
https://www.dropbox.com/scl/fi/nfqjioymya3sofq71pcv4/export_daz_v4_1_0.zip?rlkey=4nujmfmir99dqf6sm7y0weyzi
Documentation:
https://bitbucket.org/Diffeomorphic/export_daz/wiki/Home


DAZ Rigging
Some specialized tools for rigging certain types of figures, link chains and tails.
Download:
https://www.dropbox.com/scl/fi/dbrvarajfb7173u7q0hfa/rig_daz_v4_2_0.zip?rlkey=ep0vif4h6pdxktvwm9n6sfras
Documentation:
https://bitbucket.org/Diffeomorphic/rig_daz/wiki/Home


Shell Editor
Contains some tools for manipulating shells imported from DAZ Studio.
Download:
https://www.dropbox.com/scl/fi/v08r48o9z2nswb57fpv0y/shell_edit_v4_2_0.zip?rlkey=boo9zmie3jei1rztsktefnj65
Documentation:
https://bitbucket.org/Diffeomorphic/shell_edit/wiki/Home



Tuesday, July 16, 2024

Hair Simulation

It is well known that it is not straightforward to simulate hair curves in Blender. Recently Alessandro pointed me to an interesting video where this problem is addressed:
The main idea is to create a proxy mesh which exactly matches the hair curve's vertex order and vertex locations. We can then add a cloth simulation to the proxy mesh, and a geometry node modifier to the hair curve that makes if follow the proxy. This is implemented in the development version 4.2.0.

Hair simulation does not work with the well-known Toulouse hair, because it contains connected sheets with two tips at the end and the root in the middle, and the Make Hair tool does not handle this case well.

Monica hair is better behaved, and only consists of sheets where the root and tip are at the ends. We imported a G8F character with Monica hair.

Monica hair consists of several parts with different materials. First we enter edit mode and separate the mesh by material.
We only keep the hair meshes which make a substantial contribution to the hair. The four meshes that consist of scattered small parts can be deleted. Also, the mesh with the cap material is renamed to "Scalp".
Next we convert each of the four remaining hair meshes to hair curves. With the hair mesh active and the scalp selected, press Make Hair.
The simulation options are found in the new Posing/Simulation box to the right of the Make Hair options. To make the video above I used something like the options above.
After converting all four hair meshes to hair curves, we end up with four hair curves and four proxy meshes, which have a red material in the viewport and are hidden during rendering. I like to put them in separate collections for clarity.

After that it is just a matter of animating the character.

The simulation will probably not be perfect at once. We can tweak the simulation parameters in the physics context as usual.

We can also easily modify the pinning group with Add Pinning Group.



Sunday, July 14, 2024

Improvements to HD Import

We can import HD (high-definition) characters if we first export the dbz file with the Export HD To Blender script, instead of using the plain Export To Blender script, cf High resolution meshesHD meshes and geografts, and HD meshes and geografts revisited. The imported character has usually a very high poly-count which slows down the viewport. We can usually convert a HD mesh into a low-poly mesh with a multires modifier, using the Rebuild Subdivisions tool in the modifier. If the multires mesh has the same topology as the base mesh, which is often the case, the import script can then copy UV layers and vertex groups from the base mesh, so the multires mesh is as responsive as the base mesh in the viewport, while rendering like the full HD mesh.

Unfortunately, there are some situations where this strategy doesn't work.

  1. Rebuilding subdivisions may fail. We are then left with the full HD mesh, which can not be posed. It can still be rendered if UV coordinates are included in the exported dbz file.
  2. Rebuilding subdivisions may succeed, but the topology of the multires mesh may differ from that of the base mesh. Then we still cannot copy vertex groups and UV layers from the base mesh. An example is the persian top for Genesis 2 females that is bundled with DAZ Studio. In that case the culprit are triangular faces in the beads.
  3. The character may have geografts. Then the suggestion in HD meshes and geografts revisited was to enter the geometry editor in DAZ Studio before exporting the dbz file. However, if we do so all shells and shell UV layers are lost, which are often quite significant for geografts.

Recently these problems have been overcome. First, the Export HD To Blender script has to be updated, because information about shell UV layers are now included among the exported data. This means that you must use the Dazscript version rather than the C version by Donald Dade, which is not updated. Second, scenes should be exported from DAZ Studio without going into the geometry editor. This means that all geografts are automatically merged with their base characters already in the dbz file. When the file is imported into Blender, materials from both the base character and base geografts are added to the HD mesh, and UV layers from any shells are added too.

Information about the HD vertex groups is still missing. That could in principle have been added too, but exporting a HD dbz file is already very slow, and making it many times slower by adding 200 vertex groups is not feasible. Instead the plugin uses Blender's data transfer tool to transfer the vertex groups from the nearest base mesh vertex, instead of doing a vertex-by-vertex copy.

Friday, May 31, 2024

Diffeomorphic Add-ons Version 4.1.0 Released.

It is time for new stable releases. This time six separate add-ons are released at the same time, so you only need to download the add-ons that you actually need. As announced previously, the add-on version is now synced with Blender, so the latest version of Blender that these add-ons have been tested with is Blender 4.1.0. They have also briefly been tested in Blender 2.83, and there is a good chance that they will work with intermediate Blender versions too.


DAZ Importer
The DAZ Importer is a Blender add-on for importing native DAZ Studio files (.duf, .dsf) into Blender. It also contains some tools to make the assets more animation friendly.
Download:
https://www.dropbox.com/scl/fi/58f6obzmh063ae9d88ugg/import_daz_v4_1_0.zip?rlkey=qnq6cu0fx4qki9rpxlu95o9h1
Documentation:
https://bitbucket.org/Diffeomorphic/import_daz/wiki/Home


MHX Runtime System

The MHX Runtime System is a Blender add-on for posing the MHX rig, that can be generated by the DAZ Importer.
Download:
https://www.dropbox.com/scl/fi/869tqthaajnznk2vaka2f/mhx_rts_v4_1_0.zip?rlkey=94tfjkaiofzmkwm5ff2gs0m8t
Documentation:
https://bitbucket.org/Diffeomorphic/mhx_rts/wiki/Home


BVH and FBX Retargeter
The purpose of the BVH and FBX Retargeter is loading animations from BVH or FBX files to a given armature, and editing these animations in various useful ways.
Download:
https://www.dropbox.com/scl/fi/ge0grf1x4fzr9ojgc76up/retarget_bvh_v4_1_0.zip?rlkey=7tdo5tfppgay04h7g3wjvk2bb
Documentation:
https://bitbucket.org/Diffeomorphic/retarget_bvh/wiki/Home


The next three add-ons were recently spawned from the DAZ Importer in order to keep down its size somewhat. They contain rather specialized tools that are probably not of interest to most users. They are also poorly documented.

Important: The DAZ Importer must be enabled first, before any of these three add-ons can be used.

DAZ Preset Exporter
This add-on contains some tools for creating pose presets and other assets that can be used in DAZ Studio.
Download:
https://www.dropbox.com/scl/fi/nfqjioymya3sofq71pcv4/export_daz_v4_1_0.zip?rlkey=4nujmfmir99dqf6sm7y0weyzi
Documentation:
https://bitbucket.org/Diffeomorphic/export_daz/wiki/Home


DAZ Rigging
Some specialized tools for rigging certain types of figures, link chains and tails.
Download:
https://www.dropbox.com/scl/fi/yxbgw81qefraag8kfmwbs/rig_daz_v4_1_0.zip?rlkey=it2g7t7gka9i0jz5z52g1oxec
Documentation:
https://bitbucket.org/Diffeomorphic/rig_daz/wiki/Home


Shell Editor
Contains some tools for manipulating shells imported from DAZ Studio.
Download:
https://www.dropbox.com/scl/fi/zl1s34xasma4i9deo05j7/shell_edit_v4_1_0.zip?rlkey=7fr4izofl0a7srvacppgr0x8u
Documentation:
https://bitbucket.org/Diffeomorphic/shell_edit/wiki/Home


Sunday, May 19, 2024

New Version Numbers

It will soon be time for a new release of the DAZ Importer and MHX Runtime Systems. But recently a number of related add-ons were spawned from the importer add-on, cf the post on Add-on Split. There has also been some progress on the BVH Retargeter, which can now also deal with FBX files, see FBX Files and BVH Retargeter. The plan is to release all of them together in the near future.

Since the last release was version 1.7.3, the original plan was to call the new release 1.7.4. However, the BVH Retargeter is already at version 2.2 (version 2.0 was when the name changed from MakeWalk), so going back to 1.7.4 would be confusing. Therefore, I decided to change the version number of all add-ons to 4.1.0. 

Making such a jump in version number is unusual, but it is not that different from DAZ going from Genesis 3 to Genesis 8. And of course the new version number carries another piece of information: 4.1.0 is the most recent version of Blender that the add-ons have been tested with. Even if the Diffeo add-ons are by now quite mature and I don't expect to add much new functionality (but you never know), there will probably be updates since new Blender versions always tend to break something.

Tuesday, May 14, 2024

Blender Shells

A geometry shell or geoshell in DAZ Studio is a kind of virtual mesh. It is a clone of a base mesh which can modify materials and some other properties. When loading a figure with geoshells the DAZ Importer creates a special node group in every material affected by the shell (if the Shell Method setting is set to Material). GeneralProtectionFault recently suggested that we might want to use the shell tools to add other node groups created in Blender. 

This idea has now been implemented. Since the DAZ Importer has grown too large and unwieldy, it was recently split into several separate add-ons, see the post on Add-on Split. The new tool that makes Blender shells is located in the Shell Editor, which contains tools for manipulating shells and layered images from DAZ Importer. The idea is to take a given node group, and make it into a shell which behaves just as the shells imported from DAZ Studio.

GeneralProtectionFault made a script which creates a procedural dirt node group. The script can be downloaded from here. To create the node group, load the script into Blender's text editor and press the Run Script button.

A node group is created in Blender's database. We could also create the node group manually. The only requirement is that the first input and output sockets be the ingoing and outgoing shaders, respectively.
Select the mesh and Add Custom Shell.
In the dialog, select the node group at the top and select the materials . Here we pressed the Skin button to quickly select all skin materials.
At the end of each node tree, a shell node group is created. It has the same sockets as every other shell node. Notice that the Influence slider is purple, meaning that it is driven.
To create drivers the global setting Shell driver type must not be None. I prefer to use rig properties to drive the influence, because using mesh object properties doesn’t seem to work with file linking, but armature object properties do.
The shell node group is a wrapper that contains the original node group and mixes the output with the original shader according to Influence. The only requirement is that the first input and first output are the ingoing and outgoing shader. If you want to tweak the node parameters, we can do it here and all materials are changed. The UV and Displacement sockets could also be used.
We can control the influence of shells in the DAZ Runtime > Visibility > Shells panel.

 

Saturday, March 30, 2024

Manual Editing of Favorite Morphs

It is possible to import the same morph twice, both as a standard morph and as a custom morph. If we have done that and then saved the morphs as favorite morphs, the duplicate morphs will be loaded to each new character that uses these favorites. This is a nuisance that I have run into several times, and since it turns out that I'm not alone, I will explain how I deal with this issue: by cheating. More exactly, by editing the json file with favorite morphs in a text editor.

Here we have loaded some FACS morphs, and also loaded some custom morphs that move the jaw. We notice that the FACS Jaw Open and Custom Open sliders always show the same value. This is because they are in fact the same slider; the custom property "facs_jnt_JawOpen". We want to remove this slider from the json file, so next time the slider only appears in the FACS panel.

Save favorite morphs to a new file. Disable the new Compact View option to make it easier to edit the json file.

Now open the json file that we just saved in a text editor. Each line contains information about one morph: the file where it is defined, the morph name, and the body type. We see that  several JawOpen morphs appear in both the FACS and Custom/Jaw sections. Delete the lines from the latter and save the json file.

If we now load the favorite morphs to a new character, the Jaw Open morph only appears in the FACS panel.

A warning. The json format is quite picky, and it is easy to change the file to illegal syntax. That is why I recommend that you save a new file, so the old one is not corrupted. 

Here is an example. Removing the last morph from the FACS section make the syntax illegal, because of the trailing comma at the end of the line before it. The elements of a json list are separated by commas, but there must be no comma after the last element.

If we try to load the corrupt file we get an error. More information about what went wrong is given in the console window.

JSON error while reading ascii file
"D:\home\myblends\New Folder\my-favos-noncompact.json"
Expecting value: line 14 column 13 (char 2101)

So the problem with the extra comma happens close to line 14 (the comma is actually on the line before).

Sunday, March 24, 2024

Fixing Sloping Shoulders

When we imported the UE4 animation in the post on FBX Files and BVH Retargeter, we noticed that the collar bones have a quite unnatural pose; the shoulders are sloping. This is unfortunately something that happens quite often, but not always. It depends on the rest pose of the rig in the BVH file.

This can sort of be fixed with the Shift Animation tool. Rotate the collar bones up, and then rotate the upper arms down to compensate. However this is quite annoying and the result is not always good, so I found a different solution. The new Clear Bones tool clears the animation of the collar bones, which usually shouldn't move so much anyway, and then rotates the upper arms so their rotation in world space remains unchanged.

Here we have a typical situation. The collar bones slope far too much.
With the collar bones selected, press Clear Bones.
Now the collar bones don't slope anymore, and the arms remain oriented in the same way as before. The pivot points of the upper arms have moved, since the collar bones are rotated differently, but the arm's world space rotation is unchanged.

Friday, March 22, 2024

FBX Files and BVH Retargeter

As the name suggests, the BVH retargeter imports animations from BVH files. However, it appears that popular sites like Mixamo only offer animations in FBX format these days. Recently user GeneralProtectionFault suggested that one could use the BVH retargeter for FBX files as well, by first importing the FBX file with Blender's built-in FBX importer and then writing the animation as a temporary BVH file. This technique has previously been used in this add-on.

Support for FBX files has been implemented in the development version of the BVH retargeter. We can notice that the "Load BVH File" button has been renamed, and is now called "Load BVH or FBX File". To import the animation, we select our target rig and press "Load And Retarget" as usual.
Select the Capoeira.fbx file which can be downloaded from Mixamo or from the issue in the bug tracker.

Also note that the panel to the right has changed. The add-on now uses the standard Blender way to specify the orientation of the rig in the animation file.

And now our character does the capoeira.

The DAZ Importer has been able to import facial animations in the FaceCap and LiveLink formats for a long time, see e.g. this FaceCap test. Bouich Jules found another good way, and it’s UE4 facial animation, used here by QUICKMAGIC https://www.quickmagic.ai/index/. Again the files are in FBX format, so we need to do a similar trick as above. First the add-on imports the FBX file with Blender's FBX importer, and then copies the FACS animation from the imported mesh to the target rig. A sample file can be found in the issue in the bug tracker.

The complete FBX animation includes both the body poses and the FACS morphs. To import it to our target character we proceed in two steps. First we Load And Retarget the FBX file in the same way as we did with the capoeira file above.
Our character now moves, but her expression remains blank.
Let us now import the facial animation. If you have not already done so, go to the DAZ Importer and import the FACS morphs and make all bones posable.
Now open the new FACS panel in the BVH retargeter tab. These tools used to be located in the DAZ Runtime > Morphs > FACS panel, but it makes more sense to import the entire animation from the same add-on.

With the target character selected, press Import FACS From FBX File.

Select the same FBX file as above. Disable the New Action option so the face and body animations belong to the same action. Alternatively, we can make a new action and push both actions down on the NLA stack.
And now our character both moves and smiles.