facebookresearch / AnimatedDrawings

Code to accompany "A Method for Animating Children's Drawings of the Human Figure"
MIT License
10.56k stars 926 forks source link

Obtain parameters for obtaining configuration files from Rokoko? #115

Closed Lufffya closed 1 year ago

Lufffya commented 1 year ago

Official example:

filepath: examples/bvh/fair1/dab.bvh
start_frame_idx: 0
end_frame_idx: 339 
groundplane_joint: LeftFoot
forward_perp_joint_vectors:
  - - LeftShoulder
    - RightShoulder
  - - LeftUpLeg
    - RightUpLeg
scale: 0.025
up: +z

I obtained the motion in BVH format files through Rokoko, But how do I know What is the end_frame_idx, which cannot be obtained from Rokoko, So how should we set it?

Lufffya commented 1 year ago

The following is a portion of the BVH file content

HIERARCHY
ROOT Hips
{
  OFFSET 0.0000 94.0000 0.0000
  CHANNELS 6 Xposition Yposition Zposition Yrotation Xrotation Zrotation
  JOINT Spine
  {
    OFFSET 0.0000 8.4839 -3.9483
    CHANNELS 3 Yrotation Xrotation Zrotation
    JOINT Spine1
    {
      OFFSET 7.5932 0.0000 0.0000
      CHANNELS 3 Yrotation Xrotation Zrotation
      JOINT Spine2
      {
        OFFSET 7.5932 0.0000 0.0000
        CHANNELS 3 Yrotation Xrotation Zrotation
        JOINT Spine3
        {
          OFFSET 12.8217 0.0000 0.0000
          CHANNELS 3 Yrotation Xrotation Zrotation
          JOINT LeftShoulder
          {
            OFFSET 12.4389 -7.0401 1.9147
            CHANNELS 3 Yrotation Xrotation Zrotation
            JOINT LeftArm
            {
              OFFSET 13.4599 0.0000 0.0000
              CHANNELS 3 Yrotation Xrotation Zrotation
              JOINT LeftForeArm
              {
                OFFSET 26.1001 0.0000 0.0001
                CHANNELS 3 Yrotation Xrotation Zrotation
                JOINT LeftHand
                {
                  OFFSET 28.9001 0.0000 0.0000
                  CHANNELS 3 Yrotation Xrotation Zrotation
                  JOINT LeftHandIndex1
                  {
                    OFFSET 8.0739 -0.1030 2.5612
                    CHANNELS 3 Yrotation Xrotation Zrotation
                    JOINT LeftHandIndex2
                    {
                      OFFSET 4.5805 0.0000 0.0000
                      CHANNELS 3 Yrotation Xrotation Zrotation
                      JOINT LeftHandIndex3
                      {
                        OFFSET 2.8181 0.0000 0.0000
                        CHANNELS 3 Yrotation Xrotation Zrotation
                        End Site
                        {
                          OFFSET 1.3566 0.0000 0.0000
                        }
                      }
                    }
                  }
                  JOINT LeftHandMiddle1
                  {
                    OFFSET 8.1366 -0.1030 0.5450
                    CHANNELS 3 Yrotation Xrotation Zrotation
                    JOINT LeftHandMiddle2
                    {
                      OFFSET 4.7024 0.0000 0.0000
                      CHANNELS 3 Yrotation Xrotation Zrotation
                      JOINT LeftHandMiddle3
                      {
                        OFFSET 3.1016 0.0000 0.0000
                        CHANNELS 3 Yrotation Xrotation Zrotation
                        End Site
                        {
                          OFFSET 1.4991 0.0000 0.0000
                        }
                      }
                    }
                  }
                  JOINT LeftHandPinky1
                  {
                    OFFSET 7.0181 -0.1031 -3.1368
                    CHANNELS 3 Yrotation Xrotation Zrotation
                    JOINT LeftHandPinky2
                    {
                      OFFSET 3.5541 0.0000 0.0000
                      CHANNELS 3 Yrotation Xrotation Zrotation
                      JOINT LeftHandPinky3
                      {
                        OFFSET 2.2340 0.0000 0.0000
                        CHANNELS 3 Yrotation Xrotation Zrotation
                        End Site
                        {
                          OFFSET 1.1205 0.0000 0.0000
                        }
                      }
                    }
                  }
                  JOINT LeftHandRing1
                  {
                    OFFSET 7.8067 -0.1031 -1.4405
                    CHANNELS 3 Yrotation Xrotation Zrotation
                    JOINT LeftHandRing2
                    {
                      OFFSET 4.3922 0.0000 0.0000
                      CHANNELS 3 Yrotation Xrotation Zrotation
                      JOINT LeftHandRing3
                      {
                        OFFSET 2.8327 0.0000 0.0000
                        CHANNELS 3 Yrotation Xrotation Zrotation
                        End Site
                        {
                          OFFSET 1.3500 0.0000 0.0000
                        }
                      }
                    }
                  }
                  JOINT LeftHandThumb1
                  {
                    OFFSET 2.0791 -0.1030 2.7863
                    CHANNELS 3 Yrotation Xrotation Zrotation
                    JOINT LeftHandThumb2
                    {
                      OFFSET 3.9619 0.0000 0.0000
                      CHANNELS 3 Yrotation Xrotation Zrotation
                      JOINT LeftHandThumb3
                      {
                        OFFSET 3.0072 0.0000 0.0000
                        CHANNELS 3 Yrotation Xrotation Zrotation
                        End Site
                        {
                          OFFSET 1.7295 0.0000 0.0000
                        }
                      }
                    }
                  }
                }
                JOINT LeftForeArmRoll
                {
                  OFFSET 14.0000 0.0000 0.0001
                  CHANNELS 3 Yrotation Xrotation Zrotation
                  End Site
                  {
                    OFFSET 7.0000 0.0000 0.0001
                  }
                }
              }
              JOINT LeftArmRoll
              {
                OFFSET 13.5000 0.0000 0.0001
                CHANNELS 3 Yrotation Xrotation Zrotation
                End Site
                {
                  OFFSET 6.7500 0.0000 0.0000
                }
              }
            }
          }
          JOINT Neck
          {
            OFFSET 20.2657 0.0000 0.0000
            CHANNELS 3 Yrotation Xrotation Zrotation
            JOINT Head
            {
              OFFSET 10.9846 0.0000 0.0000
              CHANNELS 3 Yrotation Xrotation Zrotation
              End Site
              {
                OFFSET 21.9692 0.0000 0.0000
              }
            }
          }
          JOINT RightShoulder
          {
            OFFSET 12.4389 7.0401 1.9147
            CHANNELS 3 Yrotation Xrotation Zrotation
            JOINT RightArm
            {
              OFFSET 13.4599 0.0000 0.0000
              CHANNELS 3 Yrotation Xrotation Zrotation
              JOINT RightForeArm
              {
                OFFSET 26.1001 0.0000 0.0000
                CHANNELS 3 Yrotation Xrotation Zrotation
                JOINT RightHand
                {
                  OFFSET 28.9001 0.0000 0.0001
                  CHANNELS 3 Yrotation Xrotation Zrotation
                  JOINT RightHandIndex1
                  {
                    OFFSET 8.0740 -0.1031 -2.5611
                    CHANNELS 3 Yrotation Xrotation Zrotation
                    JOINT RightHandIndex2
                    {
                      OFFSET 4.5805 0.0000 0.0000
                      CHANNELS 3 Yrotation Xrotation Zrotation
                      JOINT RightHandIndex3
                      {
                        OFFSET 2.8181 0.0000 0.0000
                        CHANNELS 3 Yrotation Xrotation Zrotation
                        End Site
                        {
                          OFFSET 1.3566 0.0000 0.0000
                        }
                      }
                    }
                  }
                  JOINT RightHandMiddle1
                  {
                    OFFSET 8.1366 -0.1031 -0.5450
                    CHANNELS 3 Yrotation Xrotation Zrotation
                    JOINT RightHandMiddle2
                    {
                      OFFSET 4.7024 0.0000 0.0000
                      CHANNELS 3 Yrotation Xrotation Zrotation
                      JOINT RightHandMiddle3
                      {
                        OFFSET 3.1016 0.0000 0.0000
                        CHANNELS 3 Yrotation Xrotation Zrotation
                        End Site
                        {
                          OFFSET 1.4991 0.0000 0.0000
                        }
                      }
                    }
                  }
                  JOINT RightHandPinky1
                  {
                    OFFSET 7.0181 -0.1030 3.1368
                    CHANNELS 3 Yrotation Xrotation Zrotation
                    JOINT RightHandPinky2
                    {
                      OFFSET 3.5541 0.0000 0.0000
                      CHANNELS 3 Yrotation Xrotation Zrotation
                      JOINT RightHandPinky3
                      {
                        OFFSET 2.2340 0.0000 0.0000
                        CHANNELS 3 Yrotation Xrotation Zrotation
                        End Site
                        {
                          OFFSET 1.1205 0.0000 0.0000
                        }
                      }
                    }
                  }
                  JOINT RightHandRing1
                  {
                    OFFSET 7.8068 -0.1030 1.4405
                    CHANNELS 3 Yrotation Xrotation Zrotation
                    JOINT RightHandRing2
                    {
                      OFFSET 4.3922 0.0000 0.0000
                      CHANNELS 3 Yrotation Xrotation Zrotation
                      JOINT RightHandRing3
                      {
                        OFFSET 2.8327 0.0000 0.0000
                        CHANNELS 3 Yrotation Xrotation Zrotation
                        End Site
                        {
                          OFFSET 1.3500 0.0000 0.0000
                        }
                      }
                    }
                  }
                  JOINT RightHandThumb1
                  {
                    OFFSET 2.0791 -0.1030 -2.7863
                    CHANNELS 3 Yrotation Xrotation Zrotation
                    JOINT RightHandThumb2
                    {
                      OFFSET 3.9619 0.0000 0.0000
                      CHANNELS 3 Yrotation Xrotation Zrotation
                      JOINT RightHandThumb3
                      {
                        OFFSET 3.0071 0.0000 0.0000
                        CHANNELS 3 Yrotation Xrotation Zrotation
                        End Site
                        {
                          OFFSET 1.7295 0.0000 0.0000
                        }
                      }
                    }
                  }
                }
                JOINT RightForeArmRoll
                {
                  OFFSET 14.0000 -0.0001 0.0001
                  CHANNELS 3 Yrotation Xrotation Zrotation
                  End Site
                  {
                    OFFSET 7.0000 -0.0001 0.0000
                  }
                }
              }
              JOINT RightArmRoll
              {
                OFFSET 13.5000 -0.0001 0.0000
                CHANNELS 3 Yrotation Xrotation Zrotation
                End Site
                {
                  OFFSET 6.7500 0.0000 0.0000
                }
              }
            }
          }
        }
      }
    }
  }
  JOINT LeftUpLeg
  {
    OFFSET 8.1000 0.0000 0.0000
    CHANNELS 3 Yrotation Xrotation Zrotation
    JOINT LeftLeg
    {
      OFFSET 43.2000 0.0000 0.0000
      CHANNELS 3 Yrotation Xrotation Zrotation
      JOINT LeftFoot
      {
        OFFSET 43.3000 0.0000 0.0000
        CHANNELS 3 Yrotation Xrotation Zrotation
        JOINT LeftToeBase
        {
          OFFSET 14.5727 0.0000 0.0000
          CHANNELS 3 Yrotation Xrotation Zrotation
          End Site
          {
            OFFSET 7.2864 0.0000 0.0000
          }
        }
      }
      JOINT LeftLegRoll
      {
        OFFSET 22.0000 0.0000 0.0000
        CHANNELS 3 Yrotation Xrotation Zrotation
        End Site
        {
          OFFSET 11.0000 0.0000 0.0000
        }
      }
    }
    JOINT LeftUpLegRoll
    {
      OFFSET 21.5000 0.0000 0.0000
      CHANNELS 3 Yrotation Xrotation Zrotation
      End Site
      {
        OFFSET 10.7500 0.0000 0.0000
      }
    }
  }
  JOINT RightUpLeg
  {
    OFFSET -8.1000 0.0000 0.0000
    CHANNELS 3 Yrotation Xrotation Zrotation
    JOINT RightLeg
    {
      OFFSET 43.2000 0.0000 0.0000
      CHANNELS 3 Yrotation Xrotation Zrotation
      JOINT RightFoot
      {
        OFFSET 43.3000 -0.0626 0.0000
        CHANNELS 3 Yrotation Xrotation Zrotation
        JOINT RightToeBase
        {
          OFFSET 14.5727 0.0000 0.0000
          CHANNELS 3 Yrotation Xrotation Zrotation
          End Site
          {
            OFFSET 7.2864 0.0000 0.0000
          }
        }
      }
      JOINT RightLegRoll
      {
        OFFSET 22.0000 0.0000 0.0000
        CHANNELS 3 Yrotation Xrotation Zrotation
        End Site
        {
          OFFSET 11.0000 0.0000 0.0000
        }
      }
    }
    JOINT RightUpLegRoll
    {
      OFFSET 21.5000 0.0000 0.0000
      CHANNELS 3 Yrotation Xrotation Zrotation
      End Site
      {
        OFFSET 10.7500 0.0000 0.0000
      }
    }
  }
}
Lufffya commented 1 year ago

