Quote:
Originally Posted by Mognakor
English:
Currently i'm working on writing my own little engine based on the Flyff Engine but written in OpenGL. Until now i've been able to solve all upcoming problems myself. But now i'm trying to animate the models which is simple in theory but i'm stuck on one problem for at least a week: I cannot find how the o3d/chr/ani-Format connects from vertices to the bone. I don't any tutorial how OpenGL or GLSL works or information on the theory of skeletal animation etc. I merely need to know how Flyff connects from Vertex X to Bone Y, from there on i can continue by myself.
Deutsch:
Ich arbeite derzeit an meiner eigenen kleinen Engine und orientiere mich dabei an der Flyff Engine, allerdings programmiere ich meine in OpenGL. Bisher hab ich es geschafft alle auftauchenden Probleme selbst zu lösen. Jetzt aber versuche ich die Modelle zu animieren, in der Theorie einfach, aber ich stecke an einer Sache schon mindestens eine Woche fest: Ich kann keine Punkt finden an dem im o3d/chr/ani-Format festgelegt wird welcher Vertex an welchem Bone fest ist. Ich brauche keine Tutorials für OpenGL oder GLSL oder theoretische Informationen wie eine Skelett-basierte Animation funktioniert oder ähnliches. Das einzige was ich brauche ist der Punkt an dem Flyff den Vertex X an Bone Y anknüpft, von da an komme ich wieder von selbst weiter.
|
Im not quite sure if I fully understand your problem since it seems pretty obvious to me. I'll do a recap anyway and sorry if it isn't what you asked for.
Theres two things in the source code you should be looking for;
1) a struct or class created to hold the vertex data
2) the corresponding fvf flag if you are dealing with the fixed function pipeline or a vertex declaration if you are working with shaders
Unless __YENV is defined you will be dealing with the fixed function pipeline.
Code:
struct SKINVERTEX
{
D3DXVECTOR3 position; // The 3D position for the vertex
FLOAT w1, w2; // vertex weight
DWORD matIdx;
D3DXVECTOR3 normal; // The surface normal for the vertex
FLOAT tu, tv; // The texture coordinates
};
That's the struct holding the vertex data of the individual vertices. As you can see w1 and w2 seem to be the blend weights. This will make more sense in a second.
Code:
#define D3DFVF_SKINVERTEX (D3DFVF_XYZB3 | D3DFVF_LASTBETA_UBYTE4 | D3DFVF_NORMAL | D3DFVF_TEX1)
This is the fvf flag. If you google for the D3DFVF codes you will find out that the first two floats are indeed the vertex weights. The third float is replaced by a dword and contains the blend indices (saved in the o3d as two shorts).
Good luck with your project.