[Eng+Ger] Relation between vertices and bones

12/06/2014 15:24 Mognakor#1
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.
12/06/2014 19:39 BinayFlyff#2
Du verarschst uns doch?!
Flyff hat garkeine Engine?

//Schau im LoadObject nach ;)
12/06/2014 21:07 LingRay#3
Quote:
Originally Posted by Mognakor View Post
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.
12/06/2014 21:10 Mognakor#4
Engine im Sinne von Dateien laden und das jeweilige Model anzeigen bzw. in der Weiterentwicklung ganze Welten anzeigen etc. etc., muss man hier wirklich über Begriffe diskutieren auch wenn der Sinn aus dem Kontext greifbar ist?

Und wow auf die Idee in einer so offensichtlich benannten Funktion nachzusehen währe ich nie im Leben gekommen, Vielen Dank für diesen Geistesblitz. Schade nur dass die Funktion ledeglich dazu nützlich ist Dinge zu laden mir aber (nahezu) keinerlei Information gibt wie und wozu das ganze verwendet wird.

Ich hab die Verbindung vermutlich gefunden muss das ganze aber noch testen.
Im Prinzip läuft es wahrscheinlich wohl darauf hinaus dass
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
};
eigentlich
Code:
struct SKINVERTEX
{
    D3DXVECTOR3 position;	// The 3D position for the vertex
    FLOAT		w1, w2;		// vertex weight
    WORD		matIdx_x;
    WORD		matIdx_y;
    D3DXVECTOR3 normal;		// The surface normal for the vertex
    FLOAT       tu, tv;		// The texture coordinates
};
ist.

Was mir klar wurde nachdem ich nochmal einen ordentlich Blick auf die Vertex-Deklaration für den SkinningVS geworfen habe.

Und matIdx_x und matIdx_y Indices für den jeweiligen Bone sind.