Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for 20.3.1.1 Fantasy Frontier Online #31

Open
Ghostwalker71 opened this issue Sep 25, 2014 · 12 comments
Open

support for 20.3.1.1 Fantasy Frontier Online #31

Ghostwalker71 opened this issue Sep 25, 2014 · 12 comments
Milestone

Comments

@Ghostwalker71
Copy link
Contributor

off site link to base file can be found on the niftools forum posted by huwong

@L0FKA
Copy link

L0FKA commented Oct 8, 2014

In header: userversion2 is need to be off, also there is issues with couple data blocks.

@ttl269
Copy link
Member

ttl269 commented Oct 31, 2014

The file posted by huwong has strange structure of NiGeometryData (part of NiTriShapeData block). It seems that:

  • each Vertices array is preceded by byte with value $F
  • each vertice in Vertices array is stored in 6 bytes instead of 12 bytes
  • each Normals array is preceded by byte with value $6
  • each normal in Normals array is stored in 3 bytes instead of 12 bytes
  • each UV set in UV Sets array is stored in 4 bytes instead of 8 bytes

It looks like some sort of compression or optimalization.
But from Consistency flags to end of NiTriShapeData block the structure is in according with nif.xml definition, so for example the Triangles data are stored in same way as defined in nif.xml.
Quick draft of NiGeometryData object would be:

<niobject name="NiGeometryData" abstract="1" inherit="NiObject">
<add name="Unknown Int" type="int" ver1="10.2.0.0">Unknown identifier. Always 0.</add>
<add name="Num Vertices" type="ushort" cond="!NiPSysData">Number of vertices.</add>
<add name="Keep Flags" type="byte" ver1="10.1.0.0">Used with NiCollision objects when OBB or TRI is set.</add><!--Not sure if this is Keep Flags. In tested file it seems to be always 0.-->
<add name="Compress Flags" type="byte" ver1="10.1.0.0">Unknown.</add><!--Not sure if this is Compress Flags. In tested file it seems to be always 0.-->
<add name="Unknown byte" type="byte">Unknown. Always $f?</add><!--is this some identifier?-->
<add name="Vertices" type="byte" arr1="Num Vertices*6">Mesh vertices stored in unknown format?</add><!--is this really vertices array?-->
<add name="Num UV Sets" type="ushort" vercond="((Version >= 10.0.1.0) &amp;&amp; (!((Version == 20.2.0.7) &amp;&amp; (User Version >= 11))))" calculated="1">Either number of UV sets or only a flag for UV sets?</add>
<add name="Unknown byte" type="byte">Unknown. Always $6?</add><!--is this some identifier?-->
<add name="Normals" type="byte" arr1="Num Vertices*3">The lighting normals stored in unknown format?</add><!--is this really normals array-->
<add name="Center" type="Vector3">Center of the bounding box (smallest box that contains all vertices) of the mesh.</add>
<add name="Radius" type="float">Radius of the mesh: maximal Euclidean distance between the center and all vertices.</add>
<add name="Has Vertex Colors" type="bool">Do we have vertex colors? These are usually used to fine-tune the lighting of the model.</add><!--not sure if this is really Has Vertex Colors flag-->
<add name="UV Sets" type="byte" arr1="Num Vertices*4">The UV texture coordinates stored in unknown format?</add><!--not sure if this is really UV sets array-->
<add name="Consistency Flags" type="ConsistencyType" ver1="10.0.1.0" default="CT_MUTABLE">Consistency Flags</add>
<add name="Additional Data" type="Ref" template="AbstractAdditionalGeometryData" ver1="20.0.0.4">Unknown.</add>
</niobject>

@L0FKA
Copy link

L0FKA commented Nov 3, 2014

@ttl269, you've missed VertexColors, but anyway I've got this
binary template for 20.3.1.1 is here: http://pastebin.com/4PmaR2uG
and modded nif.xml is here: link is dead

have fun with rest of required work ;)

@hexabits
Copy link
Member

hexabits commented Nov 3, 2014

@ttl269 @L0FKA The 20.3.1.1 NIF kind of loads with your modified nif.xml. Apparently there are far too many changes to the format to not also require work on NifSkope's end. So this isn't just a simple nif.xml fix.

I'll look at the 010 template but at this point I don't know when I will be able to make the necessary changes in NifSkope.

@zlj19901024
Copy link

@jonwd7 @ttl269 @L0FKA Hi, I am huwong's friend from china, my english is also not very well pls don't be mind. Here I have get in trouble with these type of nif file from extracting the game data "Fantasy Frontier Online" latest version. So I wanna know have this problem with 20.3.1.1 NIF been solved or not? Could u pls tell me how to open this kind of file in NIFskope or other 3D implement,Thx for your help

@ttl269
Copy link
Member

ttl269 commented Feb 25, 2015

@zlj19901024 You can use this modified nif.xml file to be able to open 20.3.1.1 nifs in Nifskope. But you will not see 3D model because its 3D data (vertices, normals, UV coordinates, vertex colors) are stored in way the Nifskope don't support yet. So, you will not be able to do anything with 3D data, only view the structure of nif file.
If you encounter some errors when opening 20.3.1.1 nifs, zip these nif files and provide us a link to that zip archive, so we can extend the support for 20.3.1.1 version nifs.

@zlj19901024
Copy link

@ttl269 Hello, I am sorry for replying you after 5 days cause I had a fever last week until now I feel a little better. So I take some time to find and collect the files which is used through your 20.3.1.1 nif.xml file are still can’t be open successfully. As you said, I can open the file but can not see it without some skeleton or structure of nif file. And this result let me see a glimmer of hope to completely open the file and succeed in editing it with 3Dmax or maya. Therefore, here are 45 files that I picked it up from extracted data. And it contains nearly 6 type of error, I have classified and packed up it all including nif file and error report. Here is the download site:https://www.dropbox.com/s/3qqfa24bw84p6cz/error%26file.zip?dl=0 . Hope you can improve nifskope to fit such new version and I am expecting to hear good news :)