How to set these parameters based on the above content?

groundplane_joint: LeftFoot
forward_perp_joint_vectors:
  - - LeftShoulder
    - RightShoulder
  - - LeftUpLeg
    - RightUpLeg
hjessmith commented 1 year ago

The groundplane_joint and forward_perp_joint_vectors above should work, as those are all valid joint names within the BVH skeleton you've shared.

You can find an explanation of what 'end_frame_idx` is here.

justinduynguyen commented 1 year ago

How to set these parameters based on the above content?

groundplane_joint: LeftFoot
forward_perp_joint_vectors:
  - - LeftShoulder
    - RightShoulder
  - - LeftUpLeg
    - RightUpLeg

it works for u, can u share workflow ?

Lufffya commented 1 year ago

@justinduynguyen It didn't work, it was too difficult for me to manually build motion and target configuration files based on the BVH skeleton files. I tried, but there were a series of errors It took a lot of time to read the relevant knowledge, and I have given it up. Maybe the official will release simple and easy-to-use features in future updates

justinduynguyen commented 1 year ago

@justinduynguyen It didn't work, it was too difficult for me to manually build motion and target configuration files based on the BVH skeleton files. I tried, but there were a series of errors It took a lot of time to read the relevant knowledge, and I have given it up. Maybe the official will release simple and easy-to-use features in future updates

check my solution, it worked for me. https://github.com/facebookresearch/AnimatedDrawings/issues/114#issuecomment-1515140684

hjessmith commented 1 year ago

Hi @Lufffya

I've added the configuration files needed to use motion obtained from Rokoko, along with example code calling it, to the README. You can see it here:

https://github.com/facebookresearch/AnimatedDrawings#creating-your-own-bvh-files

I hope that will help you.