OpenGEX as .Nif alternative for OpenMW

General discussion regarding the OpenMW project.
For technical support, please use the Support subforum.
User avatar
psi29a
Posts: 5356
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: OpenGEX as .Nif alternative for OpenMW

Post by psi29a »

Do we have some good documentation on workflow for other would-be creatives?

Would someone be willing to put together some YT films? Perhaps workshop series? I think many people would enjoy that, I would find it educational. :)
unelsson
Posts: 227
Joined: 17 Mar 2018, 14:57

Re: OpenGEX as .Nif alternative for OpenMW

Post by unelsson »

Lamoot wrote: 18 Nov 2020, 08:25 Oh right. It's good that you mention this. Everything seemed to work fine in Godot so I didn't even realize the specifics of the setup for OpenMW. It seemed to be ok if they are offset in the NLA editor. I'll set up the animations so they are offset in the actions themselves and send the files again.

EDIT: Here are the updated files. The keyframes in each action have been offset so they don't overlap.
https://we.tl/t-R4ZsfNyUlg

Testing in Godot, they appear to have a section where nothing is happening, but is still regarded as a part of the animation, so not sure if this is the export we need. Perhaps Godot import the file in a different way? I already know the likely reason where to fix this if it indeed turns out to be a problem, but can only look at it later today/tomorrow.

The issue when you tried to offset the clips and having problems with the arms/legs was because those bones were hidden and didn't show in the action editor.
Godot likely reads the file in a different way. I haven't noticed at least any significant pieces in the animation where nothing is happening, but with the root movement glitch bug it may be hard to see if there's a frame missing somewhere. It might be that if the the very last frame of the animation is the same as the first one, the animation plays them both in a row, and animation looks like it stops for one frame. What OSG's dae plugin do is that it reads the <animation_clip> instances and takes the animation start and end times from there. They seem to be float values that correspond to the time. There's also a time track of float values in the dae-file, but I don't think we need to bother with that right now, but it looks like it describes the flow of time per frame (0.03333333333333334 time per one frame in this case).

As for the root rotation, and root movement: When set properly, OpenMWDude_03_Root0 runs forward in OpenMW engine. At the end of the animation loop, the creature location glitches forwards for the distance of the root movement. This is likely an engine issue in keyframecontroller, but needs some investigation still. OpenMWDude_03_Root180 runs in place, without moving at all, it doesn't glitch, but it doesn't move either. My guess is that the root orientation is correct in version Root0, but there is a double update for the location or extra/interpolation error at some point in the code.
Lamoot
Posts: 176
Joined: 22 Apr 2016, 12:03

Re: OpenGEX as .Nif alternative for OpenMW

Post by Lamoot »

psi29a wrote: 18 Nov 2020, 11:06 Do we have some good documentation on workflow for other would-be creatives?

Would someone be willing to put together some YT films? Perhaps workshop series? I think many people would enjoy that, I would find it educational. :)
We had an iterative test session today with @unelsson and got some nice results. With most of the factors figured out, it will indeed be essential to document it all. (not a comprehensive or well explaned list, but lists the essential points). The files in the .zip follow these things.
  • Use the Better collada exporter for 2.8
dae_export_settings.png
  • Y+ in Blender is towards the front and it's where the character should look at by default
  • There needs to be a single top-most bone in the hierarchy that acts as the root, otherwise the .dae export will fail
  • The root bone needs to be aligned with the world, so root motion moves the object forward in OpenMW
  • By default, Blender uses 1 unit = 1m. OpenMW uses a factor of 70. In Blender, the rig and mesh need to be scaled by 70 and the scale applied. In addition, all of the location values of all animations need to be scaled by the same factor of 70. Or simply start with a 70 blender unit = 1m scale. In any case, it makes for a clunky workflow, but there are possible fixes on the horizon.
  • Animations must all have their keys offset, so they don't share any scene's frames between them. It doesn't work if the animations are "only" offset in the NLA editor.
Attachments
OpenMWDude_05.zip
(892.78 KiB) Downloaded 237 times
Lamoot
Posts: 176
Joined: 22 Apr 2016, 12:03

Re: OpenGEX as .Nif alternative for OpenMW

Post by Lamoot »

Having succeeded in getting a decent, animated model into OpenMW, it's time to plan the rest of the animations.

First I would like to tackle the movement animations - running and walking. I presume we need 8 variants for the 8 directions (cardinal + diagonal). Perhaps by using improvements from here: viewtopic.php?f=24&t=6955 we can get away with less. There's no difference for me, as I'll animate the 4 cardinal directions and can easily get diagonal movement from those.

Open questions I have are:
  • What naming do we use for the animations. Are there any preferences or requirements from the engine side?
  • If I understand correctly, the animations would next a .txt file to tell the engine which animation to play when. Like unelsson describes in his post. Is there anything in particular needed from my side to enable or ease the creation of these .txt files?
unelsson wrote: 04 Nov 2020, 13:06 Could the standard text file for animated entity in OpenMW be something like this:

