Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello, long time no see, wanna ask a question #12

Open
lucasjinreal opened this issue Oct 24, 2022 · 8 comments
Open

Hello, long time no see, wanna ask a question #12

lucasjinreal opened this issue Oct 24, 2022 · 8 comments

Comments

@lucasjinreal
Copy link

Hi, recently I start tackling the retarget problem.

I have the output in SMPL model format, which is quaternion based on SMPL, then I want apply these animation to Mixamo model.

But Mxiamo skeleton is different than SMPL (not bone names, buthe the bone orientation also different).

Do u know how can I retarget the animation to mixamo? (by given the source animation and 2 model smpl & mixamo)

@Nor-s
Copy link
Owner

Nor-s commented Oct 24, 2022

Yes, I've done something similar.

Bone names just map, The orientation needs to be recalculated with matrix calculations.

The formula:

New animation = (New Animation Binding)^-1 * (New global parent)^-1 * (global Parent) * (Animation Binding) * (animation) * (global bind offset) * (new global bind offset)^-1

This seems to work well for models with different orientations among mixamo models.

@Nor-s
Copy link
Owner

Nor-s commented Oct 24, 2022

The new binding pose can be calculated as:

  1. Get R, S of the binding pose of the target model

  2. Take the coordinates relative to the parent bone as T in the existing global coordinates

  3. new binding = TRS

@lucasjinreal
Copy link
Author

lucasjinreal commented Oct 24, 2022

@Nor-s hi, thank u for the reply, do u have an example for this? How should I get the R and S from a SMPL model and a Mixamo model in FBX format?

@Nor-s
Copy link
Owner

Nor-s commented Oct 24, 2022

@jinfagang

see src/utility.h DecomposeTransform

T, R, S = DecomposeTransform(local bindpose)
"local bindpose" is "assimp aiNode::mTransformation"

And I wrote sample code for my editor.
(same mixamo name, different bone orientation)
( Here, PoseComponent holds source animation information and target character information.)

Sorry for the dirty code.

@Nor-s
Copy link
Owner

Nor-s commented Oct 24, 2022

example

I haven't tested SMPL because I don't have an SMPL model,
but this is the result of retargeting different orientation Mixamo models.
(But for now, Mixamo has updated them, they all have the same bone orientation.)

before

retarget_before

after

retarget_aft

@lucasjinreal
Copy link
Author

@Nor-s thank, does there a way make your code buildable on macOS? I wnanna have a try, this seems exactly what I need

@Nor-s
Copy link
Owner

Nor-s commented Oct 25, 2022

@jinfagang

sorry. I'm currently only trying the silicon version (m1),
so I don't know if it will work correctly. Also the animations can be weird like you did before.

To build embedded Python, you need to configure your environment according to this document

Setting up the embedded Python environment seems too difficult.

I configured the environment with this command.

  • Clang 13.0.0 arm64-apple-darwin21.2.0
  • Python 3.10 and newer
  • Homebrew 3.5.9
xcode-select --install
brew install pkg-config openssl@1.1 xz gdbm tcl-tk
git clone --recursive https://github.com/Nor-s/Anim.git
cd Anim

mkdir build
cd build
cmake ..
make

if u intel version
You will need to modify the following:
scripts/build_python_osx.sh

./pip3 install mediapipe-silicon

=>

./pip3 install mediapipe

@lucasjinreal
Copy link
Author

@Nor-s hello, I am exactly Sillcon version M1 mac. But you needn't build arm python yourself. Using mini-forge can have a arm python in conda.

Have you tride that? this can be more universal since usally users have python in conda.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants