Page 3 of 7

Re: Dragon Age 2 (PC)

Posted: Sun Mar 20, 2011 1:45 am
by figuresculptor
codo85 wrote:Umh... I fear I'm missing something...
This is my naive approach to the matter.
What you're missing is that a mesh has to be tied to its armature. Every vertex in the mesh has to be specified as being part of certain bones, or the character will not animate correctly. That means, if you add any vertices, or move them in a way that would require a different bone influence. That data is not currently imported into blender, and therefore can't be changed. If all you do is tweak the vertices of the existing mesh a little without adding any and without moving any very far, then your approach might work, otherwise, it's likely the character won't animate correctly.

Even if we wrote an exporter based on what we know now, it probably wouldn't work, as there is unmapped vertex data in some of the models - probably normals, binormals and tangents (used which can all be calculated in 3DS Max or Blender when needed, but stored in game files because they are too slow to calculate at runtime. Until we know which bits of unknown data are what, the exporter would be failing to provide certain data that is needed.

As I said, though, I think tazpn over at Dragon Age Nexus has figured out what goes where, but he hasn't documented it, so right now, it means either more reverse engineering or digging through tazpn's fairly complex code, neither of which I have the time for at the moment. But, if nobody else does it before I have time, I'll look for a solution when I can.

Re: Dragon Age 2 (PC)

Posted: Sun Mar 20, 2011 2:22 am
by chrrox
its easy enough to figure out the vertex structure but i dont have any bones to put to a model what files are the bones in?

Re: Dragon Age 2 (PC)

Posted: Sun Mar 20, 2011 4:37 am
by figuresculptor
chrrox wrote:its easy enough to figure out the vertex structure but i dont have any bones to put to a model what files are the bones in?
From briefly looking at tazpn's code, it looks like they're stored in the .mmh file, or at least their location in another file is stored there. I haven't had time to go very extensively into the code.

Re: Dragon Age 2 (PC)

Posted: Sun Mar 20, 2011 5:13 pm
by sirew
which script is for blender?, because, it confusing me which is it is :d

Re: Dragon Age 2 (PC)

Posted: Sun Mar 20, 2011 5:30 pm
by figuresculptor
sirew wrote:which script is for blender?, because, it confusing me which is it is :d

This one: viewtopic.php?p=50958#p50958

Re: Dragon Age 2 (PC)

Posted: Sun Mar 20, 2011 7:28 pm
by figuresculptor
Couple of things learned today.

pyGFF can extract the DA2 ERF files, and it has a database of hashes and files, so it's possible to extract the ERF file into the appropriate hierarchy structure, restoring the proper names needed for overriding. There are some files that aren't mapped, but it looks like all the .msh, .mmh, and .dds files are, and those are what we care about. I extracted artpf.erf and now have the mmh, msh, and dds files with the appropriate names and in the appropriate folders. At very least, this makes it hugely easier to find the correct texture for a given model.

gff4editor is available from DA Nexus: http://social.bioware.com/project/1936/

Poking around the code for pyGFF has been very enlightening in terms of the file format, and the source contains a pretty complete list of the field types used in the .msh and .mhh files.

The bones definitely ARE in the .mmh file, as is a reference to the corresponding .msh file and a list of the meshes in the .msh file, including the name of each mesh (which I assume will be needed when it comes time to write an exporter). I've made some progress on finding the actual bone data, but it's slow going. I've now got the root node of the skeleton and am working on how to parse out child lists from GFF files. Still not sure where the bone indices are stored - whether they're in the .mmh or .msh file. At very least, the .msh file stores a list of the bones it uses, and I'm guessing the bone index is one of the bits of currently unmapped vertex data in the .msh file.

Once I'm able to iterate down into child nodes, I should be able to figure out how to import the skeleton since I know what bone index fields look like, thanks to pyGFF.

Re: Dragon Age 2 (PC)

Posted: Mon Mar 21, 2011 8:34 am
by sirew
figuresculptor wrote:
codo85 wrote:Hi guys, can somebody please explain how can I use figuresculptor's port to blender of chrrox's script?
I mean, I save the text in a .py file... and then?

1) Save script to a text file. You may have to convert spaces to tabs (four spaces = 1 tab) depending on your version of Python. Make sure it has a .py extension. (if you have problems, I can upload the script in a zip file)
2) Launch Blender 2.56b
3) Go to the File menu and select "User Preferences"
4) Navigate to the Add-Ons tab
5) Click the "Install Add-On…" button at the bottom
6) Select the file where you saved the script
7) On the left side, select "Import-Export" to filter the sripts
8) Look for the one that says "Import-Export: Import Dragon Age 2 Mesh files (.msh) and click the check-box on the right side so it's checked
9) Close the user preferences window
10) Type ctrl-u to save the preference changes
11) Select File menu, Import submenu, Dragon Age 2 Mesh (.msh)
12) Find the file you want to import
13) Profit!
HI, I'm using blender 2.6.2 and I didn't see any file menu that have install add-on, hope some one can help