MODEL mymodel.osgt
ANIMATION walkforward walkforward.dae
ANIMATION idle idle.fbx
TEXTKEY walkforward: start 0
TEXTKEY walkforward: loop start 0.333
TEXTKEY walkforward: end 2.666

You could then set that file to OpenMW-CS in the column Model/Animation, and it would point the engine to correct files to load. It would be:
MODEL [filename]
ANIMATION [animation_name] [filename]
TEXTKEY [textkey]

Each animation would be stored in dae or fbx. Later also gltf2.0. Bone names and rigs are stored in MODEL. It might be necessary to have an option for RIG for keeping just the skeleton and the bones in a separate file. I'm aiming for sort of a industry standard with this setup.

Textkeys control how the animations are used. The number in textkey is time, either in float or frame number. This may depend on the format used, but at least dae seems to store floats that correspond to time on animation track. [textkey] is something like in nifs, see http://www.preik.net/morrowind/animationgroups.html
unelsson
Posts: 227
Joined: 17 Mar 2018, 14:57

Re: OpenGEX as .Nif alternative for OpenMW

Post by unelsson »

Engine needs specific keywords to run animations. Each action should be named according to these keywords.

I believe there are some movements animation names listed here:
https://gitlab.com/OpenMW/openmw/-/blob ... r.cpp#L146

This file is pretty useful for looking up other character-related animation keywords.

edit: For now, it suffices that dae-files have animation_clip(s) that are properly named. The txt-file method hasn't been created yet, therefore dae has all the information needed at this moment, but it's probably useful to have txt-files later.
Lamoot
Posts: 176
Joined: 22 Apr 2016, 12:03

Re: OpenGEX as .Nif alternative for OpenMW

Post by Lamoot »

This sounds rather straightforward then, thanks for the info.

DestinedToDie was also helpful by providing me with a .txt file listing all of the animations used in Morrowind. https://pastebin.com/qaNfhZq7
To me it looks like a definition .txt file and was wondering whether anyone can shed some light on what these things mean. Is this something we'd need to do as well eventually? An example from the link:

Code: Select all

4153/SoundGen: Right
4163/SoundGen: Left
4173/SoundGen: Right
4183/SwimRunBack: Loop Stop/SoundGen: Left
4193/SwimRunBack: Stop
4195/SwimRunLeft: Start
4205/SwimRunLeft: Loop Start
4215/SoundGen: Right
4235/SoundGen: Left
4245/SwimRunLeft: Loop Stop
4255/SwimRunLeft: Stop
4257/SwimRunRight: Start
4267/SwimRunRight: Loop Start
4277/SoundGen: Left
4297/SoundGen: Right
Lamoot
Posts: 176
Joined: 22 Apr 2016, 12:03

Re: OpenGEX as .Nif alternative for OpenMW

Post by Lamoot »

I started working on more animations. I'm uploading the files to https://gitlab.com/Lamoot/example-suite/ and making MRs into OpenMW's Example Suite repository. Currently I don't export or do the 70x scale. I'll do this once I have all directions of a particular movement type. Right now I'm doing the run and I have forward and backward animations available (side strafing still to be done).
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

Re: OpenGEX as .Nif alternative for OpenMW

Post by cc9cii »

Lamoot wrote: 25 Nov 2020, 19:27 This sounds rather straightforward then, thanks for the info.

DestinedToDie was also helpful by providing me with a .txt file listing all of the animations used in Morrowind. https://pastebin.com/qaNfhZq7
To me it looks like a definition .txt file and was wondering whether anyone can shed some light on what these things mean. Is this something we'd need to do as well eventually? An example from the link:

Code: Select all

4153/SoundGen: Right
4163/SoundGen: Left
4173/SoundGen: Right
4183/SwimRunBack: Loop Stop/SoundGen: Left
4193/SwimRunBack: Stop
4195/SwimRunLeft: Start
4205/SwimRunLeft: Loop Start
4215/SoundGen: Right
4235/SoundGen: Left
4245/SwimRunLeft: Loop Stop
4255/SwimRunLeft: Stop
4257/SwimRunRight: Start
4267/SwimRunRight: Loop Start
4277/SoundGen: Left
4297/SoundGen: Right
Some of these appear to be sound triggers for the keyframe animations (e.g. foot fall)
User avatar
Capostrophic
Posts: 794
Joined: 22 Feb 2016, 20:32

Re: OpenGEX as .Nif alternative for OpenMW

Post by Capostrophic »

These are animation text keys, they define the sounds playing during the animation and animation group bounds (the beginning and the end of the entire animation and the beginning and the end of their looped part).
Lamoot
Posts: 176
Joined: 22 Apr 2016, 12:03

Re: OpenGEX as .Nif alternative for OpenMW

Post by Lamoot »

@cc9cii @Capostrophic thank you for the answer. At first I was afraid it was some overly complicated way to define which animations are used in the engine. Not a problem at all if they are for the sounds.

I've update the OpenMWDude so that it now includes run animations for all 4 directions (forward, back, left, right) https://gitlab.com/Lamoot/example-suite
I also adjusted animation names to follow what the engine expects them to be.
Post Reply