Author Topic: FF7 animations import and export  (Read 7534 times)

picklejar

  • *
  • Posts: 147
    • View Profile
FF7 animations import and export
« on: 2019-02-26 17:55:01 »
So, I know there are a few tools out there that can import FF7 models, and even a couple that can display the animations, but are there any tools that can export the animations to a more popular format like obj or fbx?

If not, I am seriously considering writing such a tool. Many years ago I already wrote a program, using the great data on this forum about the file formats, that could read FF7 model and animation files and display the animations. So all I'd need to do is learn a popular file format (perhaps obj or fbx) and write the export logic.

But before I go down this path... are there any tools out there that already do this?

And if I end up writing such a tool, does anyone have any feature requests?

picklejar

  • *
  • Posts: 147
    • View Profile
Re: FF7 animations import and export
« Reply #1 on: 2019-02-26 19:40:11 »
BTW, after some research, the OBJ format does not store animations. So, I'm likely to go with something like FBX or COLLADA.

The main requirement for my personal short-term needs is, I need the ability to translate FF7 models + textures + animations into another format that can be easily imported into *Unity* with minimal adjustments. However, other people will have different needs (and I might have different needs long-term), so I'm trying to choose a file format that can also be easily imported into other popular programs like Blender, Sketchup, 3DSMax/Maya/AutoDesk, etc.
« Last Edit: 2019-02-26 19:43:13 by picklejar »

obesebear

  • *
  • Posts: 1389
    • View Profile
Re: FF7 animations import and export
« Reply #2 on: 2019-02-27 02:56:24 »
No tool currently exists to export animations. If you create one that successfully converts them to a usetable format then back again that would be very helpful for editing them to be more natural. Kimera can edit animations a and I think there is a source code, so that may be of some help
« Last Edit: 2019-02-27 16:48:12 by obesebear »

Kaldarasha

  • *
  • Posts: 2449
  • Prince of Model Editing
    • View Profile
Re: FF7 animations import and export
« Reply #3 on: 2019-02-27 09:08:35 »
Could you join our discord server please and go in contact with Red XIV? He wanted to write a new Kimera, though after a discussion with quantumpencil we decided it would be better to port the files to a much more universal file format for better editing. Here is the source of Kimera: https://github.com/RedXIV2/kimera

Some additional sources which might be useful:
http://forums.qhimm.com/index.php?topic=17754.0
https://github.com/jacobvalenta/ffimport
« Last Edit: 2019-02-27 10:12:27 by Kaldarasha »

RedXIV

  • *
  • Posts: 2
    • View Profile
Re: FF7 animations import and export
« Reply #4 on: 2019-02-27 10:23:36 »
Hey picklejar!

I'm half looking into this when I have the time but would be great to get someone who has experience in the area. I was looking at blender compatibility originally but happy to have further discussions if you have more thoughts on it and it's future?

Discord may suit better for that though?

picklejar

  • *
  • Posts: 147
    • View Profile
Re: FF7 animations import and export
« Reply #5 on: 2019-03-01 02:09:52 »
Thanks for the replies, guys! Glad to hear there's a discord now! (IRC is boss, but old.) Anyway, I'll probably hop into Discord in a couple of days.

I'd like to go ahead and share some thoughts in the meantime. Especially around tool design decisions.

First, let's consider two different goals:
Goal #1 is "play custom models in FF7"
Goal #2 is "use FF7 models as content for creating new games to play on a modern platform"

Now, let's consider some workflows:
Workflow #1 = import FF7 models into Kimera, edit them within Kimera, export from Kimera < provides updated FF7 models
Workflow #2 = import FF7 models into "FF7 model translator", export them to universal format < provides translated FF7 models
Workflow #3 = import universal models into "modern model editor program", export as universal format < #2 + #3 = updated FF7 models in universal format
Workflow #4 = import universal models into "FF7 model translator", export as FF7 format < #2 + #3 + #4 provides updated FF7 models

The great thing about Workflow #1 is, you don't have to worry about universal formats, and it's the shortest path to playing FF7 with updated models. But the big disadvantage that I don't like is, you have to maintain Kimera, which requires expertise in models and animations and programming.

So, what if we don't want to reinvent the wheel and develop and maintain software involving editing 3D models? That's where Workflows #2, #3, #4 come in. You don't need a graphical editor. You can just a modern editor. So, we only need to be experts on translating back and forth between the FF7 file format and modern file format(s).

So, I'm leaning towards Workflows #2, #3, #4.

I've chosen FBX as the first universal format to support. So far, I've already successfully created a model of Cloud's head in FBX format. Next steps would be skeleton, textures, animations. At that point, they'd be usable in just about any modern game engine, but not FF7. If anyone really wants to use universal models in FF7, then we just need Workflow #4.

