Start work on full body inverse kinematic animation system

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Start work on full body inverse kinematic animation syst

Postby Julio Jerez » Mon Jan 21, 2019 10:38 am

I do agree with you that FBX is a extremally hard file format.
It seem liek a Frankenstein of format, what is more frustration is that you get diffrent results base of who you read a file, for example you get a complete different hierarchy if you read the nodes transform or if you apply an animation.
I followed the instruction in thsi docs,
http://docs.autodesk.com/FBX/2013/ENU/FBX-SDK-Documentation/index.html

and I managed to get a converter, but as soon as I try to get animations, the model you get when applying this recommendation to evaluate an animation is very diffrent that the one you get from their recommendation to load a mesh.
I know is I who is wrong, because when I load any BDX file in max the look correct, however file exported by the same Max plugin in look diffrent in other app like Blende or Assimp

teh problem I have with GLFT is that I when to the website to get information
https://www.khronos.org/gltf/

and the was not standard SDK, of Documentation all I saw was specifications, and new specifications.
ther was not Max plugin that can import and expert to 3dsMax.

what I do no like is that to figure out hwo something work, I have to download someone application and reverse engineer what the has done. that not what I do.
writing a Parcel for yet another grammar is not on my radar unless I can figure out the FBX secret which turn out to be harder than I anticipated.
Julio Jerez
Moderator
Moderator
 
Posts: 10989
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Start work on full body inverse kinematic animation syst

Postby JoeJ » Mon Jan 21, 2019 3:21 pm

Maybe assimp would be good enough for the job?
I have never used it for animation, but i see it has support: http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html
User avatar
JoeJ
 
Posts: 1147
Joined: Tue Dec 21, 2010 6:18 pm

Re: Start work on full body inverse kinematic animation syst

Postby Dave Gravel » Mon Jan 21, 2019 4:09 pm

Here I use assimp, It go very good for the animations and It can load multiple formats too.
My only real problem is to rebuild the nodes tree from the bodies matrices.
I'm not so sure what is the exact problem, I'm trying to find.
I have hard times to make the mesh fit with the bodies skeleton.
My skeleton from dynamics bodies seen to forget some parent matrices or it is a problem with some rotation i'm not sure.
I think i'm very close to get it with assimp, I can move some nodes without problem and the mesh following good.
From assimp you have the normal nodes, the animations nodes and the prerotation and rotation nodes.
I need to do more tests, I think my problem is because I don't use the prerotation,rotation nodes.
I have success to fix my tpose by using this prerotation, rotation nodes.
For get the tpose in place I need to play the animation one time just after the model load.
-
Maybe I need to use it for the ragdoll parts too, I'm not 100% sure.
I have already success to do ragdoll from a other mesh system, The method is similar with assimp but the result is very different when I try to rebuild the mesh from my bodies nodes.
Something is calulated differently about the nodes.
I'm not sure if this happen only with assimp and fbx model or with all model format from assimp.
I have read on the web many seen to have problem with assimp + animation + fbx format.
Here the animations seen to work very nice now.

Edit:
You can see here from my project with assimp.
https://sites.google.com/site/oxnewton/nodes.png
-
This is what I get currently, I have already get a bit better about the mesh result but it have always something wrong.
In this video I trying a other way but I don't have finish the implementation for now.
https://www.youtube.com/watch?v=faqoFe7vByI
-
The parent node don't use the normal node name from the bones info, Some parents use a node name tagged with PreRot and Rot info.
I need to test more but i'm pretty sure that is the problem for my project and for rebuild the mesh from my ragdoll nodes...
-
http://asgaard.co.uk/p/thesis
http://asgaard.co.uk/thesis/thesis.pdf
Not exactly related:
https://mediatech.aalto.fi/publications ... _video.mp4
https://mediatech.aalto.fi/publications ... ration.mp4
https://mediatech.aalto.fi/publications/graphics/C-PBP/
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 712
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Start work on full body inverse kinematic animation syst

Postby JernejL » Tue Jan 22, 2019 2:20 am

Maybe source code of fbx2gltf can be of some help - in the end on how to process structure (it uses autodesk's dbx sdk so it should be a good example how to process data properly), you could also convert fbx to gltf and compare gltf output to see when you got matrices and structure right.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1451
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Start work on full body inverse kinematic animation syst

Postby Dave Gravel » Tue Jan 22, 2019 2:53 am

You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 712
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Start work on full body inverse kinematic animation syst

Postby JernejL » Tue Jan 22, 2019 5:38 am

Dave Gravel wrote:Finally I got it now.
https://www.youtube.com/watch?v=Yxbo5M-ULYE


That's good work!!

Man, i didn't realize you were using lazarus too, and that OrionX3D is a pascal project - i've completely switched to lazarus for my project as well, it's really great tool for game development and is getting better with each version, some pascal projects lately are really pushing the boundaries (especially bero's work) - how are you using assimp with it? do you have working skinned animations done via assimp?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1451
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Start work on full body inverse kinematic animation syst

