XHeavy Posted February 1, 2007 Share Posted February 1, 2007 It seems that structure of DFF files in GTA SA differs from the GTA3 & VC files. And I totally don't know how to draw polygons(faces). For files from III and VC I use structure displayed at gtamodding.com, but SA dff files have another structure and if I try to read and render them, error appears. Tell me pls how to read SA DFF files correctly and render them with OpenGL Link to comment https://gtaforums.com/topic/266460-dff-structure/ Share on other sites More sharing options...
steve-m Posted February 1, 2007 Share Posted February 1, 2007 If you already know how to draw GTA3/VC models, there shouldn't really be a problem with SA, as the formats are pretty much the same. You might just be reading them incorrectly. As you probably know, the actual mesh data is in the Geometry > Struct section in the dff. There's a 16 byte header, with the following structure: 2b - word - flags1b - byte - number of of UV coordinate sets1b - byte - unknown4b - int - face count4b - int - vertex count4b - int - frame count The flags tell you what the section contains: Bit 0: triangle strip (else triangle list)Bit 1: vertex positions are included (should be 1, obviously)Bit 2: UV coordinates are includedBit 3: vertex colors are includedBit 4: normals are included (0 for most static map objects)Bit 7: multiple sets of UV coordinates are included (see header) Based on this info, you can read the section: Scene lighting info (12 byte) - only for RW versions < 3.4 !! Vertex colors (4 byte per vert) - only if flag is set UV colors (8 byte per vert) - note that you have to read as many blocks of UV coords as the header tells you (if the flags are set) Face indices (8 byte per face) Misc stuff (24 byte) - can be skipped Vertices (12 byte per vert) Normals (12 byte per vert) - only if flag is set That should be all you need to know. However, if you want to use materials one day, you have to skip the face indices and rather read those in the Geometry > Extension > Bin Mesh PLG (0x50E) section, which are grouped by material. Link to comment https://gtaforums.com/topic/266460-dff-structure/#findComment-4036511 Share on other sites More sharing options...
XHeavy Posted February 1, 2007 Author Share Posted February 1, 2007 (edited) DFF files contains list of normals in their Geometry section, and normals count = vertex count. It means, I suppose, that each normal describe the one vertex. In what way I can use these normals? PS: I've extracted file from game archive and opened it with rwAnalyze. I noticed that in Geometry section there are following lines: Face 1: 44512 15735 29480 15802 Face 2: 44512 15735 29480 15802 Face 3: 41224 15688 24896 15837 Face 4: 41224 15688 24896 15837 ................................................. why vertex numbers are so big if vertex count is only 120?? and why face lines repeat?? Face 1 = Face 2 ... Face n = Face n+1 That extracted file was "bntr_b_ov.dff' Edited February 1, 2007 by XHeavy Link to comment https://gtaforums.com/topic/266460-dff-structure/#findComment-4036567 Share on other sites More sharing options...
DexX Posted February 2, 2007 Share Posted February 2, 2007 In what way I can use these normals? if the object has normals, they will be used in the game for reflecting light in the scene, and also for materials. If a material has a reflection map for example, the vertices that make up the faces of the reflective material will need to have normals for the reflection map to appear correctly. @ other questions regarding "bntr_b_ov.dff", i think your misreading, or misinterpreting the data presented by RWA, but i'd need that model handy to double check what your talking about, and i dont right now. will edit post later. Link to comment https://gtaforums.com/topic/266460-dff-structure/#findComment-4037801 Share on other sites More sharing options...
steve-m Posted February 3, 2007 Share Posted February 3, 2007 why vertex numbers are so big if vertex count is only 120??and why face lines repeat?? RWA is quite old and doesn't reflect what we know about the files by now. The problem is that this particular file has multiple (2) UV coordinate sets. However, only bit 7 is set, not bit 2, so RWA falsely assumes there are no UV coords, since it doesn't know about multiple UV sets. So it reads the UVs as face indices, what results in strange numbers. Should I ever update RWA again (which I have some nice plans for), that would definitely be addressed. Link to comment https://gtaforums.com/topic/266460-dff-structure/#findComment-4038080 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now