hi all,
I'm trying to create a simple animation of a leg.
The leg would be made out of two parts and each part would be a mesh (could be just Mesh.Cylinder).
I know how this should work in principle but when I have to calculate the matrices all goes wrong...
Here's my idea:
Given the angles of rotation for both parts rotate and position the upper part (which will maybe be someday connected to a torso)
then rotate the lower part and connect it to the first one...
Could someone give me a simple example of how to correctly multiply the matrices in order to achieve the desired result
thank you,
sa o

Animating a leg
JacksonJones
I'm really not that far from a beginner myself and I've heard each and every one of those arguments many times before.
Before I reply to each of them let me ask you this: If you were about to write a winforms app would you i) Open Visual Studio and say new winforms project and press f5 and see a window appear or ii) Open notepad and create a C program that calls CreateWindow, makes a message proc and handles the messages and several hours later have the window. I'm not sure of your background or skill set but by not using the code that is prewritten for you you are choosing #2. Sure I think its great to learn all of these things EVENTUALLY but as a beginner game programmer you already have enough stuff to learn so why not use the code that is out there.
All reasons why you should concentrate on the important things like 3d concepts, game architecture and the insane amount of math involved.
Its smaller than the .Net framework, its smaller than Managed DirectX itself - yet few people complain about those being too big an complex.
Now this I don't disagree with and is, in my opinion, the biggest reason people avoid the framework. It is less documented thatn Managed DirectX itself (which is saying a lot!). The other valid reason, again in my opinion, is that is conforms too closely to the C++ version of the framework and doesn't feel quite .Net like. I assume this is due to the lack of MS resources for MDX and I hope things will change here with the XNA framework.
email directx@microsoft.com ! I agree with you here and thats why I try to keep a full list of tutorials up to date on the ZBuffer. You have to remember that DirectX is pretty much a specialist API used by pretty specialist developers so there is not the same market for training and books etc that there is for otehr stuff. By introducing MDX they have opened the doors to people who have different expectations for an API.
Of course neither do I - I'm certainly in the minority for people who use the framework (notice I never say LIKE to use the framework.... I would prefer it to be different too.
I would *love* to know what that opinion is, but I think we've probably taken this discussion far outside waht should happen in a forum already so if you want to discuss more then drop me an email - its in my profile.
licheca
Yes thats the theory. Each bone maps to a set of vertices that it influences. Move the bone and those vertices move with it. If you have problems exporting make sure it works first in DirectX viewer. If it does then your code is the problem and you should ask in here. If DXviewer doesn't animate it then the export is the problem and you should ask in the artist forum on gamedev.net
TecToc
JuanManuelC
Hello again...
I modeled a skinned person and have exported it to X format...
Using the SimpleAnimation sample I got it working on a Form but I still have one (final) question...
Since I'm not using the Framework how do I rotate the entire Mesh
For example If I wanted to add rotation of the model with the mouse
Fagutish
Thanks so much for your answer...
What I need is a simple animation of a person. The person will be very simple:
static head (could be just a sphere), static torso (could be a box), arms (each made out of two parts) and legs (again, each out of two parts - all could be simple cylinders).
I would like two things: the model would (sort of) walk and (sort of) run and I would like to move the rotate the camera around it.
Probably simple for someone who is skilled in directX but for me it seems like Mission Impossible :)
The SimpleAnimation looks great but the model is a bit too much for me :)
So... what do you recommend Do you know of such an example or do you know of a tutorial that would show me how to make a simple skin like that
PLCweaver
So guess I'll have to re-learn Maya :)
I don't have much time to do this animation so I might end up using tiny.x but I would much rather have a very simple mesh-person such as I described it...
because tiny.x doesn't fit in with the look of the app we are making (it's a student app for a college project so I decided to put in some directx to make the app look better)
do you know of any such models Or a website where they have models
Herwin Grauel
I will definetely check out your tutorial (tomorrow... since it 12:30 over here :) ).
I did look at the Simple Animation... and rendering the mesh seems not so difficulty so I guess the difficult bit is in creating the mesh...
And coming to that, I did experiment a little with Maya a while back and I remember playing with bones there. So if I would create an animation of the entire movement in Maya (include bones, ...)
and export it to an .X file... it should work Or should I use any other tools
Ramrakhaini Shanker
kxp
ZMan,
Perhaps I can enlighten you then as to the inner workings of the beginner game programmer, something that realistically, I myself am. Sure I've been dabbling for a good 15 years or more, but I really haven't got that far, I've always had a job and no comp science degree, so my priorities are always elsewhere... but thats all another matter.
The beginner is typically trying to learn the language at the same time as they are learning game programming. Even someone like myself who does C# web development for a living, finds new language constructs and libraries every day that I just think "where in the world did that come from and why haven't I seen it before "
The beginner always has trouble absorbing large amounts of new information quickly, especially new concepts. There are many new concepts when working with directx when you haven't done any graphics programming before.
I took one look at the framework and was baffled beyond belief. I spent about a week trying to work my way through endless class redirection after redirection looking to see how the guts of the system worked so that I could fit it into my own understanding of how everything works. I tried to take blocks of code and classes to see how they worked and interacted to see how I might be able to utilise them from the framework. I just couldn't do it. Every class had another sub layer in another file. Lots of scrolling. Oops now I forgot what I was looking for and why I was looking for it...
It all came down to size. The sample framework is too big. It's too complex. It does not facilitate learning of the fundamentals. Sure, it might be great for experts and people who understand all the concepts, but there are many of us out there that don't fall into that category.
It's easier for the novice to take the 6 tutorials and work from there. They're short, but have enough information to make them useful. They're not perfect but you can work around them. It's much easier for a beginner to learn from these than it is for them to dig through the framework sdk and be baffled as to the myriad of things the need to do in order to setup an application. They can proceed from there to learn about individual topics and apply them to there app when they feel they understand them. Perhaps Microsoft could spend some time adding small tutorials to the SDK on the more advanced topics. I know there are books to buy, and I hold a strong opinion on that so I wont state it here.
I hope this helps you understand us. Naturually, I don't speak for everyone.
Sedigh
You need a hierarchical martix stack to build up the child transformations. Check out http://msdn.microsoft.com/coding4fun/holiday/DirectXmas2/default.aspx and http://msdn.microsoft.com/coding4fun/holiday/DirectXmas3/default.aspx
However realistically having multiple objects to represent limbs is not how its done becuase you would end up with far too many objects. Instead the meshes vertex postiions are transformed using something called skinning. See the SimpleAnimation sample in the SDK. You need the mesh to be created properly to be able to skin however so you need an artist or learn how to do it yourself.
Goodway
The amount of animation isn't the problem - its the concept of skinning that you need to understand and thats not something that is teachable in a forum post. Try searching for DirectX skinning - I don't know of any simple tutorials other than simple animation and there is no write up with it.
If you want to do it with multiple parts then check out my coding4 fun tutorial. The melting snowman has no animated rotations but the principle of animating seprate mesheses is complete and documented.
Ivo Leitao
Look in the framework and see how they do it All the source is there.
Bottom line you need to set the world matrix based on the mouse position. There are many many ways to interpret the movements, the most common is using what is called the ArcBall which is what the framework implements.
CaveMike
I also agree that the framework is a bit to complex to use (for a beginner)... and I can't use the sample framework because DirectX is just an addon to my application (to make it look a bit nicer) and I couldn't get it to run on a panel so I made my on stuff.
This is my main render method:
float
time = (float)FrameworkTimer.GetAbsoluteTime();device.Transform.World = Matrix.RotationX(time);
ProcessNextFrame();
ClearFlags.Target | ClearFlags.ZBuffer, Color.CornflowerBlue, 1.0f, 0);device.Clear(
device.BeginScene();
DrawFrame((FrameDerived)rootFrame.FrameHierarchy);
device.EndScene();
device.Present();
But the "person" doesn't rotate... even If I place the device.Transform.World call before DrawFrame it's the same...
And tips
AnilGopu
Of course I do, but there really is a limit to how much you can explain in a forum post and open ended questions like yours have so many different solutions that its just about impossible to give a satisfactory answer. If there was a good tutorial out there I could point you to that but I don't know of one. So you get the only sample code I do know about. Plus even though the framework is confusing at first it often covers the edge cases that you would never cover yourself if you tried to do this so it has many years of experience baked into it.
To be honest this is why I use the framework for every project I do (yes even the Hexic port uses it, probably knocked a day or 2 off the coding and debugging) - I see little point in repeating the work others smarter than me have already done. I often wonder why beginner game programmers always think reimplementing everything from scratch themselves is worthwhile. Get your 1st game finished and go back and learn this stuff later - well that my opinion anyway.
If you try to implement your mouse camera and have specific questions on why its not working then that is much easier to answer in a forum.