OpenGEX as .Nif alternative for OpenMW

General discussion regarding the OpenMW project.
For technical support, please use the Support subforum.
Lamoot
Posts: 176
Joined: 22 Apr 2016, 12:03

Re: OpenGEX as .Nif alternative for OpenMW

Post by Lamoot »

unelsson wrote: 02 Jul 2020, 15:10 We need a logic for standard structure of dae/whatever models with animation. How does the system know which is the "root node", the base of everything... Is there a good standard for this? What is the easiest and most foolproof way?
I've done animations mostly for Unity and there isn't an exact standard way you need to name bones or other elements. I always name the first bone in the rig's hierarchy "root" and it's good practice to do so. However the root bone is always under the rig object, and is not the top-most in file's hierarchy. Above it is the rig object that houses the bones. Beside the rig are the meshes.

Code: Select all

*character_file
    *mesh_body
    *mesh_head
    *mesh_clothes
    *rig
        *root
            *hips
            *legs
            *etc.
For instance movement, I replied in the issue at gitlab https://gitlab.com/OpenMW/openmw/-/issu ... _373799270 In essence, the top-most bone of the rig doesn't need to be the top-most node of the hierarchy. The movement of the bone is transfered up the hierarchy and the bone muted, to get the root motion effect.

In a general-purpose engine like Unity, the bone for root-motion can be configured through the editor's interface. For specialized OpenMW, this probably won't be customizable so a strict requirement for naming and hierarchy is needed. Perhaps saying there needs to be a root bone that is immediate child of the rig, armature, skeleton object.
unelsson
Posts: 227
Joined: 17 Mar 2018, 14:57

Re: OpenGEX as .Nif alternative for OpenMW

Post by unelsson »

Got a minor breakthrough with collada support - https://youtu.be/nr1i6yYWWDU

In the video OpenMW is running collada/dae animations. It's not finished, as animation clips are now merged without any changes in time, and therefore in the video the idle animation has also a part of the walk animation. The main programming challenge however has been to understand and use osgAnimation, and get familiar with dae plugin code, and how it constructs models and animations.

There is now however a question whether the animation time control should be done in OpenMW or by the content creators in other software? Let's say if there are two animation clips WALK and IDLE and they both start at time 0.0. WALK lasts for three seconds and IDLE lasts for seven seconds. As OpenMW doesn't mix animations, but rather relies on one animation track, should we merge animations that are on multiple tracks to one animation track by changing the animation time/keyframes (e.g. WALK 0s - 3s and IDLE 3s - 10s) or should this be done by the content creator in other software (e.g. Blender)? I'd cautiously vote for the content creators controlling the time and keyframes, but this of course should be documented, and I'm up for other opinions.
unelsson
Posts: 227
Joined: 17 Mar 2018, 14:57

Re: OpenGEX as .Nif alternative for OpenMW

Post by unelsson »

Next breakthrough was finding and connecting the root translation from the channels. It's not very refined, but the character is now moving.
https://youtu.be/SS7gOLhzYwo

I'd need a model with few animations, and they should each have information on start time and end time, as well as some way to know which action to connect the animation to. Each animation should be named according to the scheme of OpenMW and Morrowind (e.g. walkforward, idle, idle2 so on...).

Models in dae or fbx, or preferably both. It may be necessary to have a text file that provides more information how to handle the animation, but for the proof-of-concept video (see above) I didn't use any extra txt.

glTF 2.0 later might work, but I'd rather interface with formats that are currently, "easily", supported by OSG.
unelsson
Posts: 227
Joined: 17 Mar 2018, 14:57

Re: OpenGEX as .Nif alternative for OpenMW

Post by unelsson »

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
Lamoot
Posts: 176
Joined: 22 Apr 2016, 12:03

Re: OpenGEX as .Nif alternative for OpenMW

Post by Lamoot »

Hello, as we mentioned on Discord this week, I made the initial model + rig + animations this weekend (rather basic and rough, but workable).
OpenMWDude.png
The zip includes the original .blend file as well as export to .fbx and .gltf. The exported files properly make a roundtrip import back to Blender. I haven't done any thorough testing other than this. Also I didn't yet look at the proposed scheme of organizing, naming, frame markers etc. of the animations. I'll try to look into this in the following days.
Attachments
OpenMWDude_01.zip
(417.43 KiB) Downloaded 256 times
User avatar
psi29a
Posts: 5355
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 »

Very cool! :)
Lamoot
Posts: 176
Joined: 22 Apr 2016, 12:03

Re: OpenGEX as .Nif alternative for OpenMW

Post by Lamoot »

@unelsson you mentioned on discord the skeleton is missing certain bones. Adding them is not a problem, especially at this stage. Do you perhaps have a list of needed bones for a standard character rig in OpenMW?

