Metahuman DNA (Free Scripts) - Maya Experiments

Поділитися
Вставка
  • Опубліковано 13 жов 2024
  • Free script (non-commercial use) - HUGE SHOUT OUT TO @revoconner
    github.com/rev...
    Rename DHI namespace.py
    Combined_MH.py to transform joints (to match custom mesh)
    all his scripts must be placed in a folder and the script Combined_MH.py must be edited in the line #9. I used "C:\Maya\Journalist\Scripts"
    Official DNA Calibration from Epic Games
    github.com/Epi...
    dna_viewer_run_in_maya.py
    dna_viewer_grab_changes_from_scene_and_propagate_to_dna.py
    Export Sculpted MH to UE
    • How to sculpt a MetaHu...
    In the video, I used the steps:
    1. Set Maya Scene as "Y up", load the DNA viewer, fill in all fields and import DNA
    2. Import your modified mesh(es), adjust and freeze transformations to match Maya scene Y up. Rename it to "New_Mesh".
    3. Select one bone of the facial rig, go to attributes editor panel and rename rl4Embedded_Archetype to rigLogicNode
    4. Open the file Rename_DHI_namespace.py from Revoconnor and edit the script, replace "rl4Embedded_Nasim_rl" by "rigLogicNode" in the lines #124 and #201. Make sure enter_wrapped_mesh_name = "New_Mesh" in line #6. All his scripts must be placed in a folder and the script Combined_MH.py must be edited in the line #9. I used "C:\Maya\Journalist\Scripts". After that, select spine_04 and run rename_DHI_namespace.py
    5. Hide Original Head LOD0, show New_Mesh and run combined_MH.py to modify joint transforms.
    6. Create blendshape for the head so you can toggle on /off later. Repeat for the other face objects.
    7. Set Blendshape = 0 to get original shape and edit "SaveJointsInfo" to make sure the character name in the line #50 the same loaded in the scene, then run the script, which is explained below.
    8. Set Blendshape = 1 to get the new shape and run "UpdateDNA" once, which is also explained below.
    Now, explaining the modification of "dna_viewer_grab_changes_from_scene_and_propagate_to_dna.py", as this script was separated into two parts.
    1. My "SaveJointsInfo" is from line #1 to "# Loaded data - end of 3rd step". Make sure the character name in the line #50 the same loaded in the scene.
    Note: These lines below are just comments and it refers to the 4th step of the original script, meaning is done without code, therefore can be disregarded:
    ##################################
    modify rig in maya, 4th step
    ##################################
    ##################################
    2. My file UpdateDNA as is:
    Propagate changes to dna, 5th step
    reader = load_dna_reader(CHARACTER_DNA)
    calibrated = DNACalibDNAReader(reader)
    run_joints_command(reader, calibrated)
    for name, item in current_vertices_positions.items():
    new_vertices_positions = get_mesh_vertex_positions_from_scene(name)
    if new_vertices_positions:
    run_vertices_command(
    calibrated, item["positions"], new_vertices_positions, item["mesh_index"]
    )
    save_dna(calibrated)
    assemble_maya_scene()

