Making better use of Ogre's capbilities?

Everything about development and the OpenMW source code.
Chris
Posts: 1626
Joined: 04 Sep 2011, 08:33

Re: Making better use of Ogre's capbilities?

Post by Chris »

Success! Kind of.
http://ompldr.org/vZDlscQ/OP_Screenshot ... 957240.png

The skeleton now seems to be animating correctly. There is, unfortunately, some warping in the mesh (look at the feet..), but it is otherwise moving and behaving correctly. The mesh warping doesn't seem to be an animation or bone weighting issue, but something with the way the mesh is translated into "bone space".

Here's the latest source:
http://ompldr.org/vZDltMA/ogre-proj.zip
User avatar
raevol
Posts: 3093
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Making better use of Ogre's capbilities?

Post by raevol »

Nice work Chris!!
User avatar
psi29a
Posts: 5361
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Making better use of Ogre's capbilities?

Post by psi29a »

Wow!

I've learned more (over many disciplines and technology) from reading up on everyone's work and playing in OpenMW that I would just trying to do things from a book or on my own. :)
User avatar
Rebel-Rider
Posts: 34
Joined: 29 Mar 2012, 18:27

Re: Making better use of Ogre's capbilities?

Post by Rebel-Rider »

persistence pays off :)
User avatar
artorius
Posts: 46
Joined: 08 Mar 2012, 13:59
Location: VA, USA

Re: Making better use of Ogre's capbilities?

Post by artorius »

Wow man, good job! You've been working at this for a while, and your tenacity is to be commended!
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Making better use of Ogre's capbilities?

Post by jhooks1 »

Do you think you can get this working by modifying the regular NIFLoader? Or do we really need niflib? Could you put up some youtube videos of the current animation? Keep up the good work, and if you get this working with creatures, it shouldn't be too hard to get it to work for npcs.

EDIT: Was I right about the difference between Ogre and Nif animations? Or completely off?
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Making better use of Ogre's capbilities?

Post by jhooks1 »

Found the following in your NIFLoader code.

newVerts[index] += (mat*srcVerts[index]) * weight;

You do this once the submesh is created. This is constant right, this is not the actual bones current position and rotation.
Chris
Posts: 1626
Joined: 04 Sep 2011, 08:33

Re: Making better use of Ogre's capbilities?

Post by Chris »

jhooks1 wrote:Do you think you can get this working by modifying the regular NIFLoader? Or do we really need niflib?
I imagine it should be possible, as long as it can get the necessary data (the code I'm working with is actually based on a much older version of OpenMW's NIFLoader). I'm not sure how many helper functions niflib provides for understanding the data that I'm using, but niflib and nif_file basically act the same way, by providing access to the file's Ni* object tree. Just that niflib's understanding of the structures is a bit more comprehensive than nif_file.
Could you put up some youtube videos of the current animation?
http://www.youtube.com/watch?v=As2BxBxOoQg

Poor framerate caused by video capture (first time I've ever done this). The head is detached because it's not actually connected to any bones, so it's linked with the root bone.
EDIT: Was I right about the difference between Ogre and Nif animations? Or completely off?
A nif's keyframe seems to be relative to the bone's parent (that is, assuming no local orientation, translation, or scaling for the bone). It's basically the same as Ogre with no initial position is set. The trick is to warp the mesh into the same position/orientation/scaling as the initial bone position (for which niflib provides the GetBoneTransform method in NiSkinData).
Found the following in your NIFLoader code.

newVerts[index] += (mat*srcVerts[index]) * weight;

You do this once the submesh is created. This is constant right, this is not the actual bones current position and rotation.
What do you mean? The matrix is basically a reverse transform:
NIFLIB_API Matrix44 Niflib::NiSkinData::GetBoneTransform ( unsigned int bone_index ) const
Retrieves the transform for a particular bone. This is the transform from geometry node back to this bone in skeleton root coordinates.
That code basically reverts the vertices to be as if there were no bone transformations (since the initial Ogre skeleton has no transformations), so that when the animation is applied it's put back in the right position.

I've tried playing around with it all, but Ogre is very confusing with respect to the initial state and binding pose. This is the only thing I've managed to make work so far.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Making better use of Ogre's capbilities?

Post by jhooks1 »

Looks good. Doesn't the head have a parent NiNode/Bone you can connect it to?
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Making better use of Ogre's capbilities?

Post by jhooks1 »

Got a question about NIFObject::create()

Lets say we have this in the NIF file

Quaternion times
0 0.5 .75
Quaternion values
quat1 quat2 quat3

Translation Times
0 .75

Translation Values
trans1 trans2

Where trans1 and trans2 are Ogre::Vector3
and quat1 quat2 and quat3 are Ogre::Quaternion

At time .5 I believe your code would pick quat2 as the rotation value, and trans1 as the translation.

Shouldn't the translation picked instead be a value between trans1 and trans2 (An interpolation?)

EDIT: I am probably way off, don't really understand the way ogre does things. But the original info had two data points for the translation, and now it has split into three.
Post Reply