Join also our Discord channel! Click here.

Dark Souls FLV file

Post questions about game models here, or help out others!
fatduck
mega-veteran
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 93 times

Re: Dark Souls FLV file

Post by fatduck » Tue Jun 18, 2013 12:26 pm

nyxo wrote:I'm currently working on the bones so I can start posing the character, and then I'll be jumping into the animation system, which I suspect won't be too terrible to work with once I have the bones setup properly. Does anybody have any insight into the format of the bone information in the .flver file yet?

I'm planning to make another post in the not-too-distant future with some more technical details about the file format, for those interested.
I have the Skeleton struct form GUNDAM UC, and I recall it works on Dark Souls I & II as well !?
The bone data start right after material data and the format:

Code: Select all

struct Bone {
 float[3]	TranslateXYZ
 dword		ofsBoneName
 float[3]	RotationXYZ	//in radian
 word		ParentID
 word		Idx1?
 float[3]	ScaleXYZ
 word		Idx2?
 word		Idx3?
 float[20]      ?		//forgot what they are now!
}
hope these help.
No more Fatduck, no more FatImporter, Byebye everyone!

nyxo
advanced
Posts: 68
Joined: Sun Jan 06, 2013 3:54 am
Been thanked: 17 times
Contact:

Re: Dark Souls FLV file

Post by nyxo » Tue Jun 18, 2013 1:03 pm

Hmm, that's mostly what I've got too, although I haven't gotten to the point of inspecting the rotation on whether it's degrees or radians- I'll have to look into that!

I also have some notes on Idx1, Idx2, and Idx3, although it's all speculation at this point:
Idx1 I have labelled as "FirstChildIndex" because it always seems to be for a child bone, Idx2 I have labelled as "FirstSiblingIndex" because it always seems to be for a sibling bone, and Idx3 I have labelled as "CopyOfIndex" because it always seems to be for a somewhat related bone (say the shin vs thigh, or r_clavicle vs l_clavicle).

Also within that last array of floats, I have notes that elements 0-2 are the lower bounding box, and 5-7 are the upper bounding box, however these are based only on notes from vlad001's source code at this time.
~Nyxo~
||| Twitter ||| Youtube |||

TehDave
advanced
Posts: 74
Joined: Tue Apr 21, 2009 5:24 am
Has thanked: 10 times
Been thanked: 5 times

Re: Dark Souls FLV file

Post by TehDave » Wed Jun 19, 2013 1:28 am

Amazing work, nyxo.

You should take a look at Demon's Souls after you finish with Dark Souls' file formats, the formats for Demon's Souls are pretty much identical to Dark Souls.

nyxo
advanced
Posts: 68
Joined: Sun Jan 06, 2013 3:54 am
Been thanked: 17 times
Contact:

Re: Dark Souls FLV file

Post by nyxo » Wed Jun 19, 2013 1:43 am

I'm mildly interested in that, but significantly moreso than that, I'm interested in Dark Souls 2, when it comes out! You can be sure I'll be poking at that when the time comes~ ^-^v
~Nyxo~
||| Twitter ||| Youtube |||

nyxo
advanced
Posts: 68
Joined: Sun Jan 06, 2013 3:54 am
Been thanked: 17 times
Contact:

Re: Dark Souls FLV file

Post by nyxo » Wed Jun 19, 2013 6:25 am

So here's some WIP structures that I'm currently looking at.

First, what appears to be matrices- these are stored before the materials, but I'm not 100% sure what they're really for, and a bunch of the values are speculation at best, as I haven't had a chance to map them across the actual mesh yet.

Code: Select all

typedef struct {
    Vector3_Float Row1;
    byte Unknown1;  //Always 0xFF
    byte UnknownID1;
    short Unknown2; //Always 0xFFFF or 0x0000
    Vector3_Float Row2;
    short UnknownID2;
    short UnknownID3;
    Vector3_Float Row3;
    short Unknown3;
    short Unknown4;
    byte Null[16];
} MatrixStruct;
Secondly, the bone data, as far as I've got it. The thing to note here tho, is that I haven't managed to get it perfectly set up with the mesh data- I'm fairly confident that my hierarchy isn't 100% correct, and it almost looks like a portion of it is actually rotated on one of the axes.

Code: Select all

