Replacing Animated Models?

Questions specific to OpenMW-CS can be asked, and content development related topics can be discussed here
josephbburg
Posts: 10
Joined: 04 Jun 2021, 05:15

Replacing Animated Models?

Post by josephbburg »

Hello. I am very excited to see OpenMW receive support for .dae files. I'm thinking of trying to make a replacer for a character or for humans. However, I am having trouble finding a way to control animation in OpenMW-CS... is it still hardcoded? If so, can someone help me find the list of animations the characters have?
I think I should start by replacing a creature since that should be easier, and then I want to try and replace the humans. So, I had a look at Better Bodies and noticed that the model file has a bunch of different objects in it, but only one shows at any given time for each body-part. How does OpenMW know which to show and which to hide? How does it know which animation file to use, and how to seek in the animation file? Does it have a way of sync-ing the rigs in each file, or does it instance all of them, or does it discard them and merely use the skinning data for the rig in the associated animation file?
Note: I also need to know how OpenMW finds textures. I want to spec/normal map stuff, but I don't want to spend ages manually naming and locating things and tying files together in NifSkope. I'd like to avoid Nif entirely if Collada can do the job. I believe there is documentation for this, so a simple pointer to the docs will be enough for me :) .
I am comfortable building and modifying OpenMW for what that's worth.

Thanks!
User avatar
psi29a
Posts: 5356
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Replacing Animated Models?

Post by psi29a »

In the example-suite we have animated collada/dae humanoid already. If you would like to help us with that work, that would be fantastic.

https://gitlab.com/OpenMW/example-suite
^-- project itself

https://gitlab.com/OpenMW/example-suite ... requests/1
^-- the current MR with the first bits of animated humanoid
josephbburg
Posts: 10
Joined: 04 Jun 2021, 05:15

Re: Replacing Animated Models?

Post by josephbburg »

Thanks, I will have a look this weekend. I would like to look at the .blend files if possible. Is everything in the Example Suite in merge-requests? It looks like the repository is nothing but the readme.
User avatar
psi29a
Posts: 5356
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Replacing Animated Models?

Post by psi29a »

No, it should have been merged awhile ago. I might press the button later just to get it done.

The blend files are there. :)
josephbburg
Posts: 10
Joined: 04 Jun 2021, 05:15

Re: Replacing Animated Models?

Post by josephbburg »

Awesome, thanks. I starred the project.
User avatar
psi29a
Posts: 5356
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Replacing Animated Models?

Post by psi29a »

I've pulled the trigger, it's merged. Feel free to check it out.

According to Lamoot:
We now have:

Starting cell with simple land
Sky and weather meshes with textures
Various strings and descriptions for the UI
Fonts for the UI
UI and ability icons
Models so player movement works
Placeholder UI graphics (in process of having proper ones)

For the player assets I wouldn't go beyond the very basics needed for movement. Running and walking work and I'd add sneaking as well. Anything more, attack animations, various idles, body parts etc. would be left for the Example Suite or a later release of the Template.
Lamoot
Posts: 176
Joined: 22 Apr 2016, 12:03

Re: Replacing Animated Models?

Post by Lamoot »

Heya!

COLLADA support is fresh and it does already support animations. Some of it is already documented, and the rest will come up as we go. There's also some performance drawbacks to using this format viewtopic.php?f=2&t=3724&start=130 But for now it is what we have.
josephbburg wrote: 04 Jun 2021, 15:08 I'm thinking of trying to make a replacer for a character or for humans. However, I am having trouble finding a way to control animation in OpenMW-CS... is it still hardcoded?
josephbburg wrote: 04 Jun 2021, 15:08 How does it know which animation file to use, and how to seek in the animation file?
Information on how to add animated .dae models to OpenMW can be found https://openmw.readthedocs.io/en/latest ... llada.html. In addition, the Template / Example Suite is meant to be an example of how things are done. The Template is not yet documented, but you can already poke around.
josephbburg wrote: 04 Jun 2021, 15:08 If so, can someone help me find the list of animations the characters have?
They are still the same animations and use the same names as in Morrowind. This is one of the undocumented things. https://en.uesp.net/wiki/Morrowind_Mod:Animation_Groups could be of some help.
josephbburg wrote: 04 Jun 2021, 15:08 Note: I also need to know how OpenMW finds textures. I want to spec/normal map stuff, but I don't want to spend ages manually naming and locating things and tying files together in NifSkope. I'd like to avoid Nif entirely if Collada can do the job. I believe there is documentation for this, so a simple pointer to the docs will be enough for me :) .
Extra maps follow the name of the diffuse + suffix. The diffuse map is written in the .dae / .nif / .osgt file.
Materials section of https://openmw.readthedocs.io/en/latest ... llada.html
More details in https://openmw.readthedocs.io/en/latest ... asics.html
josephbburg wrote: 04 Jun 2021, 15:08 ...How does OpenMW know which to show and which to hide? Does it have a way of sync-ing the rigs in each file, or does it instance all of them, or does it discard them and merely use the skinning data for the rig in the associated animation file?
Body parts are separate models that need to be set up in OpenMW-CS. This and the rest of your question are one of the undocumented and not yet fully explored things. unelsson would probably know more.
josephbburg wrote: 04 Jun 2021, 15:53 Thanks, I will have a look this weekend. I would like to look at the .blend files if possible. Is everything in the Example Suite in merge-requests? It looks like the repository is nothing but the readme.
I have all the .blend files available here. In the repository I included any that didn't take too much space. The character model to check is https://gitlab.com/OpenMW/example-suite ... Dude.blend
josephbburg
Posts: 10
Joined: 04 Jun 2021, 05:15

