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

auto_rig seems to only work with mesh files and template skeleton #1

Open
RomanPerrin opened this issue Jul 18, 2023 · 2 comments
Open

Comments

@RomanPerrin
Copy link

The auto_rig function requires a skeleton object and a mesh object.
The only way for it to return any data is by giving it a pyn.Mesh(file). feeding a mesh's data directly to pyn.Mesh(), even if they're the same as the file's, doesn't work. (workaround is to create a temporary obj, could be worse, not a big deal).

2nd bigger issue: it doesn't work with custom skeleton.
given correct data (very similar to a template) or a file, pyn.auto_rig() returns no data.

mesh = pyn.Mesh(f'{path}/temp.obj')
#skeleton = skeletons.HumanSkeleton()
skeleton = pynocchio.skeletons.FileSkeleton(f'{path}/skeleton1') 
print('given', skeleton.vertices)
print('given', skeleton.parent_indices)
attach = pyn.auto_rig(skeleton, mesh)
data = attach.embedding
print('output', data)
given Points[[0, 0, 0], [0, 1, 0], [0.07, 0, 0], [0.08, -0, -0], [0.18, -0, -0], [0.1, -0, -0], [0.055, -0, -0], [0.065, -0, -0], [0.15, -0, -0], [0.01032, 0.07065, -0.02031], [0.09832, 0, 0], [0.15629, 0, -0], [0.18235, 0, -0], [0.10207, 0, -0], [0.01032, -0.07065, -0.02031], [-0.09832, 0, -0], [-0.15629, -0, -0], [-0.18235, -0, -0], [-0.10207, 0, -0], [0, 0.08087, 0], [0.45989, 0, 0], [0.54273, -0, -0], [0.10073, -0, -0], [0.0688, -0, -0], [0, -0.08087, -0], [-0.45989, 0, 0], [-0.54273, -0, -0], [-0.10073, 0, -0], [-0.0688, 0, -0]]
given Indices[-1, 0, 1, 2, 3, 4, 5, 6, 7, 4, 9, 10, 11, 12, 4, 14, 15, 16, 17, 1, 19, 20, 21, 22, 1, 24, 25, 26, 27]
output Points[]

Do you know how to make it work?
I'm making an auto rig for maya and having 80% of the joints placement done would be great.

@alexanderlarin
Copy link
Owner

Hi, @RomanPerrin

I'm really surprised that anyone uses it! Of course I could help you if you share your files required to reproduce the issue such as mesh file, skeleton file and minimal sample code.
I'm sure that we could find workaround or resolve the problem with bugfix.

@RomanPerrin
Copy link
Author

Hi,
It's the only model that lets me embed a given skeleton in a given mesh. As far as my research goes, all the other models generate a skeleton. If you know of any other mean to do that please share.

Here's the skeleton file I generate from maya's data (if you don't know, think blender 3D):
skeleton1.txt
and the mesh file (added txt extension since github won't accept obj):
temp.obj.txt

you can try those files with the code snippet in the original message.


skeleton = pyn.skeletons.SkeletonBase() #creates pynocchio skeleton object
    for joint_data in ordered_skeleton_data: #adds joints to the pynocchio skeleton object
        skeleton._make_joint(name = joint_data['name'],
                            position = pyn.Vector3(joint_data['position'][0],joint_data['position'][1], joint_data['position'][2]),
                            previous = joint_data['parent'])
skeleton._make_compressed()
print(skeleton.vertices)

This prints the same data as

skeleton = pynocchio.skeletons.FileSkeleton(f'{path}/skeleton1.txt') 
print(skeleton.vertices)

so it should work the same. but...

skeleton = skeletons.HumanSkeleton()
print(skeleton.vertices)

...this prints the same thing as well (not exact data but structure)
The only difference is that HumanSkeleton is "contained" within -1 and 1.

So after scaling my skeleton to be within -1 and 1, I get:
image
So it worked sort of...
The output data is disgusting but it did something. Any idea on how to have a better embedding?

I think i found a way. Look at that:
image

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