typedef struct {
    Vector3_Float Translation;
    NameStruct Name;
    Vector3_Float Euler;
    ushort ParentIndex;
    ushort FirstChildIndex;
    Vector3_Float Scale;
    ushort FirstSiblingIndex;
    ushort CopyOfIndex;
    Vector3_Float BBLower;
    ushort IsNub;
    ushort Unknown6;
    Vector3_Float BBUpper;
    ushort Unknown7;
    ushort Unknown8;
    uint Unknown9[12];
} BoneStruct;
I've also been looking at the VertexDescriptors and Vertex data to try and find the bone assignments/weights, but haven't had huge luck with that yet. I'm relatively confident that VertexDescriptors with a DataType of 0x1A and 0x11 are the values we want to look at, but I haven't yet found a combination that works properly for all the bones. 'Course, the success of this relies partially on the bones actually being positioned correctly, hence the above speculations regarding the matrices and bones. ^-^

I'll look more into this tomorrow morning for a couple hours, but after that I won't have a chance until after work the day following. Sometime from then through the weekend I'm hoping to have a chance to put together a decent file description of the .flver format- although what I might do instead is just release my 010 Editor template, since it breaks the data all up beautifully not only in the editor, but in relatively easy-to-read C style structs.

Actually, now that I've typed that out, I'm pretty sure that's the way to go. I also have 010 Editor templates for a bunch of the other formats, so that would be convenient.
~Nyxo~
||| Twitter ||| Youtube |||

fatduck
mega-veteran
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 93 times

Re: Dark Souls FLV file

Post by fatduck » Wed Jun 19, 2013 3:09 pm

First of all, I don't know what ver of FLV you are looking for:

Code: Select all

struct HEADER {
 char[6]	PhyreID		//"FLVER\0"
 word		Endian
 word		Ver_Major
 word		Ver_Minor
 long		ofs...
 ...
}
That what I can remember ATM.

And Gundam UC use Ver 2.14.

Right after the header, there are a group of 0x40 bytes each data which I am pretty sure they are not related to bones!

then material and then bones data

all these bones data are in local coordinate which means you have to transform then with their parent coordinate.
I use thisBoneMatrix *= thisBone.parent.BoneMatrix to get the proper result. They are perfectly fine in Gundam UC.

About the the bones indices / skin weight data.
Do you know there is a chunk of vert-Info to tell you how the elements combine into a single vert(I call it vert Info).
It's something like:

Code: Select all

Struct VertInfo {
 dword		ElementID
 dword		ofs_Single_VT
 dword		?
 dword		Element_Type	//0 = coordinate, 1 = weight, 2 = bone index, 4 = UV, 10 = VertColor
 dword		?
}
Image
Last edited by fatduck on Thu Jun 20, 2013 12:25 am, edited 1 time in total.
No more Fatduck, no more FatImporter, Byebye everyone!

nyxo
advanced
Posts: 68
Joined: Sun Jan 06, 2013 3:54 am
Been thanked: 17 times
Contact:

Re: Dark Souls FLV file

Post by nyxo » Wed Jun 19, 2013 11:58 pm

Hi fatduck! Thanks for the info!
The version bytes in the files I currently have open are 0x0C000200.
Yes, I could see that the bones are in relation to their parents, however I'm having issues properly forming the hierarchy of bones. The bone struct I have so far:

Code: Select all

typedef struct {
    Vector3_Float Translation;
    NameStruct Name;
    Vector3_Float Euler;
    ushort ParentIndex;
    ushort FirstChildIndex;
    Vector3_Float Scale;
    ushort FirstSiblingIndex;
    ushort CopyOfIndex;
    Vector3_Float BBLower;
    ushort IsNub;
    ushort Unknown6;
    Vector3_Float BBUpper;
    ushort Unknown7;
    ushort Unknown8;
    uint Unknown9[12];
} BoneStruct;
If I assume that the ParentIndex value is correct (and assuming that a value of -1 means "no parent"...), I can form something similar to the hierarchy I'm expecting. However, I'm finding that there is a very large number of bones that have no parent defined in this way.

Also, I'll have to look into it further, (won't have a chance until tomorrow morning at best) but my initial tests make it appear as if the lower half of the body (say, pelvis and down) is not only a separate hierarchy than the upper part, but they look like their axes are completely different than the upper part >_<;; Like I said, I'll be looking into that again soon here.

What method did you use to construct your hierarchy for Gundam?

Yes, I'm aware of the vert-info (I call it VertexDescriptor) struct-- this is mine:

Code: Select all

typedef struct {
    uint StreamDescriptorCount;
    uint Unknown1;
    uint Unknown2;
    uint Offset;
    StreamDescriptorStruct StreamDescriptors[StreamDescriptorCount];
} VertexDescriptorStruct;
typedef struct {
    uint Unknown1;
    uint Offset;
    uint DataType;
    uint Semantic;
    uint Index;
} StreamDescriptorStruct;
I'm rather unsure of whether I should be using StreamDescriptorStruct.Semantic or StreamDescriptorStruct.DataType to determine what type the piece of data it's pointing to, but using either seems to give me the same results. In my example mesh, I've found that there's 2 "DataType" values that are as-yet undefined in my structure, 0x11 (4 bytes/vertex) and 0x1A (8 bytes/vertex).

