Blender addon to generate rigged hd meshes, hd shape keys, normals and vector displacement textures from daz HD morph files [part 2]

Issue #814 new
Xin created an issue

Continuation of: https://bitbucket.org/Diffeomorphic/import_daz/issues/357/blender-addon-to-generate-rigged-hd-meshes (go there for some information on how to use it).

I adapted and extended the code from https://github.com/edolstra/dhdm to compile a .dll which can be called from Python. The latest version is the attached .7z here.

The source is also available in the following repository: https://gitlab.com/x190/daz-hd-morphs . There you can find compilation details for the .dll under MinGW on windows x64 (the code should work on Linux too with some small modifications).

Comments (29)

  1. bouich jules

    Hi Xin,

    the problem came back even with my new fresh install of blender, and when i try uninstall/reinstall the plugin i have this error:

    so might be something related… ?

    Thanks!

  2. bouich jules

    OK i think im almost sure i’ve figured out this issue, why it doesnt work:

    because of scalling.

    here is the model what you send me compare it to mine. mine are huge:

    it’s scalling, my models are way too big…

    my blender unit is: 1

    while unit scale is 0.01 on the plugin

    EDIT: changing the unit scale to 1 in the plugin fixed the problem, so it was not related with blender actually!

    So becareful of your mesh scaling and make sure to use the proper unit scale on this amazing plugin!

  3. bouich jules

    Hello XIn,

    Any idea how to speed up the viewport after creating the HD mesh ? , i can’t add mannequin ;P

    it’s literally almost impossible to animate with the lag.

    thanks!

  4. Xin reporter

    I would only use the base mesh to create the animation (without subdivision modifiers), since you don’t need to constantly see the HD details to see how the overall animation is going. Then, at certain frames, you can unhide the HD mesh to adjust some HD details. Before rendering, hide the base mesh and unhide the hd mesh.

    Both the base mesh used for animation and the HD mesh could use the same armature. Or, since the armatures have the same hierarchy and bones' names, you can share Actions between them.

  5. Xin reporter

    Are you sure you are using that operator the right way?

    To use it:

    1. Create a copy of the body mesh and geograft mesh just before merge.
    2. Merge one set of body-geograft meshes with import_daz, as usual. Assume the merged mesh is called “merged”.
    3. Generate file with the new Geograft operator: select the body mesh, then the geograft mesh and finally the “merged” mesh, which should be the active one. Click the button. A .json file will be generated in the working directory.
    4. If you ever want to use the “merged” mesh as a “base mesh” with this addon (for example, to create a rigged HD merged mesh from it), you need to also specify the generated file above in this addon’s main settings for the morphs to work properly.

  6. Xin reporter

    It needs to be recompiled for 3.1 since they changed some relevant Blender headers again.

    It’s not hard to do, but I currently don’t have Blender installed since my laptop’s fan broke. This laptop is 10 years old now and its problems have started to accumulate. It’s at the point where it can’t be used for anything demanding, so I don’t want to stress it too much since it overheats easily without the fan. I will try to maintain this addon again whenever I get around to buying a new computer (a desktop this time).

    The source code is available in the link in the first post in case anyone wants to compile it or modify it themselves.

    Eventually I would also like to focus on trying to compile a Linux version, and release the “dhdm writer” program as an addon maybe (e.g. it takes a sculpted mesh in Blender and produces a .dhdm file that can be used for hd morphs in daz).

  7. bouich jules

    Thank you XIn, i think 3.0 and 3.1 are intercompatible so no hurries about updating your amazing plugin.

  8. Alessandro Padovani

    Xin, I was a programmer a long time ago before becoming a IT professional. If you can give me instructions I’ll try to compile it for you. What do I need as a minimum setup for compiling ?

  9. bouich jules

    Actually you can create the HD mesh with 3.0 then open your blend file with 3.1, to be honest i see no need for a rush for it , better to wait and to avoid bugs and problems.

  10. Maneki

    Yes, it’s not a big deal. It works fine with 3.0 and I link characters to projects, which means I need at least 2 instances of Blender anyway. I hope you’ll be able to get a replacement for your laptop soonish.

  11. Aszrael

    Hi Xin,

    thanks for all your effort you put into it. Can’t wait to see your linux compilation as I not managed to due it myself.

    However, I found a bug in your Normals/Displacments baking procedure. For some reason your code cannot load dhdm files with a SPACE in it’s name (error: … cannot find file: … xxx%20yyy.dhdm).

    Seams like you parsing the .dfs and just grap the last part of the hd_url as a string without translating %20 → SPACE?

    example: …/…/SWM%20Face2.dhdm

    should be: …/…/SWM Face2.dhdm

    Either renaming the original file to: SWM%20Face2.dhdm or editing the hd_url by hand in the corresponding .dfs solves it.

    Quick fix for your utils.py would be:

    • additional import of: re → so first line

      import bpy, os, math, time, gzip, json, re

    • add: dhdm_fp = re.sub('%20', ' ', dhdm_fp) in “read_dhdm_level(dhdm_fp)” //around line 502
      def read_dhdm_level(dhdm_fp):
      dhdm_fp = re.sub('%20', ' ', dhdm_fp) # strips '%20' from dhdm_fp
      if not os.path.isfile(dhdm_fp):
      raise ValueError("File "{}" not found.".format(dhdm_fp))
      with open(dhdm_fp, "rb") as f:
      h = f.read(8)
      return int.from_bytes(h[4:], byteorder='little', signed=False)

    No clue why I cannot paste python code here - always the format is messed up - sorry. So keep the indent level correct.

  12. Xin reporter

    Thanks for reporting that Aszrael, I think it’s now fixed if you download it from gitlab.

    As for compiling it Alessandro, I can try to explain the process, but it can become quite tedious since you would need to compile the libraries needed too (listed in “README.txt”). I don’t know if that’s worth your time right now. Maybe for future Blender versions (LTS version) it would make more sense.

  13. Alessandro Padovani

    Ok since it works with 3.0 I guess it’s not urgent. I’ll be available if you feel like trying it together and hope you’ll be back soon !

  14. Jochen Sutter

    The “HD expressions” and the “unique Smile HD” morphs are working to generate normal maps, but I tried it with the “Aging Face Details”. It does not work. I get this error

  15. Jochen Sutter

    … I figured out. It does not work, if the .dsf and the .dhdm files have spaces in the filenames. I replaced them with anderlines and also corrected the pathnames in the .dsf file and then it works.

  16. Jochen Sutter

    I think the bug in the script is, that the spaces are replaced with “%20” in the filenames.

    The file name is ”AFD Forehead 01.xxx”

  17. Xin reporter

    Yes, that issue was reported above and it was fixed in the gitlab version (see the link in the first post in this thread), but I haven’t yet uploaded a .7z with the fixed version. You can just download the version from gitlab.

    I might also upload an up-to-date .7z soon, since I don’t think I will be getting a new computer soon as I don’t consider current gpu prices reasonable for what I would end up using it (I will be sticking to this old laptop for the time being since it works well enough for non-graphics related programming).

  18. ぬらとん

    Hello, Xin. Thank you for an awesome addon.

    By the way, “HD mesh generation“ and “HD shapekey” return errors.

    How can I solve this?

  19. Maneki

    It’s only compatible with 3.0 as of now. If you use 3.1 or 3.2 you’ll get errors. Xin didn’t have time/the possibility to compile a version for the newer Blender applications.

  20. Alessandro Padovani

    That's amazing news thank you Xin for taking the time to do this. Also because your addon is essential to get HD expressions and it’s frequently requested and referenced at the daz forum. Going to test I’ll let you know if there’s anything.

  21. Log in to comment