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
Making better use of Ogre's capbilities?
Re: Making better use of Ogre's capbilities?
Nice work Chris!!
- 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?
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.
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.
- Rebel-Rider
- Posts: 34
- Joined: 29 Mar 2012, 18:27
Re: Making better use of Ogre's capbilities?
persistence pays off
Re: Making better use of Ogre's capbilities?
Wow man, good job! You've been working at this for a while, and your tenacity is to be commended!
Re: Making better use of Ogre's capbilities?
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?
EDIT: Was I right about the difference between Ogre and Nif animations? Or completely off?
Re: Making better use of Ogre's capbilities?
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.
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.
Re: Making better use of Ogre's capbilities?
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.jhooks1 wrote:Do you think you can get this working by modifying the regular NIFLoader? Or do we really need niflib?
http://www.youtube.com/watch?v=As2BxBxOoQgCould you put up some youtube videos of the current animation?
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.
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).EDIT: Was I right about the difference between Ogre and Nif animations? Or completely off?
What do you mean? The matrix is basically a reverse transform: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.
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.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.
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.
Re: Making better use of Ogre's capbilities?
Looks good. Doesn't the head have a parent NiNode/Bone you can connect it to?
Re: Making better use of Ogre's capbilities?
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.
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.