Curious to know others' thoughts. But, yeah, maybe Discord would be best. On that note, sorry for the long post. :)

obesebear

  • *
  • Posts: 1389
    • View Profile
Re: FF7 animations import and export
« Reply #6 on: 2019-03-01 02:16:07 »
Working with animations in kimera is a nightmare. It's awesome that borde implemented it, but editing them leaves a lot to be desired

picklejar

  • *
  • Posts: 147
    • View Profile
Re: FF7 animations import and export
« Reply #7 on: 2019-03-01 11:33:07 »
BTW, I found RedXIV and quantumpencil in Discord (ff7 #tools), and I look forward to other people joining. We're in different time zones, so discussion is not always real-time.

Meanwhile, I've been thinking about what Kaldarasha said:

Quote
Could you join our discord server please and go in contact with Red XIV? He wanted to write a new Kimera, though after a discussion with quantumpencil we decided it would be better to port the files to a much more universal file format for better editing.

By "universal format", initially I was thinking of something like FBX or COLLADA. But now I'm thinking it would be better to do a more generic intermediate format like YML, JSON, XML. That way, others could easily write tools to translate from this generic intermediate format to any format they want. (Since importing from FF7 format or FBX format or COLLADA might be prohibitive, depending on what programming language the author wants/needs to use.)

I encourage everyone to participate in Discord, and/or to contribute "longer" ideas to this thread...

picklejar

  • *
  • Posts: 147
    • View Profile
Re: FF7 animations import and export
« Reply #8 on: 2019-03-01 11:36:28 »
BTW, one of the challenges with the models and animations is that they aren't labelled. So it's not obvious that AAAA is Cloud, nor that BYAB is a "running animation for skeletons that have 7 bones".

Kimera mentioned a "database" for this stuff. Where can I get that, and how complete is it? If it's not complete, I was considering using a tool like Makou Reactor to track which animations are used in which situations, to figure out the more mysterious ones. Was even considering writing a tool to let others contribute to this effort by writing a simple web app to display the animation and let people write a description of what it is.

Sega Chief

  • *
  • Posts: 4086
  • These guys is sick
    • View Profile
Re: FF7 animations import and export
« Reply #9 on: 2019-03-01 14:47:26 »
This file is old and has gaps but it lists majority of field models + animation descriptions. Some might be quite vague, or be identified using quotes from the game that I remembered being used as those anims played; it was for personal reference rather than a public database and not used it in a long time.

Some models have a code next to them, I think this is for their mouth tex file. My first mod was to remove/replace these with a blank one or the ones used by main characters so it's a leftover note.

https://pastebin.com/kqrmUt5s


This might be the database Borde referred to (loaded slow for me so give it a few seconds if it doesn't load right away):
https://docs.google.com/spreadsheets/d/1OnCCU0OfV4khZ5eDOyBv-TADnWmvxGnqM3BV-KRqf7g/pub?gid=3

And the wiki has its own for character models that has a picture of each one:
https://finalfantasy.fandom.com/wiki/User:JBed/FFVII/Characters?useskin=oasis
« Last Edit: 2019-03-01 14:52:56 by Sega Chief »

picklejar

  • *
  • Posts: 147
    • View Profile
Re: FF7 animations import and export
« Reply #10 on: 2019-03-02 14:58:03 »
Thanks, great info! First link will definitely help jump-start the "database". 2nd link, I tried, but the owner will need to approve my access. Third link was a pretty good reference, too.

In discord we've had some great discussion. We're going to try COLLADA for an intermediate format. I've been able to export a simple mesh of Cloud's head to COLLADA and import into Unity. I'll also be testing Blender import. Anyway, will keep people posted.

picklejar

  • *
  • Posts: 147
    • View Profile
Re: FF7 animations import and export
« Reply #11 on: 2019-03-06 13:02:55 »
Update: Tool can now translate "polygons with vertex colors" and "polygons with textures" for a single *.RSD file (e.g. AAAF.RSD = Cloud's head) to COLLADA and import into Unity.

Next step: translate and import entire skeletons (*.HRC) and animations (*.A). After that, will probably publish to GitHub and start testing Blender import, displaying models on the web, start adding export support, etc.

picklejar

  • *
  • Posts: 147
    • View Profile
Re: FF7 animations import and export
« Reply #12 on: 2019-03-06 18:40:13 »
screenshot:



obesebear

  • *
  • Posts: 1389
    • View Profile
Re: FF7 animations import and export
« Reply #13 on: 2019-03-06 22:44:59 »
Keep up the good work!

picklejar

  • *
  • Posts: 147
    • View Profile
Re: FF7 animations import and export
« Reply #14 on: 2019-03-10 23:30:17 »
Update: I have decided to go with FBX instead of COLLADA, because Unity can't import COLLADA animations.

I've made great progress and plan to soon-ish provide a GitHub repo with the following assets:

* program to translate field files to JSON, for db/stats/debugging/browsing purposes
* program to translate to FBX (models, textures, animations)
* sample output FBX and JSON for others to test

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Re: FF7 animations import and export
« Reply #15 on: 2019-03-14 02:41:28 »
*coffin slowly opens*

I've heard that glTF is all the rage now for cross-platform assets

*coffin creaks closed again*

picklejar

  • *
  • Posts: 147
    • View Profile
Re: FF7 animations import and export
« Reply #16 on: 2019-03-14 03:23:57 »
Wow, thanks halkun, I don't know how glTF escaped my initial searching around for potential formats. It's pretty much exactly what I wanted in the beginning: a universal format in JSON. I'll definitely be looking into it.

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Re: FF7 animations import and export
« Reply #17 on: 2019-03-14 15:33:03 »
*click*
CREEEEEEEAK

Not only is it JSON, you can embed textures into the glTF file and make it a single binary file. (glb)

CREEEEEEEAK
*ka-chunk*

picklejar

  • *
  • Posts: 147
    • View Profile
Re: FF7 animations import and export
« Reply #18 on: 2019-03-14 22:18:18 »
Yep, browsed the spec earlier today. Looks extremely promising.

The problem is, although glTF importers/exporters exist (e.g. for Blender, Unity, etc.), they seem to be in "beta" and have tons of issues created in their respective github repos.

And I already just developed a translator for FBX (and before that, for COLLADA, and before that, for Java3D). I know FBX will work, and it's 95% done.

So, I'm very torn. (FBX is so prevalent, and it's done, but it's proprietary. glTF is "open" and probably going to be "the future", but will take more time investment.)

Damn you, halkun, I was happier before you told me about glTF. Ignorance is bliss. You just had to give me useful information, didn't you?

It's okay, I see that you have already thought on your sins, and took a lesson from Vincent, and went back inside your coffin to atone!

LordUrQuan

  • Alpha testing your worst nightmares
  • *
  • Posts: 602
  • LOAD "FF2J",8,1
    • View Profile
Re: FF7 animations import and export
« Reply #19 on: 2019-03-15 01:43:39 »
Obviously I'm a leech and not a creator (yet, anyways), but my suggestion would be to finish off the FBX project since it's basically finished, put it out in the wild and see what the unwashed masses think of it, then apply the useful comments when working up the glTF-based v2.

picklejar

  • *
  • Posts: 147
    • View Profile
Re: FF7 animations import and export
« Reply #20 on: 2019-03-15 17:41:27 »
sounds sensible to me!

picklejar

  • *
  • Posts: 147
    • View Profile
Re: FF7 animations import and export
« Reply #21 on: 2019-03-15 18:05:57 »
Regarding the FF7 field model data, does anyone know:
Q1: Does ff7 consider positive y direction to be up, or some other axis+direction?
Q2: Does ff7 use a right-handed coordinate system or a left-handed coordinate system?

The reason I ask is, after importing the field model+anim data (e.g. for Cloud) and displaying it, Cloud is upside-down.

The way I "fixed" this is to just manually apply a 180-degree rotation to the "root bone". I looked at the Kimera code, and although I don't understand it fully, Kimera seems to do something similar (e.g. in FF7HRCSkeleton.bas, line 247, it does "AAnim.Frames(0).Rotations(0).Gamma = 180"). But this seems "hacky" to me.

So, I was wondering if maybe we've been interpreting the data wrong, and just living with it in some way?

So, I actually ran an experiment to vary the following factors:
  • whether the coordinates in the file are in x, y, z order or some other order (6 possible combinations)
  • whether to apply rotations in y, x, z order, or some other order (6 possible combinations)
  • whether to apply rotations in counterclockwise or counterclockwise order (2 possible combinations)
  • which direction to move child bones from parent bones, e.g. "in the negative-z direction" (6 possible combinations)

The results were very interesting...

Oops, my lunch break is over, and I need to run to a work meeting now, but... I'll be back soon to share the results...


picklejar

  • *
  • Posts: 147
    • View Profile
Re: FF7 animations import and export
« Reply #22 on: 2019-03-17 20:33:29 »
BTW, after talking with people on Discord and working with glTF, I've decided to pursue that as the universal data model. I've already started developing the new translator and got vertexes, normals and vertex colors working, outputting a mix of json and binary OpenGL data. Will keep posting here occasionally with progress. The main discussion medium for this will be Discord (FF7 #tools thread).

picklejar

  • *
  • Posts: 147
    • View Profile
Re: FF7 animations import and export
« Reply #23 on: 2019-03-25 17:34:05 »
Finally got a release out. So I've created an official post in the FF7 Tools forum: http://forums.qhimm.com/index.php?topic=18724.0