@ttl269
Copy link
Member

ttl269 commented Mar 4, 2015

@zlj19901024 Many thanks for sample files you provided. It allowed me to extend support for 20.3.1.1 nif files from this game on nif.xml level (you can get modified nif.xml file), not on NifSkope application level.
In archive you provided, there are two version nif files:

  1. 20.3.1.1 nif files with standard header. These can be opened in NifSkope now without errors. Some of these nifs use compacted way of storing 3D data (vertices, normals, vertex colors, UV sets, vertex weights) which is not supported in NifSkope and therefore 3D data are not visualized. But some of 20.3.1.1 nifs uses standard way of storing 3D data, so finally you can see them visualized in NifSkope.
  2. 20.3.0.9 nif files with shortened header string (those reported "invalid header string"). Unfortunately NifSkope is not able to open them as it expect complete header string for Gamebryo type nif file. But it is very simple to "fix" them for NifSkope to open them - by inserting appropriate version string in their header string. I have fixed them for you, so here they are. I have added "mod" to their names.

If you have any next 20.3.1.1 nif files and can share them, it would be good - we could check them all and find other possible problems.

@jonwd7 It is probably maximum (see linked modified nif.xml above) what can be done for 20.3.1.1 support on nif.xml level. Based on observations of 20.3.1.1 files provided by @zlj19901024 it seems that on top of this page mentioned Unknown Byte placed before data arrays (vertices, vertex weights, normals, vertex colors) is identifier of way the data are stored in array. The 20.3.1.1 files use both methods - standard (that byte si set to 1 as for any other version nifs and then all data are stored in standard way - using floats etc.) and compressed (or compacted) way using half floats and shorter versions of other data types.
For example that Unknown Byte before Vertices array can be interpreted as byte Has Vertices (former bool) with states: 0 - no vertices, 1 - vertices stored in standard way (floats), 15 - vertices stored in half floats. And it is similar for other Unknown Bytes before normals, vertex colors, vertex weights although the value informing about compressed way is 6 (for normals) and 7 (for vertex colors).
So, next steps (if any) should probably be done in NifSkope code:

  1. Support for half floats (I think they are half floats) and other compact versions of data types (ByteVector3, ByteColor3, ByteColor4) used in 20.3.1.1 nif files.
  2. Ability to read shortened version of GameBryo type nif header string. This shortened header string contains only string Gamebryo File Format terminated with byte $0A. String with version , Version XX.X.X.X is missing. Rest of those nif files standard and can be read in NifSkope without any problems. I looked into NifSkope source code and there is hardcoded expecting of Version string in case of Gamebryo type nif file and then main version number is extraced from that text string! I don't see the reason why, when version number is stored right after header string in four bytes (may be old nif formats stored version only in header string?).

@zlj19901024
Copy link

@ttl269 I don't know what to said,but I would like to sincerely thank all for your help.THX again. I have receive the modified nif.xml file and indeed many error file can be open successfully with complete structure, but there are two important nif file still can not be opened completely, they only have skeleton in nifskope, it's invisible when I export it as obj and input to 3DMAX, I don't know how to describe it detailedly but you will see when you open it with the modified nif.xml file in nifskope. These two nif files contains most of clothes and armors which is including both Boys and Grils. I have uploaded it and here are the download site: https://www.dropbox.com/s/chbvgyzsekbiv1u/CH.zip?dl=0(extracted from the game is Chinese version) and https://www.dropbox.com/s/euhwzgmwcuhi7g4/JP.zip?dl=0(extracted from the game is Japanese version), if you can pls try to fix these two nif file, I would really appreciate you for your patiently help. And about you said "If you have any next 20.3.1.1 nif files and can share them", I find that those 45 file nearly include every error type. I have opened other files but the error report are look similar.(In total, there are 635 nif file in model folder) But if you need it to experiment I will be glad to scan it all to find any error file and notes every error report for supporting your work. If you have any requirement that I can do, pls feel free to ask me :)

@hexabits
Copy link
Member

hexabits commented Mar 5, 2015

@zlj19901024

but there are two important nif file still can not be opened completely, they only have skeleton in nifskope

NifSkope needs a lot of changes to actually display the 3D models for this NIF version. Unfortunately I don't know when I will be able to accomplish this.

@ttl269
Copy link
Member

ttl269 commented Mar 5, 2015

@zlj19901024

but there are two important nif file still can not be opened completely, they only have skeleton in nifskope, it's invisible when I export it as obj and input to 3DMAX, I don't know how to describe it detailedly but you will see when you open it with the modified nif.xml file in nifskope. These two nif files contains most of clothes and armors which is including both Boys and Grils.

Yes, I have opened also this (and now these) files. Unfortunately they use compact way of storing 3D data, so there is nothing to do more on nif.xml level. As @jonwd7 said - it requires to change NifSkope to display them.
Only (and quite complicated) solution for now I see in somehow converting of appropriate parts of these nifs to standard 3D data structures and inserting them back into nif.
I will not be here from tomorrow for one week.

@zlj19901024
Copy link

@jonwd7 @ttl269 I see, it's really not a easy work, but as long as you are willing to develope Nifskope version to fit this nif type, I will be waiting until it accomplished. Cause I have pay much attention to these model from last August till now, in a year or a half year or more is acceptable for me. Yesterday is a traditional Lantern Festival in China. Anyway, hope you guys have a nice beginning in a new year, I will continue to pay attention to this issue' updating :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants