Author Topic: FF9 models: how to match the right anims and textures?  (Read 25429 times)

Chev

  • *
  • Posts: 36
    • View Profile
Greetings

I've been trying to build a model viewer for FF9 and to this end this forum with Zande and Zidane's posts and the wiki have been of great use.

I'm able to get bones, vertices and faces without any problem now, but as I started tackling animations I realized I have no idea how to tell which animation goes with which model. Right now I'm matching a given model with the animations present in the same DB data cluster but there's really no reason that should be right, and that makes it tricky to be certain I'm decoding the angles accurately in the first place... It's not an assumption I can make for textures anyway, since so far I haven't found a TIM file in the same DB cluster as models.

So I was wondering if there's anything about it that any of you may known on the subject but isn't wikified yet? I guess I should look into the six unknown bytes of the model header...

Here's a boneless taxi from lindblum, just to show:


EDIT: And an amusing victim of mad chocobo disease
« Last Edit: 2009-08-06 18:25:52 by Chev »

Satoh

  • *
  • Posts: 386
  • Assuming this statement is correct, I'm alive.
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #1 on: 2009-08-06 21:35:52 »
I commend you sir!

EDIT: Now that dinner is done, I can say a bit more...


Anyway two things: Be sure to include an export function XD; I so badly want those FFIX models...

And there was a program around at one point that could render models with no bones and had full texture functionality... otherwise you could simply have the program load textures as a separate file and apply whatever texture is loaded to the current model...


Are are you referring to finding the UV information... UV maps I have no idea about, but I'm sure the battle models contain their textures inside them/directly after them.

Anyway, you definitely have my interest.
« Last Edit: 2009-08-07 00:22:11 by X-Dina »

Zande

  • *
  • Posts: 55
  • 友情は武器よりも強し
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #2 on: 2009-08-07 01:28:20 »
You probably want to stick to using the models and animations that are stored within the same block/cluster for now. This should work fine with playable characters and monsters, which stores meshes, animations and textures together in one place.

Getting the animation IDs for certain models can be abit tricky.
Monsters stores some common animation IDs (such as death and idle animations) inside the stats chunk (together with HP, strength, drops et cetera). Appart from that, animations monsters uses for attacks/abilities are stored within the event script data. Both the event data and stats (together with string and abit of other data) is stored at one place (stored on a battle formations basis) seperated from the mesh/animation and texture data.

The data for NPC and object meshes (like the Lindblum taxi and Chocobo) are stored together at one place together with alot of different data (sprites for example), and their animations IDs are usually found within large event scripts.
« Last Edit: 2009-08-07 01:30:20 by Zande »

Chev

  • *
  • Posts: 36
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #3 on: 2009-08-07 04:46:16 »
X-dina> I've got the UVs alright, I'm referring to the actual textures. I'll do my best for an exporter once I get the right data.

Zande> Thanks for the info! I guess I'll just put in a nice handy button for cycling through the available anims and match them visually.

I indeed noticed there seemed to be some pattern to how NPC data was grouped. Since here it's grouped with field data (in my taxi screenshot the last line is the contents of the DB cluster around the opened model) I think that in the directory I opened (04 IIRC) DB clusters represent rooms, which would explain just about all the model grouping and redundancy (looks like each room store their NPCs) that's happening.

Glorious EDIT: I get anims now. Well, mostly. Still having trouble with the lower four bits of each angle, I need to remodel my app a bit before I can do it the right way. ANimes look pretty good already though. I'll also have to make a faster animation routine, right now I'm doing it in a very slow way.

So, rooms indeed contain the anims for their occupants, but some also contain anims that don't match any of their contents. I guess those are for scripted scenes where the player characters must move in specific ways.

« Last Edit: 2009-08-07 16:20:01 by Chev »

Zande

  • *
  • Posts: 55
  • 友情は武器よりも強し
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #4 on: 2009-08-07 16:47:26 »
Good job! The textures for playable characters and enemies should be a cakewalk, stored in the same place as the meshes/animations and are standard TIMs. The textures for NPCs and other objects are abit trickier though, have to read other chunks (0x0A I think, but unsure) when working with them.

Satoh

  • *
  • Posts: 386
  • Assuming this statement is correct, I'm alive.
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #5 on: 2009-08-07 17:53:05 »
So, rooms indeed contain the anims for their occupants, but some also contain anims that don't match any of their contents. I guess those are for scripted scenes where the player characters must move in specific ways.[/URL]

That seems likely, I think similar things were done in 7 and 8 as well as parts of 10 possibly... I can't think of what it was but I know there was another game I looked into that Chrono Cross NPC's had animation data stored that way as well IIRC...

I recognize Steiner and Garnet with her hood down in those last two frames...  This is getting exciting... Oh, and even if you don't have an export function, if it's programmed in Direct X 9/10 I should be able to rip... though exporting would be preferable...

Getting very exciting....