Re: Replacing Animated Models?

Post by josephbburg »

Thank you, there's a lot of really helpful stuff in here.I should be able to figure out what I want to know from the documentation.
So, here's my understanding of things:
  • OpenMW has hardcoded animations that it calls by name (the CharacterController class has several cases where it searches for specific, hard-coded strings). .Nif files contain text notes that describe when these animations begin and end. Collada files must use a .txt file to achieve this purpose.
  • .Nif is able to store animation and skeletons separately and merge them by name. OpenMW's implementation of this behavior is not documented. I don't know how much it matters to an artist, since I assume .Nif's perform well and .dae's don't seem to have the ability to store animation separately.
  • Human characters use "body part" models which seem to have some ability to selectively hide/show parts of a .nif file and associate static, skinned geometry with animation stored in another file. It does not appear that any information exists in the .nif's about associations between geometry and animation files. The original bodies stored their skinning information in a file that seems to have links to geometry, but most of the original bodies are not skinned and are simply children of bones. It seems OpenMW chooses to show or hide the objects based on their parents, which I think are selected by a property stored in the NiTriShape node, or by name.
I was able to find the code that locates the BodyPart mesh, and it seems to select them by name. apps/opencs/view/render/actor.cpp has 'getBodyPartMesh' which gets a mesh by searching a body part from a list by name (bodyPartId). This name comes from "getPart" which is defined in apps/opencs/model/world/actoradapter.cpp. It, in turn, gets the names from components/esm/mappings.cpp . I don't have much experience with OpenMW's code, or with OOP in general, so I may have misunderstood it, but it seems that by using the names located in mappings.cpp, I can get OpenMW to load the parts correctly. I will have to test this myself to be sure. If I can figure out how to build an AUR package then I can check this a bit better.

I will need to do some investigation into this. I'd like to have the ability to replace the old skeleton with a new one. I think I can get nicer deformations with more bones. I can also correct the wrong proportions that are in the original models this way. However, if this is the case, why has the example .blend file used the same names for the skeleton and bones? Are the deform bones and such using hardcoded names, too? Oh, and I couldn't figure out how to run the test game. `openmw template.omwgame` just ran Morrowind, and the launcher's install-wizard won't select a .omwgame file. I would like to test the template.

Thanks!
Lamoot
Posts: 176
Joined: 22 Apr 2016, 12:03

Re: Replacing Animated Models?

Post by Lamoot »

josephbburg wrote: 05 Jun 2021, 01:31 OpenMW has hardcoded animations that it calls by name (the CharacterController class has several cases where it searches for specific, hard-coded strings). .Nif files contain text notes that describe when these animations begin and end. Collada files must use a .txt file to achieve this purpose.
Sounds about right.
josephbburg wrote: 05 Jun 2021, 01:31 .Nif is able to store animation and skeletons separately and merge them by name. OpenMW's implementation of this behavior is not documented. I don't know how much it matters to an artist, since I assume .Nif's perform well and .dae's don't seem to have the ability to store animation separately.
No experience with this one in OpenMW. Eventually we'd want to have a well defined workflow for this as well, so skeleton and animation files can be separate.
josephbburg wrote: 05 Jun 2021, 01:31 Human characters use "body part" models which seem to have some ability to selectively hide/show parts of a .nif file and associate static, skinned geometry with animation stored in another file. It does not appear that any information exists in the .nif's about associations between geometry and animation files. The original bodies stored their skinning information in a file that seems to have links to geometry, but most of the original bodies are not skinned and are simply children of bones. It seems OpenMW chooses to show or hide the objects based on their parents, which I think are selected by a property stored in the NiTriShape node, or by name.
josephbburg wrote: 05 Jun 2021, 01:31 ..but it seems that by using the names located in mappings.cpp, I can get OpenMW to load the parts correctly.
Morrowind originally used separate models for each body part. With .dae we tested to the point of having body parts without deformations (each body part object is assigned to a single bone). Not sure about proper, fully skinned bodies, showing and hiding different parts. Still to be fully figured out.

