dem-bones icon indicating copy to clipboard operation
dem-bones copied to clipboard

Animation of the skeleton fitted to mesh animation with only rotation change in each keyframe

Open ArcaneShadow82 opened this issue 2 years ago • 8 comments

Hi, First, I want to say that I'm very impressed with DemBones solution and its possibilities. I'm wondering if it is possible to obtain the output animation of the RIG with changed only the rotation in the joints (translation would be only applied to the root). From the documentation of the parameters, it is not obvious to me how to achieve this. There is a demLock parameter, but it seems to lock the whole transformation of the joint in the animation.

ArcaneShadow82 avatar Apr 02 '22 12:04 ArcaneShadow82

The solution of Dem Bones (SIGGRAPH Asia 2012 paper) is solving the global transformations and then converting them to joint transformations (with the input hierarchy). As the result, Dem Bones does not preserve the length of the bones (or local joint translations are changed on each keyframe).

At this point, I can suggest a cheat (ugly solution?) to achieve translation lock is undoing the translation update of Dem Bones. It can be done by overwriting the old translation values, either by post scripts or a hack into https://github.com/electronicarts/dem-bones/blob/bb4ea9f391c4be9abe4f85a407c2c47979bad959/src/command/FbxWriter.cpp#L198 (just add something like: lt = lbt.replicate(model.nF, 1); // Assigning translations by copies of the bind pose and also, need to run with bindUpdate=0)

The cheat above will obviously not minimize the reconstruction error. Logically, implementing optimal translation lock would require the solution in the SIGGRAPH 2014 paper. Dem Bones (current version) does not implement this feature (due to low demand - as my personal observation).

binhhuyle avatar Apr 04 '22 07:04 binhhuyle

Thanks for the response! I'll try the ugly hack. The translation lock feature could be interesting for weights optimization in the animation on character RIGs with fixed bones structure. In Your opinion, how much effort it would be to implement this additional translation lock feature as in SIGGRAPH 2014 paper? I'm potentially interested in contributing to implementing this, but I'm not too familiar with the DemBones code.

ArcaneShadow82 avatar Apr 04 '22 09:04 ArcaneShadow82

Technically, the data structures is ready for adding translation lock so implementation will not be difficult. If you can help with testing, I think I can do the implementation. Would be perfect if you could provide me some test cases (failure cases are especially important). However, in a case that you have difficulty with disclosing the assets, it will be nice if you could run the tests and describe the issues.

binhhuyle avatar Apr 08 '22 17:04 binhhuyle

The solution of Dem Bones (SIGGRAPH Asia 2012 paper) is solving the global transformations and then converting them to joint transformations (with the input hierarchy). As the result, Dem Bones does not preserve the length of the bones (or local joint translations are changed on each keyframe).

At this point, I can suggest a cheat (ugly solution?) to achieve translation lock is undoing the translation update of Dem Bones. It can be done by overwriting the old translation values, either by post scripts or a hack into

https://github.com/electronicarts/dem-bones/blob/bb4ea9f391c4be9abe4f85a407c2c47979bad959/src/command/FbxWriter.cpp#L198

(just add something like: lt = lbt.replicate(model.nF, 1); // Assigning translations by copies of the bind pose and also, need to run with bindUpdate=0) The cheat above will obviously not minimize the reconstruction error. Logically, implementing optimal translation lock would require the solution in the SIGGRAPH 2014 paper. Dem Bones (current version) does not implement this feature (due to low demand - as my personal observation).

I meet the same problem. I think the cheat maybe just lock transform when writing fbx file, it would not lock the length of bones when optimization. So the translation and rotation is not we want.

huhai463127310 avatar Apr 13 '22 09:04 huhai463127310

@binhhuyle I have send a case for you by email. please check your gmail box. And I can help testing your implementation.

huhai463127310 avatar Apr 13 '22 09:04 huhai463127310

The solution of Dem Bones (SIGGRAPH Asia 2012 paper) is solving the global transformations and then converting them to joint transformations (with the input hierarchy). As the result, Dem Bones does not preserve the length of the bones (or local joint translations are changed on each keyframe). At this point, I can suggest a cheat (ugly solution?) to achieve translation lock is undoing the translation update of Dem Bones. It can be done by overwriting the old translation values, either by post scripts or a hack into https://github.com/electronicarts/dem-bones/blob/bb4ea9f391c4be9abe4f85a407c2c47979bad959/src/command/FbxWriter.cpp#L198

(just add something like: lt = lbt.replicate(model.nF, 1); // Assigning translations by copies of the bind pose and also, need to run with bindUpdate=0) The cheat above will obviously not minimize the reconstruction error. Logically, implementing optimal translation lock would require the solution in the SIGGRAPH 2014 paper. Dem Bones (current version) does not implement this feature (due to low demand - as my personal observation).

I meet the same problem. I think the cheat maybe just lock transform when writing fbx file, it would not lock the length of bones when optimization. So the translation and rotation is not we want.

@huhai463127310,

This cheat locks the translate parts of the joints. But as the joints are organized in a hierarchy (skeleton), that is the same as locking bone lengths.

And I have received your email.

binhhuyle avatar Apr 15 '22 18:04 binhhuyle

Technically, the data structures is ready for adding translation lock so implementation will not be difficult. If you can help with testing, I think I can do the implementation. Would be perfect if you could provide me some test cases (failure cases are especially important). However, in a case that you have difficulty with disclosing the assets, it will be nice if you could run the tests and describe the issues.

That would be great. I can provide You a synthetic animation with noised rotation angles to test transformation estimation without translation change. This would be helpful?

ArcaneShadow82 avatar Apr 16 '22 08:04 ArcaneShadow82

Hi. @binhhuyle - is there any chance to add this feature in the nearest feature?

MrCairo90 avatar Aug 25 '22 13:08 MrCairo90