Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

153 Neutral

About Endgegner85

  • Rank
  1. Hello,  :)   Thank you very much. You've helped me!  ^_^   I use a small tool to convert FBX files into my own custom file format. The files are then post-processed by a second tool. The result is then used by my game. Therefore, I always can make sure I only have files in a proper format without any errors. The data structure I use for skeleton joints have an enum containg the joint's type. In my post-processing tool, I take the joint's name and check a dictionary for the proper enum item. A name of "B_R_UpperArm" will be a "Right Upper Arm" for example. Since I bought a few massive animation packs I don't have that many different joint names for each joint.   When looking at the skeleton tree, the leaves do not concern me, as you mentioned BBeck. If I have toes in my mesh, but not in my animation, I can simply use the foot's animation for the toe. I can do the same vice versa and discard animations for toes, if my mesh does not have any.   My main concern way about my spine example. I searched online for the term "Animation Retargeting" as Hodgman mentioned and I found some nice tutorials about how to do it.   I will make some management work in the next days and make a list of all animations I will need for the very first version of my game. Then, I will check which animations are already available in the resource packs I bought online and check their skeletons. If these skeletons mainly match, I am fine. Since I need to hire someone to create the models for me, I can tell him which skeleton he shall use for rigging.
  2. Hello!  :)   I bought a resource pack online which contains a huge set of skinned animations in the FBX format. My converter which converts FBX files into my own custom file format is already able to process a lot of information and even animations already work. However, so far I only dealt with FBX files which contained a single animation. Therefore, I could "simply" use the EvaluateGlobalTransform function to get the transformation from my cluster's linked node at a given time.   However, (as far as I can see) this approach fails with multiple animation stacks, because I can't select which animation stack shall be used. From a sample of the FBX SDK I know there is another way to get animation information by using the LclTranslation, LclRotation and LclScaling properties of a given node and a given animation layer. My problem is, that I have no glue what the result vectors mean. Sure, I get a translation, rotation and scaling for each joint for each of my animations for each key time. However, I do have any idea on which level this transformation is. So, which other transformations do I need to consider, for example.   So, my question is: How do I process multiple animation stacks in a FBX file correctly? What I would love to have is the global transformation matrix of a given joint, at a given time using a given animation layer (of a given animation stack).
  3. Hello guys,   I am still working on my game and its custom game engine. I am able to process files like FBX and extract all information I need for my game engine into my custom file format (mesh, materials, animations, textures, ...). Since I am working alone on my project and my 3D modelling skills are bad (I mean really really bad), I buy my assets online or hire artists to create models and animations for me.   I recently bought two resource packs online which contain almost all animations I am going to need for my game. I also downloaded several 3D humanoid models for testing. My problem is, that the skeletons do not match. Sometimes three joints / nodes are used for the spine in the skeleton or in one case there were joints for eyes. In another case, there were sub-joints for the toes of the model. Most parts of the skeleton are the same, but not the entire skeleton.   My question is pretty general: How do I map animations for a given skeleton to a mesh using a similar but not identical skeleton?   I mean, humanoid skeletons always have a head, arms, legs, etc. But what shall I do, if I have joints in my mesh skeleton which are not available in the animation skeleton?
  4. Hey guys, I just wanted to let you know that I was able to solve my problems with the animation system. I am now able to load FBX files, extract the animation information and animate the imported mesh with almost no CPU or memory load. It was quite a tough way, but I am very happy with the result. Now, I am working on re-targeting animations, i.e. to make it possible to use animations I import for one mesh on other meshes. It will take some time to make it fully work, but I think I can finish this until the end of next week, if everything goes well.   It does not make much sense to post any code here, since I did not do a big single mistake, but had to touch my source code at many places. But, if anyone of you needs some help with animations, I'd like to help  :)
  5. Thanks, iedoc! I wondered where I missed something or where I made something wrong. Your answered helped me very much, but I still have troubles.   I have updated my Vertex Shader to: PS_IN VS(VS_IN input) { PS_IN output = (PS_IN)0; output.col = input.col; output.TextureUV = input.TextureUV; // Calculate position. matrix worldViewProjection = mul(transpose(World), mul(View, Projection)); float4 test = mul(input.anim, /* TODO */ input.pos); output.pos = mul(test, worldViewProjection); return output; } This Vertex Shader produces the result shown in the image at the bottom of this post. The World-View-Projection matrix is applied correctly and also my joint matrices work. As far as I understood from your post and from reading this guide http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/how-to-work-with-fbx-sdk-r3582 again, I miss the projection from my vertex to joint space before applying the joints' matrices.   The author of the guide above wrote the equation VertexAtTimeT = TransformationOfPoseAtTimeT * InverseOfGlobalBindPoseMatrix * VertexAtBindingTime I have the TransformationOfPoseAtTimeT, which is matrix I calculated for my joints. I also have VertexAtBindingTime. This is the vertex I read from the FBX file. So, the missing part is InverseOfGlobalBindPoseMatrix. This part should be inserted into my Vertex Shader at position "TODO" (see code above), if I understood everything correctly. I have read this matrix from the FBX for each joint following the guide and I made sure, that my converter was able to obtain exactly the matrix that was written in the FBX file. I tried to apply this matrix in my vertex shader at the location "TODO", but I led to strange results. The result basically looked like a big chunk of something weird.   In my updated code, I calculated the InverseOfGlobalBindPoseMatrix for each vertex, by weighting the InverseOfGlobalBindPoseMatrix of each linked joint. I did it the same way as for the TransformationOfPoseAtTimeT. However, I am note sure, if I also have to consider the InverseOfGlobalBindPoseMatrix of a joint's parent joint? Is this information final for each joint or do I need to consider the InverseOfGlobalBindPoseMatrix from parents?   I feel like being really close to the solution, but it seems I am still stuck. :-/   I did not do this model by myself, iedoc. I got it from an online store. I write an extensive log file for each model I am converting from FBX to my own file format and I can easily find the name of joints. :-)  
  6. Hello,   I worked on some other topic in the last two weeks to clear my mind and now I am working again on my animation system. Until now I tried to update all joints at once, e.g. to show a key frame in the animation or to show the initial pose of the model.   Now, I took another approach by just setting the world matrices of a few selected joints. My CalculateMatrix function was edited to: SharpDX.Matrix result = SharpDX.Matrix.Identity; if (Name.Equals("Bip001 Head")) result = SharpDX.Matrix.Translation(new SharpDX.Vector3(0.0f, 2.0f, 0.0f)); else if (Name.Equals("Bip001 R Forearm")) result = SharpDX.Matrix.RotationX(Helper.Math.DegreeToRadian(90.0f)); else if (Name.Equals("Bip001 L Foot")) result = SharpDX.Matrix.Scaling(2.0f); if (Parent != null) result = SharpDX.Matrix.Multiply(result, Parent.CalculateMatrix()); return result; That means, the head is translated, the right forearm rotated and the left foot is scaled. I also updated my vertex shader to this: PS_IN VS(VS_IN input) { PS_IN output = (PS_IN)0; output.col = input.col; output.TextureUV = input.TextureUV; // Calculate position. matrix w = transpose(input.anim); matrix v = transpose(View); matrix p = transpose(Projection); matrix mat = mul(w, v); mat = mul(mat, p); output.pos = mul(input.pos, mat); return output; } That means, the normal world matrix which contains the position information of my model is no longer used. Instead of using the world matrix of the model, I use the calculated JointPosition of my vertices. As I explained in the initial thread, this property is calculated for each vertex by summing up the weighted local matrices of all joints.   The result of my changes can be seen in the image at the bottom of this post. The form of each part (head, foot and forearm) is correct. Also, the inheritance of parent's joint information does also work. When I look at the image, I would say, that the rotation and scaling is not done around the origin. What do you guys think? What can be the source of this strange appearance? At the moment, I am only multiplying the JointPosition with the view and projection matrix.    
  7. Endgegner85

    Mesh format?

    Hodgman and BBeck already answered your question regarding the format and performance. I just wanted to give you another point of view about file format converters. I started months ago developing my own video game including my own game engine and when I came to the point where I needed to import models, I was thinking about writing an exporter for 3D tools to write the information I need into my own custom file format.   I liked this idea very much, but I didn't do it! Instead, I wrote a small application which reads files I need and converts them into my own file format. I chose this option, because I suck in 3D modelling. I knew from the very beginning, that I will need to buy the models I need online or to hire 3D artist to do stuff for me. My game and its engine is still in development, i.e. while adding new features to the game I sometimes need to add features to the game engine. When you have a FBX file from an artist which contains everything you might ever need (mesh, texture and material information, skeletons, animations, lights, cameras, ...) you can keep the single file as a data source and adjust your file format converter over time. When you need something new, you can improve your converter and re-run the application and you are done.   If you want to use an exporter for 3D tools, you must make sure that your exporter works with the tools your artists are using. And when you need new data in your game (engine) and you adjust your exporter, you need to re-export all your models. This is fine, if you have all 3D projects on your machine. But this could be a problem, if you don't have access to the projects.   I my case, I am still convinced, that writing a converter was the right choice for me. I am currently stuck in the animation part of my game engine (see my other thread). But since I am getting my assets from online stores and external artists, I can use my file format converter in a batch to update all my assets at once.
  8. As far as I can see this thread has over 420 views, but no answer so far. Since I do not have a clue where my problem is, I'd be happy about any help. It would help me, if someone can ensure me, for example, that my overall idea is correct. Or if anyone can agree on my Vertex Shader, that would also help. Anything that helps me to reduce the possible error sources is more than welcome!  :)
  9. Dear community,   I started developing my own video game and my very own game engine some months ago. I made some good progress and I was able to realize everything I wanted so far. Sometimes I needed some online research, but I figured everything out after some time. Now, I am totally stuck. I do not know whether I did something wrong in my concept or if I am on the right path and I just have a minor bug. I am thankful for any help!   I wrote a C++ application, that is able to read FBX files (using Autodesks FBX SDK) and write all the information I need into a custom file format I designed for my game (engine). I am able to convert meshes, material and texture information and some more stuff into my file format and I can display all meshes properly in my game. I bought quite some stuff for the game and everything renders fine! Now, I want to extend my file format, the FBX file converter and my game engine to support skinned animations.   I read several online articels, like http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/how-to-work-with-fbx-sdk-r3582, http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/skinned-mesh-animation-using-matrices-r3577, book chapters, and many more and I think I understand the concept.   Data structures   I have added a new data structure for joints. Each joint has a name, stores its local transformation (translation, rotation, scaling) and has a set of children joints. Each of my mesh's vertices has a set of weighted links to joints.   So, every vertex knows the joints which affect the vertex's position including their weights. And each joint knows his place in the skeleton hierarchy (parent joint / children joints) and its local transformation.   What I wanted to do   I have already read and converted the Animation Stack including all Key Frames in the FBX file. However, before starting with the animation itself, I wanted to be able to show the model in its initial pose. I imported the FBX file in Unity first to make sure, that the FBX file is valid and to know how the initial pose looks like.   How I tried to do it   Every vertex in my mesh has a set of weighted links to joints. I wanted to calculate the vertex's position of the initial pose in a local world matrix I called JointPosition. Each vertex has its own JointPosition which is calculated using the weighted links (see below). Finally, I calculate the position of the vertex like this in my vertex shader: struct VS_IN { float4 pos : POSITION; float4 col : COLOR; float2 TextureUV : TEXCOORD0; matrix anim : INSTANCE; }; PS_IN VS(VS_IN input) { PS_IN output = (PS_IN)0; output.col = input.col; output.TextureUV = input.TextureUV; // Calculate position. matrix w = transpose(mul(input.anim, World)); matrix v = transpose(View); matrix p = transpose(Projection); matrix mat = mul(w, v); mat = mul(mat, p); output.pos = mul(input.pos, mat); return output; } anim is the calculated JointPosition and p is the vertex's position which was read from the FBX file.   As far as I understood, the Transformation Link Matrix contains the local position information for each joint (with FBX SDK: currCluster->GetTransformLinkMatrix(transformLinkMatrix);). I store the translation, rotation and scaling vector of this Transformation Link Matrix in every joint.   In order to calculate the JointPosition of a vertex, I use: SharpDX.Matrix matrix = new SharpDX.Matrix(0.0f); foreach (var jointLink in JointLinks) matrix += jointLink.CalculateMatrix(); JointPosition = matrix; Where each joint link multiplies its weight with joint's world matrix: public SharpDX.Matrix CalculateMatrix() { return Weight * Joint.CalculateMatrix(); } I use the following code to calculate joint's world matrix. I create the world matrix by multiplying the scaling, rotation and translation matrices using the vectors I got from the FBX files. The if-statement is required since some nodes have an invalid scaling vector. If a joint has a parent, I multiply its world matrix with its parent's world matrix, because the movement of a joint affects the position of all sub-joints. SharpDX.Vector4 t = LinkTranslation; SharpDX.Vector4 r = LinkRotation; SharpDX.Vector4 s = LinkScaling; if (s.X == 0.0f && s.Y == 0.0f && s.Z == 0.0f) return SharpDX.Matrix.Identity; SharpDX.Matrix result = Helper.Converters.ToMatrix(t, r, s); if (Parent != null) result = SharpDX.Matrix.Multiply(result, Parent.CalculateMatrix()); return result; What I got   Well, the result looks pretty messed-up. :'-(   If I replace the last source code fragment with the Identity matrix, I see my mesh with the default pose, i.e. in a pose which is not affected by the joints of the mesh.   I thought I understood the concept of Skinned Animation, but I must have messed up something, because the result looks like a large blurry junk pile.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!