Body parts, as they are originally done in Morrowind, can be simple models with no weight assignments and each exported as a separate .dae file. Then in OpenMW-CS you create body part records with extra parameters and the engine uses them.
Image
josephbburg wrote: 05 Jun 2021, 01:31 Are the deform bones and such using hardcoded names, too?
They indeed use hardcoded names. Another one of those things we'd want to make more customizable in the future.
josephbburg wrote: 05 Jun 2021, 01:31 Oh, and I couldn't figure out how to run the test game. `openmw template.omwgame` just ran Morrowind, and the launcher's install-wizard won't select a .omwgame file. I would like to test the template.
The install wizard is made to look for original Morrowind content. Other mods or games need to be manually plugged into the engine. It's great that you mention this as it needs to be documented and it pushes me to do it sooner rather than later :) I'll take a look at the required steps to install custom games later today or tomorrow and let you know.
Lamoot
Posts: 176
Joined: 22 Apr 2016, 12:03

Re: Replacing Animated Models?

Post by Lamoot »

===== 0.) Example Suite / Template https://gitlab.com/OpenMW/example-suite

===== 1.) Contents of example-suite/resources/mygui need to be manually copied to resources/mygui folder of your OpenMW installation. These files provide UI font, its definition, and UI tweaks to properly show UI textures of certain elements.

Code: Select all

openmw_box.skin.xml
openmw_button.skin.xml
openmw_font.xml
openmw_windows.skin.xml
Pelagiad.ttf
===== 2.) In openmw.cfg you define the path to the Template. (For Morrowind, this is done by the installation wizard). I'm on linux and the path's I'd add would look like:

Code: Select all

data="/home/lamoot/example-suite/data"
data="/home/lamoot/example-suite"
content=template.omwgame
In addition, comment out the following lines, otherwise OpenMW will complain and not start the Template.

Code: Select all

fallback-archive=Morrowind.bsa
fallback-archive=Tribunal.bsa
fallback-archive=Bloodmoon.bsa
I also comment out these lines, so Morrowind content doesn't load at all. Otherwise, it can load the intro video and such.

Code: Select all

data="/home/lamoot/.wine/dosdevices/c:/Morrowind/Data Files"
content=Morrowind.esm
content=Tribunal.esm
content=Bloodmoon.esm

===== 3. In settings.cfg used by OpenMW add the follow lines under [Models] section to tell OpenMW which files to use for the player and sky. The lines can also be copied from example-suite/settings.cfg

Code: Select all

[Models]
# 3rd person base animation model that looks also for the corresponding kf-file
xbaseanim = meshes/BasicPlayer.dae

# 3rd person base model with textkeys-data
baseanim = meshes/BasicPlayer.dae

# 1st person base animation model that looks also for corresponding kf-file
xbaseanim1st = meshes/BasicPlayer.dae

# 3rd person beast race base model with textkeys-data
baseanimkna = meshes/BasicPlayer.dae

# 1st person beast race base animation model
baseanimkna1st = meshes/BasicPlayer.dae

# 3rd person female base animation model
xbaseanimfemale = meshes/BasicPlayer.dae

# 3rd person female base model with textkeys-data
baseanimfemale = meshes/BasicPlayer.dae

# 1st person female base model with textkeys-data
baseanimfemale1st = meshes/BasicPlayer.dae

# Argonian smimkna
xargonianswimkna = meshes/BasicPlayer.dae

# File to load xbaseanim 3rd person animations
xbaseanimkf = meshes/BasicPlayer.dae

# File to load xbaseanim 3rd person animations
xbaseanim1stkf = meshes/BasicPlayer.dae

# File to load xbaseanim animations from
xbaseanimfemalekf = meshes/BasicPlayer.dae

# File to load xargonianswimkna animations from
xargonianswimknakf = meshes/BasicPlayer.dae

# Sky atmosphere mesh
skyatmosphere = meshes/sky_atmosphere.dae

# Sky clouds mesh 
skyclouds = meshes/sky_clouds_01.osgt

# Sky stars mesh 01
skynight01 = meshes/sky_night_01.osgt
===== 4. Run OpenMW (a recent development build, 0.46 won't work!) and enjoy the empty island. If it doesn't work, let me know and we'll find material to write step 5. :)
Post Reply