obesebear

  • *
  • Posts: 1389
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #6 on: 2009-08-07 18:29:49 »
Getting very exciting....
No kidding!  Great work here!  It's taken quite a long time, but it seems like some real breakthroughs are on the way concerning FF9

Chev

  • *
  • Posts: 36
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #7 on: 2009-08-07 18:32:45 »
Well, for now I'm really just applying all the wonderful work others have accomplished. There's nothing my program does that hasn't been written in the wiki  :-)

Chev

  • *
  • Posts: 36
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #8 on: 2009-08-11 16:57:27 »
As you can see I've got textures now. The trick is they're not stored in the exact same cluster instead they're in another cluster that's got the same parent cluster as the one the models are in. I used the material indices to choose what texture to use, because I couldn't be bothered to figure out chunk 0x12 (contains CLUT and tpage for models, says the wiki), and it worked fine with monsters and party members but it'll probably be a problem for NPCs, so next phase will be to understand chunk 0x12.


Satoh

  • *
  • Posts: 386
  • Assuming this statement is correct, I'm alive.
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #9 on: 2009-08-11 17:57:30 »
As you can see I've got textures now. The trick is they're not stored in the exact same cluster instead they're in another cluster that's got the same parent cluster as the one the models are in. I used the material indices to choose what texture to use, because I couldn't be bothered to figure out chunk 0x12 (contains CLUT and tpage for models, says the wiki), and it worked fine with monsters and party members but it'll probably be a problem for NPCs, so next phase will be to understand chunk 0x12.



Do I see my lovely face-sake in there? I have to have a copy of this when you finish it. Keep it up, you're fulfilling one of my dreams here...

Chev

  • *
  • Posts: 36
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #10 on: 2009-08-12 17:10:14 »
Got good news and bad news

Good news are, I can see all weapons too, with textures. Only wireframe for NPCs and map models though, can't find the textures. Also the directory supposedly containing the summons seems to have a different structure, can't read it yet.

Bad news is, my PC was taken out by a trojan. I haven't lost everything, but the project will have to be on hold for a while.

Satoh

  • *
  • Posts: 386
  • Assuming this statement is correct, I'm alive.
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #11 on: 2009-08-12 18:42:24 »
Got good news and bad news

Good news are, I can see all weapons too, with textures. Only wireframe for NPCs and map models though, can't find the textures. Also the directory supposedly containing the summons seems to have a different structure, can't read it yet.

Bad news is, my PC was taken out by a trojan. I haven't lost everything, but the project will have to be on hold for a while.

This makes me very sad...and a little bit angry... what purpose do viruses serve!? Why do people make them!!? Do they have any idea how long it can take to restore a computer to it's original state? BASTARDS!

Zande

  • *
  • Posts: 55
  • 友情は武器よりも強し
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #12 on: 2009-08-12 21:03:44 »
Also the directory supposedly containing the summons seems to have a different structure, can't read it yet.

It's a bit different, although the actual data is in the same format (just doesn't have the DB chunk headers). It's padded with 0xFF instead of zero also.
For the 3D model data, you'll have to work with the B and C polygon types, they are only used for summon models. I'll see if I can dig out some old code with a somewhat decent description of them.

Edit:
I was bored...
...so bored
« Last Edit: 2009-08-13 00:26:29 by Zande »

Chev

  • *
  • Posts: 36
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #13 on: 2009-08-13 04:47:02 »
Oh duh! Now you mention it I remember reading about that around here before! well, that'll be the next step once I get my new computer then

EDIT: Ok, up and running again. But I have to confess I can't wrap my mind around the summon directory. It's one of those type 0x03 hierarchical directories, right? So that means what's listed inside is subdirectories? But how do you know how many files each subdirectory contains? Are there headers for them?

EDITEDIT: it's now been remade to use shaders for animation, which is much better (despite being visually identical). Also finally realized what I'd gotten wrong with the lower bits of angles: they're optional, some anims don't contain them, signalled by a zero offset. I can kinda detect which anims match which models now - sorta. The method gives false positives so you can get some aberrant anims, but it's better than nothing. I still don't get how to go through the summons (well, effects, really) directory or find the character textures in the room/worldmap clusters.

I was wondering about exporting though. I wanted to use .OBJ format but it doesn't allow animations...
« Last Edit: 2009-08-18 16:34:27 by Chev »

Satoh

  • *
  • Posts: 386
  • Assuming this statement is correct, I'm alive.
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #14 on: 2009-08-18 17:17:40 »
Oh duh! Now you mention it I remember reading about that around here before! well, that'll be the next step once I get my new computer then

EDIT: Ok, up and running again. But I have to confess I can't wrap my mind around the summon directory. It's one of those type 0x03 hierarchical directories, right? So that means what's listed inside is subdirectories? But how do you know how many files each subdirectory contains? Are there headers for them?

EDITEDIT: it's now been remade to use shaders for animation, which is much better (despite being visually identical). Also finally realized what I'd gotten wrong with the lower bits of angles: they're optional, some anims don't contain them, signalled by a zero offset. I can kinda detect which anims match which models now - sorta. The method gives false positives so you can get some aberrant anims, but it's better than nothing. I still don't get how to go through the summons (well, effects, really) directory or find the character textures in the room/worldmap clusters.