Re: Dragon Age 2 (PC)

Posted: Tue Mar 22, 2011 1:14 pm
by Tosyk
figuresculptor wrote:pyGFF can extract the DA2 ERF files.
tell me how to unpack *.erf from da2 with structure and names.

Re: Dragon Age 2 (PC)

Posted: Tue Mar 22, 2011 3:17 pm
by figuresculptor
Tosyk wrote:tell me how to unpack *.erf from da2 with structure and names.
Here you go:

1 If you don't already have wxPython installed, download it from wxpython.org and install it
2 Download the latest filename hash database at http://www.sendspace.com/file/uitq9g
3 Download the latest version of pyGFF at http://social.bioware.com/project/1936/
4 Copy fnvhashes.sqlite into the gff4editor-0.5.2b folder, replacing the existing file
5 Launch the Editor.exe application that's inside the gff4editor-0.5.2b folder
6 From the File menu, select "Export All"
7 Select the erf file to extract
8 Select destination to extract to
9 Profit!

Re: Dragon Age 2 (PC)

Posted: Tue Mar 22, 2011 3:34 pm
by Tosyk
figuresculptor wrote:
Tosyk wrote:tell me how to unpack *.erf from da2 with structure and names.
Here you go:

1 If you don't already have wxPython installed, download it from wxpython.org and install it
2 Download the latest filename hash database at http://www.sendspace.com/file/uitq9g
3 Download the latest version of pyGFF at http://social.bioware.com/project/1936/
4 Copy fnvhashes.sqlite into the gff4editor-0.5.2b folder, replacing the existing file
5 Launch the Editor.exe application that's inside the gff4editor-0.5.2b folder
6 From the File menu, select "Export All"
7 Select the erf file to extract
8 Select destination to extract to
9 Profit!
thanks man, looking for second only, now everything is working

Re: Dragon Age 2 (PC)

Posted: Wed Mar 23, 2011 3:13 am
by bugmenotty
Love the script.

For some reason the hair mesh I exported and imported with Tzpans tools didn't save the UV map, allthough all the other meshes had it intact, buuut the script actually made it.
Saved me alot of fustration, now I'll just have to figure out the akwardly mapped channels in the dds files.

Re: Dragon Age 2 (PC)

Posted: Wed Mar 23, 2011 3:44 am
by figuresculptor
bugmenotty wrote:For some reason the hair mesh I exported and imported with Tzpans tools didn't save the UV map, allthough all the other meshes had it intact, buuut the script actually made it.
I noticed this too, and so far only with hair. I honestly think the UV data just isn't there for models with a vertex size of 40 (which seems to be used exclusively for hair models). I'm not sure how they're doing hair in-game, but I've looked at the unknown vertex data in the hair models, and none of it looks like UV data. Plus, the data we're pulling the UVs from actually do contain valid UV data, it's just that every vertex has the same value of (1.0, 0.0). None of the other unused data fields fall consistently between 0.0 and 1.0.

So, long story short, I think they're doing something funky with the hair, but I have no idea what it is.

Re: Dragon Age 2 (PC)

Posted: Thu Mar 24, 2011 2:29 am
by bugmenotty
I'm confused.

I ment I actually did get the UV with the hair mesh, by using the script. Instead of tzpans exporter.
I've also toyed around with the hair texture dds, wich seems to be shared between all hair meshes in the game.
It's rather funky, and I can't make much out of it. Seems to have 4 diffrent channels with diffrent maps in each one. Spec, diffuse, normal and opacity.
The diffuse layer, if that's what it is, is grey and colorless, wich makes somewhat sense considering how you are able to swap around colors igame, so maybe it just uses some blending mode, heck if I know.

Mostly speculation, but it's the best I can make of it.

Quick render Image

Re: Dragon Age 2 (PC)

Posted: Thu Mar 24, 2011 2:58 am
by figuresculptor
bugmenotty wrote:I ment I actually did get the UV with the hair mesh, by using the script. Instead of tzpans exporter.
That's interesting. I don't get UVs for 90% of the hair meshes with the script. A few of them I do, but not for most of them.

Re: Dragon Age 2 (PC)

Posted: Sat Mar 26, 2011 1:38 pm
by Szkaradek123
Blender249 armature importer for .mmh files from Dragon age 2.