HD Morphs (Face Expressions, Skin Folds)

Issue #300 closed
Jochen Sutter created an issue

As I have read here and tried out, HD morphs are not possible in Blender. This is especially relevant for face expressions and skin folds, because it depends on the poses. I can therefore not solve it with the HD Export. Will there be a solution or is it not possible in principle?

Comments (36)

  1. Alessandro Padovani

    The issue is that multires doesn’t support HD morphs. This is reported to the blender team and there’s hope that a next version of blender will fix it.

    Meanwhile you can export HD morphs to the HD shape, without multires, but you will need to rig it yourself. And anyway a HD figure with lots of HD morphs will not be animation friendly, though it may be good for single pictures.

  2. Thomas Larsson repo owner

    Actually, it doesn’t seem be possible to import HD morphs even to a HD mesh. The .dsf files that I have inspected only contain the morph at base resolution, plus a pointer to a .dhdm file. The .dhdm file is a binary file, but it is not a gzipped file nor some other well-known compressed format, so that data cannot be extracted.

    That said, I just managed to import a dbz file as a HD morph. For that to work, the base character has do be subdivided sufficiently many times in DS, with the right subdivision algorithm, normally Catmark. I tried to add multires levels in Blender and apply the multires modifier to get a HD mesh, but importing the HD morph gave nonsense, presumably because Blender uses a different subd algo.

  3. Alessandro Padovani

    Thomas, what I mean is it is possible to import a obj as morph for the HD mesh. We have to uncheck the “add multires” option first, so we lose the rig. Below an example where I imported the “mouth-out” morph as a new HD morph. I get no issues with the vertex order this way.

    This is before the new d26b2e3 commit. I’m going to check it to see how it works.

    1. turn off the “add multires” option in global setting
    2. import the HD mesh
    3. import the HD morph as obj
    4. join as shape

  4. Alessandro Padovani

    As for commit d26b2e3 it seems I can’t enable the plugin. I get an error. If I revert to commit 9cd9a2b it works fine.

    Loading DAZ
    Traceback (most recent call last):
      File "C:\Program Files\blender-2.91.0-windows64\2.91\scripts\modules\addon_utils.py", line 351, in enable
        mod = __import__(module_name)
      File "C:\Users\Alessandro\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\import_daz\__init__.py", line 80, in <module>
        importModules()
      File "C:\Users\Alessandro\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\import_daz\__init__.py", line 75, in importModules
        mod = importlib.import_module("." + modname, anchor)
      File "C:\Program Files\blender-2.91.0-windows64\2.91\python\lib\importlib\__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "C:\Users\Alessandro\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\import_daz\objfile.py", line 381
        if len(verts) == len(ob.data.vertices):
                                              ^
    SyntaxError: invalid syntax
    

  5. Jochen Sutter reporter

    Thank you for your ansers. The solution of Alessandro sounds a bit complex for me to make it for the HD face expressions. I hope a solution will be found in future updates.

  6. Alessandro Padovani

    tested with daz studio 4.14, blender 2.91

    Commit 44db6ce doesn’t crash anymore. Plus HD morphs seem to work fine with multires. That is, if I use the new “import dbz morphs” on the multires mesh it seems the HD morph works fine. I can’t understand how this is possible, since multires is not supposed to support HD morphs.

    Below an example with the mutation morph for G8F where I exported the mouth-out morph, it’s subdivision level 2.

    https://www.daz3d.com/mutation-morphs-hd-for-genesis-8-female

    1. export the HD figure as dbz
    2. export the HD morph as dbz
    3. import the HD figure
    4. select the multires mesh
    5. import the HD morph with “import dbz morphs”, it seems to work fine with multires

  7. Alessandro Padovani

    update. I tried with multiple HD morphs on the multires mesh and they seem to work. This is limited to actor morphs though, no jcms.

  8. Alessandro Padovani

    update. May it be that “import dbz morphs” imports the base mesh morphs instead of the HD mesh morphs ? That would explain why it works with multires.

  9. Alessandro Padovani

    update. Donald just compiled the new version of the HD exporter. It seems it doesn’t work with geografts, but it works fine to export HD figures and morphs. To use the exporter just place the dll in the daz plugin folder, then use the edit > diffeo menu to export.

  10. Thomas Larsson repo owner

    The dbz file contains both the HD mesh and the mesh at base resolution, and the tool picks the one with the correct number of vertices. The mesh with multires has the same number of verts as the base mesh, so that is the morph that will be loaded. To load the HD morph, you need to import a HD mesh by turning off the multires option in the global settings.

    I am rather pessimistic about HD morphs. You can load them today, but you need to export each morph separately, as an obj or dbz file, and that is too cumbersome. To read the HD morphs directly, as the plugin does with ordinary morphs, seems difficult since the HD info is stored in an undocumented binary format in a dhdm file.

  11. Alessandro Padovani

    Well, if we need to turn off multires then it’s the same as the obj workflow above, but the obj is much faster to export than the dbz, unless we use the c++ exporter by Donald.

    As for HD jcms, I agree it’s cumbersome for animation but it may be useful for very detailed figures for single renderings as for making comics. The dhdm format we could ask to daz, but we need the HD multires support by blender, unless there’s a way to transfer the rig to the HD mesh.

  12. Jochen Sutter reporter

    Yes I would need it for HD face expressions in single renders. So I will try it as soon I will need it. I’m quite new in Blender, so many things sounds a bit complicated. Do I need Blender 2.91 for you HD morph solution? I still work with blender 2.90 at the moment. I hope you will find an easy way for the user to import HD morphs. Maybe with the DAZ support. That would be great.

  13. Jochen Sutter reporter

    I want to try this new diffeo-hd.zip DLL for HD face expressions. I copied it to the DAZ plugin folder (C:\Program Files\DAZ 3D\DAZStudio4\plugins) Then you write “use the edit > diffeo menu to export“. Do you mean this?

    then you write

    1. export the HD figure as dbz
    2. export the HD morph as dbz
    3. import the HD figure
    4. select the multires mesh
    5. import the HD morph with “import dbz morphs”, it seems to work fine with multires

    This steps are not so clear for me. I alredy have the figure imported in Blender. as multires HD figure. How can I export and import a HD face-expresison for example. I tried to export the figure in with the faceexpression as DBZ with this menupoint “Differmorphic Daz importer” and imported it with “Import DBZ Morphs”. I get the shapekey but it has no effect. I think I made it not correctly

  14. Jochen Sutter reporter

    Another point is. I tried to import the Base HD face expressions as custom morphs. That worked and the HD expressions also have an effect to the figure. The Effect is not in HD but it seems to work. The expression is better then without HD when I set them both to value 1. I made a picture to illustrate.

    Thomas writes that the HD source files are encrypted. but here it seems to work, exept the effect is not in HD.

  15. Alessandro Padovani

    Jochen, as Thomas explained you need to turn off multires in the global options to get the HD morphs, so essentially you lose the rig, and it’s the same as the obj workflow. The steps above from 1 to 5 will import the HD morph at base resolution, so you get something anyway but it’s not HD, and it’s what you did in your example. Be aware that in some cases the HD morph at base resolution may give bad results, as in the HD mouth example in #288. That is, to use HD morphs you need a HD mesh, they tend not to work fine with the base mesh.

    The plugin by Donald works great, just be aware that it has issues with the geometry editor. So if you enter the geometry editor for any reason, then you need to restart daz studio before using the plugin again. The geometry editor can be used as a shortcut to import geografts with HD figures. But you can also export the HD figure and the geograft separately then merge them.

    http://diffeomorphic.blogspot.com/2020/09/hd-meshes-and-geografts.html

    http://diffeomorphic.blogspot.com/2020/09/hd-meshes-and-geografts-revisited.html

  16. Jochen Sutter reporter

    Thank you for your answers.
    Now I could import HD expression on an HD Figure imported with unchecked “add multires”. As you told I lost the rig and it’s not possible to load the base expressions anymore. So this way is not usable for me.

    But you have written above:”Commit 44db6ce doesn’t crash anymore. Plus HD morphs seem to work fine with multires. That is, if I use the new “import dbz morphs” on the multires mesh it seems the HD morph works fine. I can’t understand how this is possible, since multires is not supposed to support HD morphs.”

    This I could not figure out till now. I loaded a HD Figure with multires. Then the imported HD Expression shapekey has no effect as expected. When I export the dbz over the diffeo-HD I get just the zero base figure if I import the duf file to blender. I’m not sure if I understand it correctly if this is possible or not to load a HD expression to a multires mesh.

    I did update the diffeo plugin and I use Blender 2.91.

  17. Alessandro Padovani

    Jochen, my first impression was wrong I was just testing the commit knowing nothing on how to use it so mistakes happen. Then Thomas replied. You can’t load HD morphs on multires. That is, you can, but you only get them applied to the base mesh, so HD details are lost.

  18. Jochen Sutter reporter

    I tried now the DAZtoBlender Bridge 2.0. HD Face-Expressions work, it doesnt use multires you can import the full HD mesh riged. But unfortunately many other things don’t work with that plugin. The eyelashes and brows don’t follow the faceexpressions and it’s not possible to import strand base hair.

    The diffeo tool is realy much better. An idea was to use “bake normal maps” to improve HD expressions as long as it’s not possible to use HD morphs on multires. The greyscale height maps would probably be better for post processing the map. Is there a way to convert normal maps to displacement maps?

    This is a baked normal map of the HD-expression Triumph.

  19. Thomas Larsson repo owner

    I don’t think you can convert normal maps to height maps in any simple way. But I did notice that the bake from multires tool can bake to both normal and displacement maps, so I added that as an option to the Bake/Load Normal Maps buttons. The buttons are also renamed since not only normal maps are baked anymore.

  20. Alessandro Padovani

    Be aware that eevee doesn’t support displacement, plus it has issues with bump maps. That is, eevee only works fine with normal maps.

    As for the daz bridge it imports a HD figure as a true HD mesh. This means that all the HD morphs will work fine. But this also means that the rig is projected to the HD mesh with some approximation, so you get artifacts in bending areas. Below an example with the G8F exported with the bridge at subdiv 2. You can see the fold artifacts in the hip area. Not a good solution if you ask me.

    It would be interesting though to have a similar option with diffeo. That is, a tool that projects the rig to the HD mesh, imported without multires. But I have no idea if this is possible, I’m not a rig expert at all.

  21. Xin

    Yeah, I agree with Alessandro, a tool to transfer vertex weights to the HD mesh might be quite useful, especially since you would want to be able to at least pose the (real) HD mesh to bake normal maps which you can use for animations with the lightweight mesh (basically manually set up tension maps), or to bake displacements to use with the multires one.

    Has anyone tried Blender’s Data Transfer modifier to transfer vertex weights from the “imported model with multires applied” to the “directly imported HD mesh”? see here for instructions: https://blender.stackexchange.com/questions/177810/blender-2-81-transfer-rig-to-similar-unrigged-unskinned-model

  22. Thomas Larsson repo owner

    The old morph transfer tool uses the data transfer modifier. Since this does not support shapekeys directly, the shapekeys are converted to vertex groups which are transferred with the modifier, and then the shapekeys are reconstructed on the clothes side. The main impression is that this is very slow for large meshes, and that the Blender people know this because an error message is printed in the terminal for each transfer. No reason to think that transferring vertex groups from the base mesh to the HD mesh will be any faster.

    In principle one could export vertex groups for the HD mesh directly, but that would increase the already too long export time many times. It could perhaps be done with Donald’s C++ program, but the load time in Blender would still be horrible.

  23. Xin

    I will test the Data Transfer with various options and see what I get. Even if it’s slow, it would be a one time thing to get a functioning rig on the (real) HD mesh, unlike morphs which are numerous. But then again, if it’s too slow, you might as well use the daz bridge to get the rigged (real) HD mesh into Blender.

  24. Xin

    It actually works quite fast (less than 10 seconds with 250k vertices) if you use the one to one mapping Nearest Vertex (instead of any of the interpolation methods), which makes more sense here. I applied the multires first on the rigged HD mesh imported with this addon, then I used the Data Transfer on the HD mesh imported without multires and which had no vertex groups (but which can have HD morphs imported manually to it later on). Then I applied the Data Transfer and created the armature modifier for it (with the same settings as the armature modifier for the other mesh). The deformation is practically the same in both meshes.

    The Data Transfer assigns almost every vertex to all vertex groups, so you could do some cleanup later, for example, with the Clean operator (this part was a little slow, haven’t tried doing this with python to see if it’s faster): https://docs.blender.org/manual/en/latest/sculpt_paint/weight_paint/editing.html#clean

    But at the end of the day, why not just use the daz bridge if you wanted the rigged HD mesh with HD morphs? by the way, the bridge imports expressions as shape keys so it’s quite flawed.

    With the rigged non-multires mesh you can bake the HD morphs from it to either the multires HD or to a non-HD mesh, both of which can’t load HD morphs. But such baking is not something which this addon addresses, so I don’t really understand what Jochen did. A bake with Blender? but Blender 2.8+ can’t do displacement bakes. So if he used this addon’s baking he just baked the multires at high res onto the base, so he didn’t get anything that the multires already can’t handle.

  25. Jochen Sutter reporter

    Xin. I just HD exported the zero base G8M figure with subD Level 3 and the HD Triumph expression from DAZ and imported it with multires to Blender. Then I used the new “bake map” to make the hight maps. I use Blender 2.91. This hightmap works on multires HD Figure as dispalcement or normal in Cycles.
    This hight map baker is great. So I also can make hight maps for the Veins and can use this maps to give the Veins a soft blue color touch with subsuface scattering.

  26. Jochen Sutter reporter

    Alessandro, I also have no expereince with rigging. For me the DAZtoBlender Bridge has to many issues. If you get this artifacts on posing it’s just another issue.
    With the diffeo tool I also could import the Puppy dog and load the morphs. It was not possible with the DAZ-bridge though it should be bridge compatible. And on the G8M figure the eyelashes don’t follow the face expressions. Also strandbase hair is not possible to import. This is important for me to make male body hair. The strand base hair maker in DAZ is great and I’m happy I can import this hair with the diffeo tool! Maybe Blender will implement HD-morphs on hiher multires Levels sometime?

  27. Xin

    Thanks for the answer Jochen, but I don’t think I follow.

    What is the new “bake map”, the button from this addon? all that bake does is calculate the difference between the displacement of the mesh when the multires is set at the highest number of subdivisions, and the displacement of the same mesh when the multires is set to 0 subdivisions. That means you should already have the HD details on the geometry if you rendered the multires mesh at the highest number of subdivisions.

    That’s why I was wondering how you ended up with HD details on the bake. If you can’t see those details when rendering with the multires at the highest number of subdivisions, how come you can see them on the bake?

    Judging by your previous posts you took the multires mesh and you imported both the expression with the “Import Expressions” button and also the morph “eJCMTriumph_HD_div2.dsf” with the “Import Custom Morphs” button, and all you did afterwards was to dial both up and press this addon’s button to bake displacement maps. Then you applied that displacement map on the multires mesh and rendered it with the highest number of subdivisions. Is that right?

  28. Jochen Sutter reporter

    Xin, the “bake maps” button is in the newest update of the Diffeo addon. First it’s name was “bake normal” but now you can bake normals or height maps with it.

    To bake the HD Triupmph expressions make this steps

    • in Daz load the zero base figure and give it the HD expression

      * export this figure in the usual way as .duf and with “HD export zo Blender” as .dbz * Then import this figure to blender. so you have the G8M HD base figure with the HD expression in Blender. Save it as .blend file. select the HD mesh and you can bake the normal or displacemenr map. * * I have no idea how it makes it, but the result is this

    Because I only want the skin wrinkes I post process this map a bit. You are right. it would be better the map would only show the difference between the base mash and the subD 3 level mesh, but it’s ok so to me. I don’t know how it comes to this result.

    As soon I have this maps I close this file and load my figure which I want to attach this maps. On this figure I load the HD expression of Triumph as “custom morph” Then you have The Triumph and the HD Triumph as shapekeys under the Custom Morpphs”. You see the HD Triumph effects the subD 0 level only it’s not HD. You don’t see the eye and nose wrinkles etc.

    So I add the dispalcement map in the shader as displacement to get the wrinkles. It’s not perfekt but a way to improve HD face expressions

  29. Jochen Sutter reporter

    Maybe you don’t need to import the Triumph HD morph and just use the dispalcement map on the LD Trumph expression. I only tried it with this triumph expression. Maybe in other HD expressions we must improvise a bit to get a good result. maybe it’s not needed to postprcess the maps. I need some more experience. I don’t now what exaclty the maps show.

  30. jeroen b

    Jochen, when I bake a normal map from a mesh with a displacement texture, the best result that I get is when all modifiers are applied before baking. This way I get a “clean” result (only the difference), not sure if that would work baking a displacement map though.

    (NB; don’t save the file with applied modifiers obviously!)

  31. Xin

    Oh, thanks for the explanation, now I understand, you first imported the HD character posed so that’s why it was imported with HD details. That’s the part I didn’t understand earlier. That’s actually a nice way to get HD displacements into textures.

    You say: “it would be better the map would only show the difference between the base mash and the subD 3 level mesh”, but that’s literally what the baking does. That’s why I think your method works quite decently to apply HD morphs to other figures besides the one you baked from without having to re-bake for each one.

    Thanks again for the explanation, that’s a quite nice method.

  32. Jochen Sutter reporter

    So that map is the difference between the base mesh and subD3 level of a zero base G8M figure without any morph.

    I need to substract that from the map with the HD-expression, because I don’t want this difference. I only want the difference of the HD-Expression. So I invert this zero base map and add the HD-Expression and mulitiply it with -0.04.

    Then I get this result. Looks not bad 🙂

  33. Jochen Sutter reporter

    I baked this two maps together, so I get the “clean” HD face expression as single displacement map

    this is the result. i’m happy. I can realy use this funktion. also for coloring the veins 🙂

  34. Log in to comment