I was wondering about exporting though. I wanted to use .OBJ format but it doesn't allow animations...

Well... OBJ is becoming the de facto standard for 3D files recently.... everything can open it... animations though... I never expected you'd export those at all really...

Check 3DS it may have nonskeletal animation capabilities....

You could always export animations as a separate file and let people work on an import/export script to open them in various apps... but you'd need a format that supports skeletons still...

*while typing, I am reminded of morrowind's Nif / Kf(sp?) combo...*

figment

  • Guest
Re: FF9 models: how to match the right anims and textures?
« Reply #15 on: 2009-08-19 05:25:39 »
Nice work.  Sucks about the machine.

Animation usually sucks since there really isn't an good general format.  3DS is probably the best format widely adopted that allows for animation its but not really that good for storing multiple animations in my experience.

BVH is probably the closest to OBJ in simplicity but good luck trying to use that in max on a skeleton.  I might recommend using another game format like Half Life's smd or Unreal's psk/psa formats.  Both games have a number of importers/exporters for a variety of modeling tools and have reasonably simple text formats as I recall.  Gamebyro's NIF/KF are binary and very complicated so no go there but the (optional) separate files is nice when you have need to manage several animations for playback.

I might suggest FBX or COLLADA if you are a masochist.  Autodesk which owns nearly every modeling tool anymore supports both in some form for max, maya and xsi.  In practice both are too specific and difficult to work with in multiple tools probably ok if you stick to only one tool chain.

Satoh

  • *
  • Posts: 386
  • Assuming this statement is correct, I'm alive.
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #16 on: 2009-08-19 05:56:14 »
I'd seriously be happy with just a bind-pose export really... Animations would be EPIC... but a basic pose like FFX/FFVIICC/KH/KHII/etc have for their viewers would still be awesome in my opinion....

Chev

  • *
  • Posts: 36
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #17 on: 2009-08-19 17:08:30 »
The thing is, unlike KH there's no bind pose, it's implicit since the vertices are directly stored in bone space. What that means is the characters look like origami, or maybe like they fell into a metal compacter, unless you assign an anim to them

Satoh

  • *
  • Posts: 386
  • Assuming this statement is correct, I'm alive.
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #18 on: 2009-08-19 19:31:21 »
I see... that is the oddest thing I've ever heard... I suppose it works though...

Chev

  • *
  • Posts: 36
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #19 on: 2009-08-19 19:49:32 »
It actually makes a lot of sense. If you don't store the vertices in bone space you have to transform them by the inverse of the bind pose before you can put them in another pose, which means at minimum one more matrix operation per bone, and that's assuming you've memorized all the inverse transforms. It may be okay for modern machines with memory and power to spare but for FF9 they probably valued such an optimization.

And once you store vertices in bone space there's really no point in storing the bind pose, since it's the one pose you never use in-game.

Satoh

  • *
  • Posts: 386
  • Assuming this statement is correct, I'm alive.
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #20 on: 2009-08-19 20:06:08 »
I see... so in order to export at all, you still need a way to store the animations... or at least the first frame of one...

Couldn't you use the first frame of the standing animation for more models?

Chev

  • *
  • Posts: 36
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #21 on: 2009-08-19 22:02:47 »
well, each model has its animations in its own order so choosing an appropriate pose can't be automated. But really, my interrogations revolve around which format to choose to keep the hassle to a minimum, not whether to include the anims or not.

Satoh

  • *
  • Posts: 386
  • Assuming this statement is correct, I'm alive.
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #22 on: 2009-08-19 23:19:45 »
well, each model has its animations in its own order so choosing an appropriate pose can't be automated. But really, my interrogations revolve around which format to choose to keep the hassle to a minimum, not whether to include the anims or not.

Ok, well... if you're using DX9... 3D Ripper will work on it... so we could capture any frame from any animation...

Or, you could make a manual animation scrub-through option and use whatever frame is currently showing as the bone position, thus taking away the automation issue...


As for formats... if you can transcribe the vertex positions relative to the bone positions into absolute positions then OBJ would be fine. But you wouldn't, obviously, have animations themselves...

BlitzNCS

  • *
  • Posts: 889
  • Master of nothing in particular
    • View Profile
    • My Youtube
Re: FF9 models: how to match the right anims and textures?
« Reply #23 on: 2009-08-19 23:31:18 »
Collada (.DAE file) Might be a good choice. the FFX/FFX-2 model viewers use it to export model and animation data together.

Satoh

  • *
  • Posts: 386
  • Assuming this statement is correct, I'm alive.
    • View Profile
Re: FF9 models: how to match the right anims and textures?
« Reply #24 on: 2009-08-19 23:33:22 »
I know collada is supported by maya and I believe it is with max as well... but I have no idea how flexible it is for programming...