The rig I posted has the following bone hierarchy. It needs finger bones and probably a prop/weapon/shield bone in hands?
OpenMWDudeBones01.png
In addition, is there any naming convention we'd like to follow? I'm thinking of removing the DEF- prefix and not using any dots in the name. They work fine in Blender, but I know Maya has a problem with any special character that's not an underscore. Best we have good naming now to not exclude other software from the pipeline.

Bone names would then be like this:

Code: Select all

Root
  Spine1
    Spine2
      ...
    LeftThigh
      LeftShin
        LeftFoot
          LeftToe
psi29a wrote: 09 Nov 2020, 07:32Very cool! :)
Thanks!
unelsson
Posts: 227
Joined: 17 Mar 2018, 14:57

Re: OpenGEX as .Nif alternative for OpenMW

Post by unelsson »

Would be great to have input from engine developers! We need to know which bones are important.

The naming convention for OpenMW doesn't have to be the same as Morrowind, but there are some things that are important from the engine point of view. It's great to have your expertise on what's nice bone naming convention to work with.

The base animation file of Morrowind are the following (raw info dump at the moment though, with duplicates!). My guess is that these are for all animations, not just NPCs, who probably have some extra bones for equipping items.

bip01 l finger1
bip01 l finger2
bip01 l finger21
bip01 l finger11
bip01 l hand
bip01 l finger0
bip01 l finger01
bip01 l hand
bip01 l finger1
bip01 l forearm
bip01 l finger2
bip01 l finger0
bip01 r finger1
bip01 r finger2
bip01 r finger21
bip01 r finger11
bip01 r hand
bip01 r finger0
bip01 r finger01
bip01 r hand
bip01 r finger1
bip01 r forearm
bip01 r finger2
bip01 neck
bip01 spine2
bip01 head
bip01 spine1
bip01 spine
bip01 l clavicle
bip01 l upperarm
bip01 l thigh
bip01 pelvis
bip01 r clavicle
bip01 r upperarm
bip01 r thigh
bip01 r hand
bip01 l finger21
bip01 r foot
bip01 l finger41
bip01 l foot
bip01 l finger31
bip01 l upperarm
bip01 neck
bip01 head
bip01 r upperarm
bip01 r calf
bip01 l finger4
bip01 l calf
bip01 r thigh
bip01 l hand
bip01 l thigh
bip01 spine
bip01 pelvis
bip01 r finger41
bip01 spine1
bip01 spine2
bip01 l finger32
bip01 r forearm
bip01 r clavicle
bip01 l clavicle
bip01 l forearm
bip01 r finger3
bip01 r finger01
bip01 r finger0
bip01 r finger21
bip01 l finger0
bip01 l finger02
bip01 r finger02
bip01 r finger1
bip01 r finger12
bip01 r finger11
bip01 r finger22
bip01 r finger2
bip01 l finger01
bip01 l finger12
bip01 l finger1
bip01 l finger11
bip01 l finger22
bip01 l finger2
bip01 l finger3
bip01 r finger4
bip01 l finger42
bip01 r finger32
bip01 r finger31
bip01 l toe0
bip01 r finger42
bip01 r toe0
bip01 r hand
bip01 l finger1
bip01 r foot
bip01 r finger21
bip01 l foot
bip01 l hand
bip01 l upperarm
bip01 neck
bip01 head
bip01 r upperarm
bip01 r finger11
bip01 r calf
bip01 r finger2
bip01 l calf
bip01 r thigh
bip01 l finger21
bip01 l thigh
bip01 spine
bip01 pelvis
bip01 spine1
bip01 spine2
bip01 l finger2
bip01 r forearm
bip01 r clavicle
bip01 l clavicle
bip01 l forearm
bip01 r finger01
bip01 r finger0
bip01 r finger1
bip01 l finger0
bip01 l finger01
bip01 l finger11
Lamoot
Posts: 176
Joined: 22 Apr 2016, 12:03

Re: OpenGEX as .Nif alternative for OpenMW

Post by Lamoot »

Thank you for the info. With the list sourced from the animations, the duplication is likely from 3 animated bone properties - location, rotation, scale. Removing the duplicates, it's 52 bones and they look pretty standard. The OpenMWDude_01 has the same structure, but doesn't have the 3-bone fingers yet.

Since there's no real restriction with naming, I'll use the proposed scheme from my previous post. The same naming scheme is also found with Maya's HumanIK and the popular animation service Mixamo so that's an extra level of familiarity it will offer. Other software have their own schemes, Blender doesn't have any standard way, but it doesn't really matter in the end, as long as the naming is sensible.

The extra bones for sheathed weapons, or shields on the back can be added as soon as we know which ones we need. There's no limitation to what we can have, it's mostly down to a sensible generic setup that works for as many cases as possible.
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

Re: OpenGEX as .Nif alternative for OpenMW

Post by cc9cii »

Animations list bones multiple times because of animation groups (e.g. upper body, arms, etc) That would be my guess, without knowing from where you've extracted the bone names.
Post Reply