Page 1 of 22

Dark Souls FLV file

Posted: Sat Dec 17, 2011 4:02 pm
by hatyn
Hi there my grossly incandescent cooperators. Of course I have no idea what is what but I would like your expert opinions about the file format used by Dark Souls for its 3D models.

It is of course hard for me to say if these are parts, whole models, archived animation and bones, etc, but here is one smallish file. http://xis9.com/000000ef.flv

Re: Dark Souls FLV file

Posted: Mon Feb 13, 2012 10:18 pm
by finale00
Script: http://db.tt/GwzbET08

Wasn't there another FLVER thread. Anyways, this format is big endian.
The offset to the indices section (followed by vert buffer) is given, but I don't really understand the indices.

You keep reading shorts until you see a -1. Then that is a face I guess.
Sometimes you read 3 indices.
Sometimes you read 4 indices.
Sometimes you read 5 or even 6 indices before you see a -1.

Are there any common schemes that do that?

The vertex buffer comes right after the index buffer, 36 bytes each.
I'll have to wait until I figure out how to bind buffers in big endian before I can verify that it is correct before proceeding.

Re: Dark Souls FLV file

Posted: Tue Feb 14, 2012 9:23 pm
by Phrexeus
Also interested in this. The flver files seem to be different for dark souls. Looking at the files in a hex editor, I can't make much sense of them, but then I'm pretty noob to this. The ascii looks nothing like numeric coordinates, but I'm probably just going about it in the wrong way.

Re: Dark Souls FLV file

Posted: Wed Feb 15, 2012 1:12 am
by finale00
Be careful with some of the strings because they use 2 bytes per character and most of it is just file paths and stuff rather than an index buffer.

At first if you sort of just skim through the format it looks like an index buffer but then if you look at what it represents you'll see it and move on quickly lol

Re: Dark Souls FLV file

Posted: Sun Feb 19, 2012 9:48 pm
by finale00
The files I'm working with are for Dark Soul 1 that hatyn uploaded in another thread
viewtopic.php?p=65301#p65301

It looks like the FLVER format is about the same for dark soul 2 and armored core. I might look at the FLVER import that was written. It might just be a different type.

Just some findings.

In general, you have something like

Code: Select all

Header, containing numMesh and other info
numMesh MeshInfo, providing info like numVerts, vertSize and stuff
numMesh MeshData, with the indices and vertices
Where MeshData appears to be face indices, followed by vertices, and repeat.

The header you can base it on the blender import for the other FLVER format. It is pretty much the same thing.

Code: Select all

struct Header {
   char[6] "FLVER\x00"
   int16[3] ??
   int32 offset to start of mesh data
   int32 size of the mesh data
   int32 numBones?
   int32 numMat
   int32 numParts?
   int32 numMesh
   int32 count
   float[6] bbox?
   
   ....
} 
I don't know when the header ends.

I've found sections of the mesh info that provide vert counts and vert sizes, as well as offsets to the vertex data. All offsets are relative to the start of the mesh data (the one you read in the header)

Re: Dark Souls FLV file

Posted: Sun Feb 19, 2012 11:51 pm
by finale00
Ok I've gotten the general structure of the format out using the blender import for reference.

I will need FLVER files for all of the games that were listed (some gundam games were there...)

There are several different types of FLVER formats, which is determined by one (or more) of the values at the very top.

DS1 and DS2 both use the same format, however Armored Core has a different format. Some of the structs are the same, but for example in armored core I haven't figured out the entries for the vertices (numVerts, vertSize, vertOfs, etc)

For now I will focus on the dark soul format.

Image

Script permalink: http://db.tt/GwzbET08

Re: Dark Souls FLV file

Posted: Mon Feb 20, 2012 12:04 am
by howfie
finale00, stop right now. go out and find yourself a nice woman and have some fun for a change lol.

Re: Dark Souls FLV file

Posted: Mon Feb 20, 2012 12:08 am
by finale00
Hmph, but this is fun :[

Re: Dark Souls FLV file

Posted: Mon Feb 20, 2012 12:11 am
by howfie
i'm just kidding with you :-P.

Re: Dark Souls FLV file

Posted: Mon Feb 20, 2012 1:03 am
by finale00
Wow noesis took that ugly face indexing scheme with all sorts of twists and turns and changing directions into a single call.

Image

Re: Dark Souls FLV file

Posted: Wed Feb 22, 2012 1:13 am
by Phrexeus
Mother of God...... Finale, you're doing it... awesome!!!! You got Ornstein as well, one of the coolest bosses. I haven't got any of the armored core, gundam files, but hatyn might. I have half of the dark souls stuff extracted though, the rest is still in an archive that current script from chrrox doesn't open.

I will play with your script tomorrow when i get on my main PC. Assuming all the models can be imported fine, is it likely to be straight forward to link the texture files to the 3D files automatically? And will UVs be preserved? I might be able to work some of this stuff out myself, but you should keep going with your greater speed and experience.

Re: Dark Souls FLV file

Posted: Wed Feb 22, 2012 1:31 am
by finale00
I didn't assign the UV's cause I don't have textures to test with, but the vert buffer is there so you just need to add one line to add the UV's.

Well, there's 5 vertex types so you'll probably have to add one line for each.
There's one vertex struct that's only 28 bytes....don't know what the other 4 floats might be.

I'm not sure if the materials are assigned per mesh or per face-group or per face.
Right now it should load each mesh separately. I also don't remember seeing any texture names...are they referenced separately?

Re: Dark Souls FLV file

Posted: Sat Feb 25, 2012 11:31 pm
by hatyn
OH SNAP... im off to use this..bbl!

Re: Dark Souls FLV file

Posted: Sat Feb 25, 2012 11:51 pm
by finale00
Are there filenames?
Some textures would be nice.

I didn't parse the material names or anything though.

Re: Dark Souls FLV file

Posted: Sun Feb 26, 2012 12:04 am
by hatyn
The TPFs we got are named very simple like 000000ea.TPF or something, and I don't think they actually match up the names of the textures that the model is bound to in the FLV.

I seem to be getting some errors with the FLVER import..
Image
exported from noesis

Image
inside noesis