КОМЕНТАРІ • 42

  • @LFA_GM
    @LFA_GM  9 місяців тому +2

    Free script (non-commercial use) - HUGE SHOUT OUT TO @revoconner
    github.com/revoconner/metahuman_rig_transfer
    - Rename DHI namespace.py
    - Combined_MH.py to transform joints (to match custom mesh)
    - all his scripts must be placed in a folder and the script Combined_MH.py must be edited in the line #9. I used "C:\Maya\Journalist\Scripts"
    Official DNA Calibration from Epic Games
    github.com/EpicGames/MetaHuman-DNA-Calibration
    - dna_viewer_run_in_maya.py
    - dna_viewer_grab_changes_from_scene_and_propagate_to_dna.py
    Export Sculpted MH to UE
    ua-cam.com/video/C295kX2ZKuE/v-deo.htmlfeature=shared
    In the video, I used the steps:
    1. Set Maya Scene as "Y up", load the DNA viewer, fill in all fields and import DNA
    2. Import your modified mesh(es), adjust and freeze transformations to match Maya scene Y up. Rename it to "New_Mesh".
    3. Select one bone of the facial rig, go to attributes editor panel and rename rl4Embedded_Archetype to rigLogicNode
    4. Open the file Rename_DHI_namespace.py from Revoconnor and edit the script, replace "rl4Embedded_Nasim_rl" by "rigLogicNode" in the lines #124 and #201. Make sure enter_wrapped_mesh_name = "New_Mesh" in line #6. All his scripts must be placed in a folder and the script Combined_MH.py must be edited in the line #9. I used "C:\Maya\Journalist\Scripts". After that, select spine_04 and run rename_DHI_namespace.py
    5. Hide Original Head LOD0, show New_Mesh and run combined_MH.py to modify joint transforms.
    6. Create blendshape for the head so you can toggle on /off later. Repeat for the other face objects.
    7. Set Blendshape = 0 to get original shape and edit "SaveJointsInfo" to make sure the character name in the line #50 the same loaded in the scene, then run the script, which is explained below.
    8. Set Blendshape = 1 to get the new shape and run "UpdateDNA" once, which is also explained below.
    Now, explaining the modification of "dna_viewer_grab_changes_from_scene_and_propagate_to_dna.py", as this script was separated into two parts.
    1. My "SaveJointsInfo" is from line #1 to "# Loaded data - end of 3rd step". Make sure the character name in the line #50 the same loaded in the scene.
    Note: These lines below are just comments and it refers to the 4th step of the original script, meaning is done without code, therefore can be disregarded:
    ##################################
    # modify rig in maya, 4th step
    ##################################
    ##################################
    2. My file UpdateDNA as is:
    # Propagate changes to dna, 5th step
    reader = load_dna_reader(CHARACTER_DNA)
    calibrated = DNACalibDNAReader(reader)
    run_joints_command(reader, calibrated)
    for name, item in current_vertices_positions.items():
    new_vertices_positions = get_mesh_vertex_positions_from_scene(name)
    if new_vertices_positions:
    run_vertices_command(
    calibrated, item["positions"], new_vertices_positions, item["mesh_index"]
    )
    save_dna(calibrated)
    assemble_maya_scene()

  • @Wellbeing_Kim
    @Wellbeing_Kim 9 місяців тому

    Finally succeeded. You are right. Thanks for your help. Since we spoke through a translator, I couldn't understand the text properly. thank you~

    • @LFA_GM
      @LFA_GM  9 місяців тому

      Glad it helped.

  • @revoconner
    @revoconner 11 місяців тому

    This is amazing! Cant wait to try!!

    • @LFA_GM
      @LFA_GM  11 місяців тому

      Thank you for making this awesome script available for free. It requires only 4 scripts to have an updated DNA. However, I'm still having trouble exporting back to UE, it crashes the editor all the time. Do you have plan to resume your development? Thank you for the visit.

    • @revoconner
      @revoconner 11 місяців тому +1

      Probably in march, I will be using metahuman to create a new pipeline

    • @LFA_GM
      @LFA_GM  11 місяців тому

      I managed to export all LODs to UE with dna_viewer_export_fbx.py, but facial rig gets broken. I look forward to seeing your next iterations with MH DNA. Keep it up!

    • @stpauldudko
      @stpauldudko 2 місяці тому

      @@LFA_GMto avoid the crashing you should add the new file path in a skeletal mesh asset before you start importing the fbx

    • @LFA_GM
      @LFA_GM  2 місяці тому

      @@stpauldudko Thank you for the answer. I'll check it out.

  • @MotuDaaduBhai
    @MotuDaaduBhai 10 місяців тому +1

    For the custom mesh, does it have same topology as MH or did you wrap it in Zwrap or similar program?

    • @LFA_GM
      @LFA_GM  10 місяців тому

      Same topology, slightly modified in Zbrush. I still need to do the same with all other facial geometries.

  • @Wellbeing_Kim
    @Wellbeing_Kim 9 місяців тому

    I'm unsure of what to do after step 3:07. I've understood that the 'dna_viewer_grab_changes_from_scene_and_propagate_to_dna.py' script is divided into two main parts, and it seems that #1 to #220 demonstrates a series of processes from the initial execution. I've progressed to renaming the league and automatic bone setup with revoconner, creating blend shapes similar to the video. If I run #1 to #220 again, the tasks are repeated (as expected), and running the script beyond #220 doesn't work. What should I do?

    • @Wellbeing_Kim
      @Wellbeing_Kim 9 місяців тому

      It seems like the part you mentioned as "savejointinfo" is likely between #221 and #228, but in my Python file, it is empty.
      shell
      Copy code
      220# loaded data - end of 3rd step
      ##################################
      ##################################
      # modify rig in maya, 4th step
      ##################################
      ##################################
      228# propagate changes to dna, 5th step

    • @Wellbeing_Kim
      @Wellbeing_Kim 9 місяців тому

      Can I receive the 'savejointinfo' and 'Updatedna' from you? After following the video instructions, when I execute 'savejointinfo', it reloads everything anew.

    • @LFA_GM
      @LFA_GM  9 місяців тому

      My apologies @Leetaehy , it was a bit late yesterday and I may not be clear. In the video, I used the steps:
      1. Set Maya Scene as "Y up", load the DNA viewer, fill in all fields and import DNA
      2. Import your modified mesh(es), adjust and freeze transformations to match Maya scene Y up. Rename it to "New_Mesh".
      3. Rename rl4Embedded_Archetype to rigLogicNode
      4. Edit Rename_DHI_namespace.py from Revoconnor and edit the script, replace "rl4Embedded_Nasim_rl" by "rigLogicNode" in the lines #124 and #201. After that, select spine_04 and run rename_DHI_namespace.py
      5. Hide Original Head LOD0, show New_Mesh and run combined_MH.py to modify joint transforms.
      6. Create blendshape for the head so you can toggle on /off later. Repeat for the other face objects.
      7. Set Blendshape = 0 to get original shape and run "SaveJointsInfo" once, which is explained below.
      8. Set Blendshape = 1 to get the new shape and run "UpdateDNA" once, which is also explained below.
      Now, explaining the modification of "dna_viewer_grab_changes_from_scene_and_propagate_to_dna.py", as this script was separated into two parts.
      1. My "SaveJointsInfo" is from line #1 to "# Loaded data - end of 3rd step"
      2. These lines below are just comments and it refers to the 4th step of the original script, meaning is done without code, therefore can be disregarded:
      ##################################
      # modify rig in maya, 4th step
      ##################################
      ##################################
      3. My file UpdateDNA as is:
      # Propagate changes to dna, 5th step
      reader = load_dna_reader(CHARACTER_DNA)
      calibrated = DNACalibDNAReader(reader)
      run_joints_command(reader, calibrated)
      for name, item in current_vertices_positions.items():
      new_vertices_positions = get_mesh_vertex_positions_from_scene(name)
      if new_vertices_positions:
      run_vertices_command(
      calibrated, item["positions"], new_vertices_positions, item["mesh_index"]
      )
      save_dna(calibrated)
      assemble_maya_scene()
      Hope that helps.

    • @LFA_GM
      @LFA_GM  9 місяців тому

      I updated the instructions in the video's description and the pinned comment. Hope that clarifies.

  • @josiahgil
    @josiahgil 3 місяці тому

    For some reason the rig logic button wasn't selectable it's greyed out even after assigning everyhing.

    • @LFA_GM
      @LFA_GM  3 місяці тому

      hi, do you mean at 0:23? If so, are you having any warnings or messages? I believe it only works with Maya 2023, Python 3. Are you using the folders as instructed in the this video? If not, more importantly, make sure your file paths don't contain spaces in the folder names, that would break Maya scripting.
      Check the version of Metahuman DNA scripts as well. Unfortunately, last time I checked, newer versions of DNA scripts are missing a few lines associated with Maya "environment setup", and you may not be able to run DNA viewer without those lines. You'll find in the section "Environment Setup" at the github page (github.com/EpicGames/MetaHuman-DNA-Calibration), option "python interpreter" and compare your DNA Viewer code side-by-side to see what is missing. I cannot paste the DNA codes outside Github, but my DNA viewer has this lines changed to:
      ROOT_DIR = "C:/dna_calibration"
      MAYA_VERSION = "2023" # or 2023

  • @Wellbeing_Kim
    @Wellbeing_Kim 9 місяців тому

    Rename doesn't work.
    cmds.rename ('DHIhead:spine_04', ':root:spine_04')
    # Error: ValueError: file line 7: No object matches name: DHIhead:spine_04
    How can I change "spine_04" to "DHIhead:spine_04" ?

    • @LFA_GM
      @LFA_GM  9 місяців тому

      I believe this is because the MH importing script was changed after that script was written. When importing the DNA, check if you get the bone hierarchy named as "spine_04". If not, you want to edit the script to match the name in the input section of the script.
      My script now is:
      from maya import cmds
      import maya.api.OpenMaya as om
      import os
      import maya.mel as mel
      cmds.select( clear=True )
      cmds.select('spine_04')
      children_joints = cmds.listRelatives(allDescendents=True, type='joint')
      cmds.select(children_joints, add=True)
      nameC = 0
      while nameC < len(children_joints):
      #print(children_joints[nameC])
      cmds.rename ("%s"%(children_joints[nameC]), ":DHIhead:%s"%(children_joints[nameC]))
      nameC = nameC+1
      cmds.rename ('spine_04', ':DHIhead:spine_04')

  • @JUYAN16
    @JUYAN16 9 місяців тому

    But what about the body? Can you apply the same scripts to the skeleton?

    • @LFA_GM
      @LFA_GM  9 місяців тому

      Unfortunately, these scripts were created only for the face (MH DNA)

  • @greentea7279
    @greentea7279 8 місяців тому

    Hello, Thanks for this method. I also have a this command error line in maya. "Error: IndexError: file line 126: list index out of range" . How could I solve this error?

    • @LFA_GM
      @LFA_GM  8 місяців тому

      Hi, it's hard to tell. When does this error happen? I mean what script is giving this error? And are you using Maya 2023, Python 3? Check my updated instructions in the video's description. Hope that helps.

    • @greentea7279
      @greentea7279 8 місяців тому

      I use maya2023 version and python 3.
      The error occurs when executing the combined_MH.py file in step 5, and it seems that the error occurs in your video as well.
      after an error occurs, a spine_04 joint will be created but will not be moved to suit the custom mesh.

    • @LFA_GM
      @LFA_GM  8 місяців тому

      yes@@greentea7279 I've re-watched it and indeed, it happens at 1:45, but I ignored it. Not sure if it is preventing the script from running correctly. Have you checked all updated instructions yet? You might've missed something. Does your custom mesh have the same topology of a MH head? It's not going to work with a different topology.

    • @greentea7279
      @greentea7279 8 місяців тому

      I use the same topology. If I can ignore the error line and move on, I pass this step5.
      By any chance, if I proceed with the update DNA after Save DNA, the mesh changes in the new scene, but the joint position does not change to a custom joint position, but it still maintain as an old joint position. Do you know why it is?@@LFA_GM

  • @Wellbeing_Kim
    @Wellbeing_Kim 9 місяців тому

    ah. Somehow I modified it and ended up with a blend shape. What scripts are "Set joint info" and "Update Dna" after that?
    I'm just running "dna_viewer_grab_changes_from_scene_and_propagate_to_dna.py" I just repeat again

    • @LFA_GM
      @LFA_GM  9 місяців тому

      That was the tricky part. This script "dna_viewer_grab_changes_from_scene_and_propagate_to_dna" needs to be split into two parts. You can open it with Notepad ++ or any other text editor)
      Part 1: I've named "Set joint info":
      From line #1 to #220. Those mentioned steps are:
      1. Start Maya
      2. open maya scene (do 2.1 or 2.2)
      2.1. Open existing maya scene generated from dna or
      2.2. start DNA Viewer GUI (dna_viewer_run_in_maya.py)
      - Select DNA file that you want to load and generate scene for
      - Select meshes that you want to change
      - Tick joints in Build Options
      - Click Process
      - in Maya scene rig is going to be assembled
      3. Run this script to the part called "load data":
      a. this step will get current vertex positions for all meshes
      The last line should be approx #220 and is a commented section: "# loaded data - end of 3rd step". Then comes the modifications done in step 4:
      Step 4: Lines #221 to #227
      Says to make all modifications either sculpting or creating a blendshape from a wrapped mesh (Wrap 3, ZWrap, etc). Eyes, teeth, and tear can be moved with soft selection, move tool, etc.
      Part 2: I've saved as "Update Dna":
      Starts from line #228 "# propagate changes to dna, 5th step" to the end. The steps are:
      Step 5. Run this script from the part called "propagate changes to dna" to the end to execute the steps below:
      a. set new joints translations
      b. set new joints rotations
      c. move all meshes vertices to new positions.
      I've done only for face, but I should've repeated for all face geometries, eyes, teeth, tear, etc. Hope that helps.

    • @Wellbeing_Kim
      @Wellbeing_Kim 9 місяців тому

      @@LFA_GM Oh, thank you so much. Let's test it right now. thank you

  • @pavelgorovoy903
    @pavelgorovoy903 9 місяців тому

    Hi, thanks for showing this method. very interesting. I experience an issue when running the combined_MH.py script. Every time I get this message. Maybe you had something like that? rl4_node_op()
    cmds.select( clear=True )
    cmds.delete('spine_04')
    #confirm box
    cmds.confirmDialog( title='Reset Done', message='Proceed now', button=['Yes'], defaultButton='Yes', dismissString='No' )
    # Error: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

    • @pavelgorovoy903
      @pavelgorovoy903 9 місяців тому

      Ah, I fixed it and ran the script but got this error # Error: ValueError: file line 125: No object matches name: rl4Embedded_Nasim_rl.jntTranslationOutputs[0]

    • @LFA_GM
      @LFA_GM  9 місяців тому

      Hi, got it. You want to edit the script, replace rl4Embedded_Nasim_rl by rigLogicNode in the lines #124 and #201.

    • @pavelgorovoy903
      @pavelgorovoy903 9 місяців тому

      @@LFA_GM thanks for the help! it is fixed now but I have another issue now :(. # Error: IndexError: file line 126: list index out of range

    • @pavelgorovoy903
      @pavelgorovoy903 9 місяців тому

      @@LFA_GM Also when I run the script SaveJointsInfo after creating blendshapes I get the same scene that I had at the beginning of the process. Looks like I also need to change something inside the script because at the moment it runs without errors but revertes everything to the initial phase.

    • @LFA_GM
      @LFA_GM  9 місяців тому

      I updated instructions in the video's description and the pinned comment. Take a look and let me know if that helps.