Do you have any information about how I would parse these values into useable bone assignment/weights? I've tried a couple of the obvious things, such as straight up reading a byte and using that value as the bone index, but it seems to give incorrect bones. (For example, the vertices on the gauntlets of a character would then point at the "Spine" bone...)

Thoughts?
~Nyxo~
||| Twitter ||| Youtube |||

nyxo
advanced
Posts: 68
Joined: Sun Jan 06, 2013 3:54 am
Been thanked: 17 times
Contact:

Re: Dark Souls FLV file

Post by nyxo » Sat Jun 22, 2013 4:24 am

Okay guys, I've just got the bones loading in, as well as some sort of bounding boxes that accompany the bone information.
Image

Some of this you can see in the screenshot:
  • There's a couple bones with strange parenting (maybe I'm not doing it right?), and there's got to be something I'm missing with a bunch of these bones, as there's 28 bones without a parent, all sitting down between his feet.
  • There's a couple that are named with some variation of "dummy", so I can't trust them to be correct, but there's a dozen that are named "<something>Nub", which I know to be a marker for the end of a bone chain, or something of the sort. This is further confirmed when I open the Havok skeleton with the havok tools, and I can see all the nubs in their correct locations. So at the very least, I need to get those nubs in the right places.
But for the most part, I have the bones all loading correctly!
~Nyxo~
||| Twitter ||| Youtube |||

User avatar
Tosyk
double-veteran
double-veteran
Posts: 949
Joined: Thu Oct 22, 2009 10:24 am
Location: Russia, Siberia
Has thanked: 225 times
Been thanked: 120 times
Contact:

Re: Dark Souls FLV file

Post by Tosyk » Sat Jun 22, 2013 6:27 am

damn, you good, nyxo :ninja:
keep it up with a nice progress
cheers.
Thank you for all you do here
my blog | my forum

User avatar
zardalu
veteran
Posts: 98
Joined: Sat Sep 13, 2008 3:13 pm
Has thanked: 5 times
Been thanked: 13 times
Contact:

Re: Dark Souls FLV file

Post by zardalu » Sat Jun 22, 2013 6:38 pm

nyxo wrote:Okay guys, I've just got the bones loading in, as well as some sort of bounding boxes that accompany the bone information...[snip]...But for the most part, I have the bones all loading correctly!

Outstanding work!! Have you been looking at static mesh information as well?

nyxo
advanced
Posts: 68
Joined: Sun Jan 06, 2013 3:54 am
Been thanked: 17 times
Contact:

Re: Dark Souls FLV file

Post by nyxo » Sat Jun 22, 2013 6:55 pm

What do you mean? Like props (barrels, crates, etc..) and map pieces?
~Nyxo~
||| Twitter ||| Youtube |||

nyxo
advanced
Posts: 68
Joined: Sun Jan 06, 2013 3:54 am
Been thanked: 17 times
Contact:

Re: Dark Souls FLV file

Post by nyxo » Sun Jun 23, 2013 2:47 am

Ok, I got bone weights in- I can pose meshes now!
Image

Now I'm off to get animations in~ *meanders off*
~Nyxo~
||| Twitter ||| Youtube |||

TehDave
advanced
Posts: 74
Joined: Tue Apr 21, 2009 5:24 am
Has thanked: 10 times
Been thanked: 5 times

Re: Dark Souls FLV file

Post by TehDave » Tue Jun 25, 2013 1:34 am

Oh holy shit, my hype meter just exploded.

grenadier42
ultra-n00b
Posts: 4
Joined: Wed May 18, 2011 4:53 pm

Re: Dark Souls FLV file

Post by grenadier42 » Tue Jun 25, 2013 7:11 am

TehDave wrote:Oh holy shit, my hype meter just exploded.
No kidding. Fantastic work nyxo, can't wait to see the end result.

User avatar
zardalu
veteran
Posts: 98
Joined: Sat Sep 13, 2008 3:13 pm
Has thanked: 5 times
Been thanked: 13 times
Contact:

Re: Dark Souls FLV file

Post by zardalu » Thu Jun 27, 2013 2:44 pm

nyxo wrote:What do you mean? Like props (barrels, crates, etc..) and map pieces?
Yes, I was just curious about these things. Some of the static meshes are pretty nice. Either way this is amazing work so far, :)

Post Reply