Postby Dave Gravel » Tue Jan 22, 2019 11:24 am

Hi JernejL thanks.
-
do you have working skinned animations done via assimp?

Yes : It's not my final version it is my first implementation test it need a good cleanup.
https://www.youtube.com/watch?v=bTJKEX2Znnc
Here the animations
https://www.youtube.com/watch?v=8F1wR9kXnvM
-
About assimp, When you download the assimp sdk you can find in the zip the pascal header.
I have already test this header and assimp working the same it as with c++ under lazarus.
-
About pascal yes and no, What you see in the video is only my editor part.
The main project is a plugin write in c++, This plugin initialize GL context, Lua, ImGui, Newton and more..
I have write all my dll export's for use assimp, lua, imgui, newton customjoint and more...
With my plugin it is not a obligation to use my c++ class and object pointer, I can exemple only init the plugin and use my plugin callback from lazarus project and use directly pure gl or newton commands or just write totally new class from lazarus compatible with the plugin.
-
I can use my plugin with 3 method.
Method 1: I can use my plugin and my c++ class and object.
Method 2: I can use my plugin only for initialize tools like gl, newton, imgui... and I can use my callback for do puregl or newton commands directly in lazarus.
Method 3: I can use a mix of both first methods.
The good thing for me with this plugin, When I write a new demo or project I don't need to rewrite all initialization parts from all tools. The plugin do it for me and I can start to code directly without redo all work again and again.
Or I can use all my class from Lua script too and build the scene via lua.
-
I have already seen some bero's works in the pass, If i'm not wrong he coding only in pascal objects.
He seen to have done a lot good works, Just I don't very like the code structuration it look like spaghetti code for me :? :oops:
Here I coding only in delphi mode and I prefered write my personal things or logics, The delphi class use more ressources system but it is a lot more readable and easy to use for me.
It's not very a good idea to mix pascal object, delphi and c++ It can become quickly a mess about the pointer the 3 languages use different class and pointer method.
Many of my code is write in lazarus delphi mode but it is c++ translation, I have some fun to reproduce c++ code under lazarus delphi mode.
I very love lazarus ide, I very love c++ too but my knowledge is better under delphi coding.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 712
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Start work on full body inverse kinematic animation syst

Postby JoshKlint » Tue Jan 22, 2019 12:15 pm

I have heard of assimp but did not know it supported FBX. Looking over their website, it seems those geniuses never thought that a list of supported file formats might be the first thing a potential user would be looking for. :roll:

Yes, GLTF is another overengineered disaster from Khronos, but it might be the best thing we have. The measure of a file format's usefulness is its adoption, not the ease of loading, consistency, or anything else.
JoshKlint
 
Posts: 74
Joined: Sun Dec 10, 2017 8:03 pm

Re: Start work on full body inverse kinematic animation syst

Postby Julio Jerez » Tue Jan 22, 2019 12:59 pm

to be clear. I am not saying there is something wrong the the FBX file.
My complaint was that the format is too extensive and has ambiguities that can lead to different parsing results.
for example if you load a file and you read the hierarchy you can get different matrices based on what options where applied.

you have inherited rotations, pre transform, post transform, inherit scale, rotation order, ect. there are about three dozen properties that you have to know about in oprder to get some result.
as a result most people call evaluate first frame of the animation and them read the transforms form teh skeleton. Even their samples code do it that way, which is a terrible misleading thing.

It is not evident immidailty that this is really bad until you get to the point where you need to load animations from different file. When this is the case setting the skelton to the first frame of the animation lead to different binding matrices depend of the animation you load.

thsi is why you see that almost every Game engine uses one FBX file with a one frame animation that they use to load the mesh and the binding pose. then a bunh of extra files where the only load the animation data.

This seems like a sound solution but in fatc is quite horrible because this defeats the first methof of evaluating the animation, now you not longer can play the animation to get the matrices because each matrix will be relative to a different binding frame (the one that is reference file) so you have to get dirty and get in the minutia of loading the animations curves.
it becomes a chicken and an egg problem.

I actulally did the same most engines do, which is align the skeleton of the base mesh so that I can load it. but is clear that is not a permanent solution.

I am now fixing that problem so that the skin mesh save the binding pose with the skin modifier, and this should solve the problem for all cases.
last weeked I start fix that problem and I am not longer use the trick of setting the skeleton to the first frame.

