osgb/osgt animation format support

Everything about development and the OpenMW source code.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: osgb/osgt animation format support

Post by scrawl »

I've been thinking about the issue with bones (bind matrix set on mesh vs. bind matrix set on bone) again and I'm starting to think the way Morrowind does things kinda makes sense, considering how equipment/bodyparts are stitched together from multiple files. There's no need for the base skeleton to designate nodes beforehand as being used for skinning or not, a bone is just an ordinary node, and a 'Skeleton' is just an ordinary node hierarchy. This allows modders to use any node they want for skinning, and the person creating the 'base_anim' file doesn't even have to know what skinning is.

Both approaches make sense, just depends on use cases. There's no reason to try forcing Morrowind's way into a standard animation package nor a reason to adjust standard packages to support Morrowind.
User avatar
psi29a
Posts: 5355
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: osgb/osgt animation format support

Post by psi29a »

Can we support both or would that be too much work to maintain?
crassell
Posts: 49
Joined: 26 Aug 2017, 21:10

Re: osgb/osgt animation format support

Post by crassell »

scrawl wrote: 27 Sep 2017, 16:45 Both approaches make sense, just depends on use cases. There's no reason to try forcing Morrowind's way into a standard animation package nor a reason to adjust standard packages to support Morrowind.
This still doesn't prevent us from decomposing the unified osg format into the animation hierarchy that openmw expects does it? For non-bipedal animation, the osg format approach should work just fine with some conversion.

Do I need to reconsider my priorities for enhancing blender nif support for animation rather than continuing down this path? Seems like supporting osgt format as is will go against the modding friendly split of animation assets between the nif and kf files.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: osgb/osgt animation format support

Post by scrawl »

Sorry, that was just a tangential thought it shouldn't have to do anything with what we planned.
crassell
Posts: 49
Joined: 26 Aug 2017, 21:10

Re: osgb/osgt animation format support

Post by crassell »

Progress update. I've added just enough serialization to our custom animation nodes to write an osgt file that represents the hierarchy of the openmw animation data structure. I'm using this as a means to compare the conversion of nixhound.nif to osg animation format. The 2 paths are shown below

Path1:
nixhound.nif -> blender 2.49b nif import -> nixhound.blend -> blender latest -> osgt export -> nixhound.osgt -> openmw osg animation serialize read -> openmw animation serialize write -> nixhound_openmw.osgt
Path 2:
nixhound.nif -> openmw nif read -> openmw animation serialize write -> nixhound_openmw.osgt

Ignoring some small changes due to the conversion path, the 2 results should be almost identical.
crassell
Posts: 49
Joined: 26 Aug 2017, 21:10

Re: osgb/osgt animation format support

Post by crassell »

So I've noticed after some experimentation a few issues with having a consolidated animation file for 1 creature.

1. Nif import to blender 2.49b loses all text key mappings to the start and stop mapping of animations within the file
2. To work around the problem from 1, I started experimenting with manually adding markers in blender (essentially equivalent to text key mapping). These markers don't export into any meaningful object in the .osgt format.

These limitations mean in its current state, osgt format would force us to split animations into separate files essentially making the animation key map a file lookup for the exact animation. Another option is to support a small addon file export from blender which could support exporting the markers.

What seems like the best path forward?
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: osgb/osgt animation format support

Post by scrawl »

I'm kinda lacking context to suggest something. So there's a way to add tags to the timeline in Blender, but the exporter discards them is the problem? Or the format has no place to store them?
User avatar
DestinedToDie
Posts: 1181
Joined: 29 Jun 2015, 09:08

Re: osgb/osgt animation format support

Post by DestinedToDie »

crassell wrote: 03 Oct 2017, 07:321. Nif import to blender 2.49b loses all text key mappings to the start and stop mapping of animations within the file
Do I understand correctly that when you import a .nif file into Blender 2.49B, you go to text editor, select anim txt and there is nothing there?

1. Did you forget to check "import animation"?
2. Consult this image. https://i.imgur.com/AKvNCZC.png
3. Make sure you are viewing anim txt file.
4. Make sure you've scrolled up (you might be scrolled down and can't see the key data hidden upstairs).
crassell
Posts: 49
Joined: 26 Aug 2017, 21:10

Re: osgb/osgt animation format support

Post by crassell »

DestinedToDie wrote: 04 Oct 2017, 17:04 Do I understand correctly that when you import a .nif file into Blender 2.49B, you go to text editor, select anim txt and there is nothing there?
Thanks! With your help I did find that these are correctly imported into blender 2.4b. I also confirmed that they survive the .blend import to latest blender. Isn't it more natural that these key mappings would import as markers on the animation timeline? If anything changed about how the animator divided key frames or modified the length of animations, the whole list would need to be updated.

For the export, osgt definitely doesn't know about anim.txt so importing a legacy nif, modifying it, and exporting it to osg won't work.

For a brand new animation from scratch, it doesn't seem like any sort of multiple animation support in one timeline is supported in general for blender export. The below class for osgAnimation looks promising:

include/osgAnimation/Timeline
include/osgAnimation/TimelineAnimationManager

The only problem is after doing a recursive grep of the osgexport source code, the word timeline is never mentioned which seems to hint that every animation has to be unique and separate upon export in multiple files.

Instead of just nixhound.osgt, we would need:
nixhound_idle.osgt
nixhound_walk.osgt
nixhound_attack.osgt
etc.
crassell
Posts: 49
Joined: 26 Aug 2017, 21:10

Re: osgb/osgt animation format support

Post by crassell »

Forgot to report an update on the approach. After talking to DestinedToDie on discord, I came to the conclusion that exporting the anim.txt (which has the textkeymap data) as a separate file is the best option for now.

Below is the conversation:
so the current task is osgt support for animation. Morrowind / nif likes to define all animation timelines in one animation file
osgt format seems to want only 1 animation per file
If we want to support native osgt animation, is it annoying as an animation developer to maintain each unique animation in separate files?
I want to build this support in but openmw won't even execute these animations correctly without the data from anim.txt
hope i'm explaining this well enough
ToDineDoTestined - 10/04/2017
Anim_Base.txt
22.51 KB
As you can see from looking at that text file, some .nifs contain a lot of keyframe data.
I suppose a developer can split all of these, but I would consult the forum on the practicality of it. Does loading 30 files instead of 1 file make sense?
ibanez1 - 10/04/2017
definitely not
it could barely be justifiably at small counts
it seems like we need osgt + anim.txt
i think what i'll do is save anim.txt for now and load the TextKeyMap from that
later i'll make a marker export for latest blender so it can be maintained in markers or anim.txt
markers would get us away from absolute keyframe indices
Also, all classes have been moved to SceneUtil and we have full serialization support for our existing animation format now in my openmw clone. Even though we won't use it for import, it's useful for reviewing the data after animation import. I'm adding support to load to KeyframeManager and our skeleton format from the animation osgt format now.
Post Reply