now I am adding the new property to the NGD format that will store the cluster binding matrioces and use that to calculate the skin.
this information is in fact provided in teh fbx SDK by this function
Code: Select all
/** Get matrix associated with the link node.
      * \param pMatrix     Transformation matrix to be filled with appropriate data..
      * \return            Input parameter matrix filled with appropriate data.
      */
    FbxAMatrix& GetTransformLinkMatrix(FbxAMatrix& pMatrix) const;


I just got confused because I was following their tutorial which do it by settimg the skelton to the first frame of the animation.

My guess if that that method probably works for most models since artist tend to skin a model by placing the skeleton aligned wich the mesh. I just happen to came across a model that does not.

if you downlod the SDK and run the current demo you will see how the arms and the mesh are very different. if I use that skelton to get the sking binding matrices then the mode is all distorted.
Julio Jerez
Moderator
Moderator
 
Posts: 10989
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Start work on full body inverse kinematic animation syst

Postby Dave Gravel » Tue Jan 22, 2019 2:12 pm

I have heard of assimp but did not know it supported FBX. Looking over their website, it seems those geniuses never thought that a list of supported file formats might be the first thing a potential user would be looking for. :roll:


8) The list is right in first place if you scrolldown a bit : https://github.com/assimp/assimp
Here the old list : http://assimp.sourceforge.net/main_feat ... rmats.html

you have inherited rotations, pre transform, post transform, inherit scale, rotation order, ect.

I'm not sure if i'm wrong about the way to do things.
Here I load all default nodes for the mesh, My ragdoll node is create with this default node.
From what I have seen all other nodes with prerotation or postrotation is always use with animation only.
I add all this nodes propreties in a other list with all childrens linked to it, When I do my scan for get my node info I get my info from this list and not from the default nodes list.

Edited:
If someone like to see or test my current demo.
You can find the download link in the video description.
https://www.youtube.com/watch?v=gEO1uXYM8Mk
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 712
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Start work on full body inverse kinematic animation syst

Postby Julio Jerez » Fri Jan 25, 2019 8:02 am

Edited:
If someone like to see or test my current demo.
You can find the download link in the video description.
https://www.youtube.com/watch?v=gEO1uXYM8Mk

that's really cool.

I too now have the proper skin base pose from any file, so now ther is no nee to make a special model with a one frame animation to get the base pose.

the trick is in using this funtion to get the base pose
Code: Select all
    FbxAMatrix& GetTransformLinkMatrix(FbxAMatrix& pMatrix) const;


my mistake what that the base pose matrix is in global space, so it has to be transformed by the invert of the parent.
now the FBXtoNDG tool does the correct conversion.
I commited the test the changes, ther is still a memory leak because I have not completed the cluster processing to get the weight, I just want to see if setting the skeleton to the skin base pose was goin to work, and now it does.
so not afte getting the weight and animation we are ready to move on.

Dave that demo that you show there, will be very cool for testing the IK module. basically they it will do some similar by when you pick a node and move it around it will alter the intermediate appropriately according to the constraints restrictions. at least that the goal of this experiment, but I have high hope.
Julio Jerez
Moderator
Moderator
 
Posts: 10989
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Start work on full body inverse kinematic animation syst

Postby Dave Gravel » Fri Jan 25, 2019 11:19 am

Hi Julio,
Nice for the find and fix.
Here if you need a other free model for test.

The model that you use in the sdk use mixamo rig added from me,
I don't have test this new free model, I'm not sure about what they have use for the rigging.
https://renderpeople.com/free-3d-people/
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 712
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Start work on full body inverse kinematic animation syst

Postby Julio Jerez » Fri Jan 25, 2019 1:29 pm

Dave Gravel wrote:The model that you use in the sdk use mixamo rig added from me,

Dave are you saying you made thsi model yourself?
is so that that is awesome.
I see one similar to the one I am using, is that the same texture or something.
In any case thsi model is good enough for the prototyping.
Julio Jerez
Moderator
Moderator
 
Posts: 10989
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Start work on full body inverse kinematic animation syst

Postby Dave Gravel » Fri Jan 25, 2019 1:36 pm

No no, I just have import it in mixamo tool for generate the rigs.
The model is from renderpeople, Now it coming with the rigs already.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 712
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Start work on full body inverse kinematic animation syst

Postby JoeJ » Fri Jan 25, 2019 1:37 pm

Dave Gravel wrote:No no, I just have import it in mixamo tool for generate the rigs.
The model is from renderpeople, Now it coming with the rigs already.


I just wanted to post the link :) https://www.mixamo.com/#/
User avatar
JoeJ
 
Posts: 1147
Joined: Tue Dec 21, 2010 6:18 pm

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 9 guests

cron