maxorator Posted August 25, 2012 Share Posted August 25, 2012 Blender import/export script for GTA III/VC/SA .dff files v0.9.0 by maxorator Tested on Blender 2.63 with bundled Python 3.2. To install this script, go to "File->User Preferences->Install Addon" and select the .py file. Exporting and importing .dff files will now appear under Import and Export menus. Limitations: * Does not support editing ped model skin/bone data. * Collisions loaded from .dff files are retained until export, but the data for that cannot be imported from .col files separately. * Uses triangle list instead of triangle strips in mesh plugin data (should not affect gameplay, but increases file size). For textures to be loaded automatically, you have to create a directory named "dff_file_name.dff_tex" in the same folder of the DFF file you are loading and it must contain all textures in files named "texture_name.png". For example if you are importing "infernus.dff" file, then you have to create an "infernus.dff_tex" folder and export all the textures that model uses as PNG files into that folder. For exporting, the objects you want to export have to be selected. Child objects are exported automatically, they don't need to be selected. The importer automatically hides _dam and _vlo atomics after loading them, pressing Alt+H will reveal them. PerikiyoXD, Yohan99, direct and 5 others 8 Link to comment Share on other sites More sharing options...
Caencel Posted September 5, 2012 Share Posted September 5, 2012 (edited) hey, pretty good to see a Blender plugin being maintained, going to test it today since Blender is more comfortable for me, are you going to keep working on it? also a little more extensive documentation of how exactly the data is interpreted could be of use, for example hierarchies, dummies(empties?), textures UV, vertex color, materials (secular lighting, reflections, transparency, opacity) if the meshes need transformation applied to them before exporting, main color, secondary color, plain material etc, also if this successfully can export a vehicle and stuff, i now pretty much of these questions are going to be answered as soon as i start testing, and i would be happy to help, any plugin for Blender is worth some attention -can't make it work, i'm using Windows XP sp3 and Blender 2.63a installed (installation not zipped package), every time i export or import a dff i got various errors, tried with a character, a vehicle and an average object, this is the output from a cathedral model from the game, the dffs tested weren't read-only Edited September 7, 2012 by Caencel Link to comment Share on other sites More sharing options...
maxorator Posted September 9, 2012 Author Share Posted September 9, 2012 (edited) hey, pretty good to see a Blender plugin being maintained, going to test it today since Blender is more comfortable for me, are you going to keep working on it? also a little more extensive documentation of how exactly the data is interpreted could be of use, for example hierarchies, dummies(empties?), textures UV, vertex color, materials (secular lighting, reflections, transparency, opacity) if the meshes need transformation applied to them before exporting, main color, secondary color, plain material etc, also if this successfully can export a vehicle and stuff, i now pretty much of these questions are going to be answered as soon as i start testing, and i would be happy to help, any plugin for Blender is worth some attention -can't make it work, i'm using Windows XP sp3 and Blender 2.63a installed (installation not zipped package), every time i export or import a dff i got various errors, tried with a character, a vehicle and an average object, this is the output from a cathedral model from the game, the dffs tested weren't read-only If it's a III model, then you should retest with the 0.9.1 version I just uploaded (I hadn't really tested on III models when I uploaded the first version, so there was a slight problem with reading headers of old RW versions.) Otherwise, can you send me a .dff you are getting these errors on? I'd like to take a look at it and see what might be causing this. To answer some of your questions - this plugin should export any imported III/VC/SA vehicle and ped into a nearly identical file. The only difference should be the order of geometries, atomics and frames in the exported .dff file, which shouldn't affect gameplay. It supports environment map textures, specular textures and therefore also having two UV maps (first for normal texture, second for specular and environment map texture). To see how exactly you should set up these textures, you could just import a SA vehicle and see how the importer lays it out. Some basics: Hierarchies are preserved on importing and exporting. Dummies are empties - empties are exported into frames that have no atomics (geometry) attached to them. The script automatically splits quads into triangles. It also splits the mesh into groups based on the UV map - so that if a vertex is on N different UV map groups, then it will be duplicated into N different vertices in the final .dff file. Material specular texture settings' "specular level" (from GTAModding descriptions) corresponds to the texture's specular colour intensity in Blender's texture settings. That's also how the export script tells the difference between specular and diffuse textures. Environment map's intensity is also specified by the envmap texture's "specular level" setting in Blender. Material reflection in RW file corresponds to material "mirror" settings in Blender - RW's reflection intensity is Blender's reflectivity and reflection colour is, not surprisingly, the colour you can specify under mirror settings. Alpha channel in material colour is basically Blender's alpha setting under "Transparency" in material settings. I don't really understand what you mean by vertex colour though. And what exactly do you mean by main and secondary colours? One note - importing/exporting lights does not work. Edited September 9, 2012 by maxorator Link to comment Share on other sites More sharing options...
Caencel Posted September 10, 2012 Share Posted September 10, 2012 i could import the model rcbandit.dff from GTA SA which is good, it has material information and UV maps as well hierarchies but i tried again with that dff model from the cathedral (to be fair it was a random choice so i'm not exactly sure if has anything else than meshes and dummies/emtpies) and received the same error, here are the files i used http://www.mediafire.com/?bl2wwwvpt7mv91e also the rcbandit had it's normals flipped but that's not a big deal, now that i can at least work with vehicles so i'll test how these are exported I don't really understand what you mean by vertex colour though. And what exactly do you mean by main and secondary colours? vertex color (Blender term) or vertex shading is literally a color applied to a model's vertexes, in GTA games is used by map elements for shading as far as i know, i'm not into mapping a lot so that's all i know. About colors i can see now these are handled in material colors; Primary Color, Secondary color and if i remember some boats even use Third and Fourth color materials, it doesn't matter at all now since importing the vehicle file solves some doubts i'm taking note of all that info you posted by the way as most of the doubts comes when working in a project, also thank you again for the plugin and the support man Link to comment Share on other sites More sharing options...
maxorator Posted September 11, 2012 Author Share Posted September 11, 2012 I'll take a look at that .dff file and also try to fix the normals (I actually noticed that too). Thanks for the feedback. About vertex colours, if your cathedral uses them, that might be the reason why it fails to load. For some reason I completely forgot to read them in if the flag was set. Renderware seems to call it "pre-lighting", so I guess it should use Blender's "Vertex Color Light" instead of "Vertex Color Paint", right? Link to comment Share on other sites More sharing options...
Caencel Posted September 14, 2012 Share Posted September 14, 2012 I completely forgot to read them in if the flag was set. Renderware seems to call it "pre-lighting", so I guess it should use Blender's "Vertex Color Light" instead of "Vertex Color Paint", right? i guess so, i never really tried to mod maps so i don't know well how that information is exported, it made sense to me for it to be vertex color paint but someone who knows about mapping should know better Link to comment Share on other sites More sharing options...
maxorator Posted September 14, 2012 Author Share Posted September 14, 2012 Fixed the problems I was aware of so far. Those 3 files you sent should now all load properly, with normals facing the right way. Changelog: v0.9.2:* Fixed a bug with exporting polygons, which made models look messed up. * Polygon vertices are read in a different order now, so that normals are facing the right direction. * Unnamed frames are now supported. * Vertex colours and night vertex colours are now imported and exported. Link to comment Share on other sites More sharing options...
Caencel Posted September 14, 2012 Share Posted September 14, 2012 Fixed the problems I was aware of so far. Those 3 files you sent should now all load properly, with normals facing the right way. Changelog: v0.9.2:* Fixed a bug with exporting polygons, which made models look messed up. * Polygon vertices are read in a different order now, so that normals are facing the right direction. * Unnamed frames are now supported. * Vertex colours and night vertex colours are now imported and exported. awesome, testing right away, thanks Link to comment Share on other sites More sharing options...
Michael-Knight1 Posted September 14, 2012 Share Posted September 14, 2012 nice things xD , now we can to create awesome low poly characters Link to comment Share on other sites More sharing options...
Caencel Posted September 16, 2012 Share Posted September 16, 2012 so far everything has been good, maybe i'll write a little tutorial or some notes i'm myself finding useful, right now i'm working with Blender and modifying the "Pony" van and here are some thoughts: - Is pretty good that the imported model has the damaged parts hidden but i'm wondering if would be better if dummies, main parts and damaged parts be divided by layers, that would make things easier to handle - Something i noticed is that some textures are not loaded at all, the material and the uv information is there but the paths to the images or the images used at all aren't there, not really a big problem at all - I never been really paranoid about DFF security but i'm wondering if it's possible to lock them at exporting or if locked DFF are possible to import, at some point this matters because ... uh.. let's say a "mod expert" would just import other's people mods, move some stuff here and there and export as it's own. - Finally one of the advantage of working with 3D Studio over Blender is the material library, Blender can use materials from other .blend files but come on, who doesn't like a handy panel with a list of customized materials for personal use? I just found a plugin that does the trick really good https://sites.google.com/site/aleonserra/ho...ripts/matlib-vx i don't know if you can mention it in your main post Maxorator, it works pretty good with current Blender release but as with everything is important to read the instructions and information. screenie: Link to comment Share on other sites More sharing options...
Michael-Knight1 Posted September 16, 2012 Share Posted September 16, 2012 so far everything has been good, maybe i'll write a little tutorial or some notes i'm myself finding useful, right now i'm working with Blender and modifying the "Pony" van and here are some thoughts: - Is pretty good that the imported model has the damaged parts hidden but i'm wondering if would be better if dummies, main parts and damaged parts be divided by layers, that would make things easier to handle - Something i noticed is that some textures are not loaded at all, the material and the uv information is there but the paths to the images or the images used at all aren't there, not really a big problem at all - I never been really paranoid about DFF security but i'm wondering if it's possible to lock them at exporting or if locked DFF are possible to import, at some point this matters because ... uh.. let's say a "mod expert" would just import other's people mods, move some stuff here and there and export as it's own. - Finally one of the advantage of working with 3D Studio over Blender is the material library, Blender can use materials from other .blend files but come on, who doesn't like a handy panel with a list of customized materials for personal use? I just found a plugin that does the trick really good https://sites.google.com/site/aleonserra/ho...ripts/matlib-vx i don't know if you can mention it in your main post Maxorator, it works pretty good with current Blender release but as with everything is important to read the instructions and information. screenie: we need great tutorial for low poly characters , etc .... Link to comment Share on other sites More sharing options...
maxorator Posted September 17, 2012 Author Share Posted September 17, 2012 - Is pretty good that the imported model has the damaged parts hidden but i'm wondering if would be better if dummies, main parts and damaged parts be divided by layers, that would make things easier to handle Didn't really know you could group objects like that in Blender. I might look into it. - Something i noticed is that some textures are not loaded at all, the material and the uv information is there but the paths to the images or the images used at all aren't there, not really a big problem at all Are you sure you have all the textures in the _tex folder? Like for SA vehicles you also have to put the generic textures there. - I never been really paranoid about DFF security but i'm wondering if it's possible to lock them at exporting or if locked DFF are possible to import, at some point this matters because ... uh.. let's say a "mod expert" would just import other's people mods, move some stuff here and there and export as it's own. I don't do DRM. - Finally one of the advantage of working with 3D Studio over Blender is the material library, Blender can use materials from other .blend files but come on, who doesn't like a handy panel with a list of customized materials for personal use? I just found a plugin that does the trick really good https://sites.google.com/site/aleonserra/ho...ripts/matlib-vx i don't know if you can mention it in your main post Maxorator, it works pretty good with current Blender release but as with everything is important to read the instructions and information. screenie: How would it work with .dff files though? Is it possible to export the customized materials as image textures? Link to comment Share on other sites More sharing options...
Caencel Posted September 18, 2012 Share Posted September 18, 2012 (edited) Didn't really know you could group objects like that in Blender. I might look into it. see at near the end of the reply (*) Are you sure you have all the textures in the _tex folder? Like for SA vehicles you also have to put the generic textures there. Is not a big deal anyway because Blender itself can use a specific path for textures and setting the material manually is something i recommend to do in order to understand it's structure and customize the materials and textures according to own interests, never the less i'll give it a try since in some cases it might be necessary I don't do DRM. not quite sure what's that but it was something i thought it would matter. How would it work with .dff files though? Is it possible to export the customized materials as image textures? this plugin is basically a library that can store any sort of material you desire, i'm starting to do it with materials from SA vehicles so it doesn't really have anything to do with dff files and i don't think i understand well what you mean with export customized materials as image textures Now so far the materials used work well, i would say no mayor problems should exist if everything is setup properly in Blender, which is not that hard since you can use as templates the materials imported from the Dff: (sorry for the broken look of the vehicle, is not ready for use in game and lacks collision which i'm planing to add via Collision Editor II, is just for testing the export procedure) - - As you can see is very promising since the first in-game test was successful with no single error. * Now the details, i thought it would be a good idea to have everything in different layers but turns out that the exporting process only works for the current layer or last layer selected (this if you try to select all of them) so project-wise is better to keep everything as it is now. Also i found myself with a rare bug, at first i had the idea that the exporting process would add the extension .dff to the file automatically but it didn't nevertheless i did it manually and the file worked fine, the problem came when i exported the file including the extension in the file's name, an error came out but the file was created anyway However trying once again exporting without extension immediately doesn't produce any error and indeed i prefered this file over the "erroed" .dff which btw i didn't test Edited September 18, 2012 by Caencel Link to comment Share on other sites More sharing options...
Caencel Posted October 28, 2012 Share Posted October 28, 2012 just a quick problem here man, i made a wheel pack for Vice City but Blender is exporting it without textures http://www.mediafire.com/?y8313x4z3nt4611 these are the wheels exported and textures Link to comment Share on other sites More sharing options...
maxorator Posted October 28, 2012 Author Share Posted October 28, 2012 just a quick problem here man, i made a wheel pack for Vice City but Blender is exporting it without textures http://www.mediafire.com/?y8313x4z3nt4611 these are the wheels exported and textures When I export this, I get an identical .dff. Is this one already the one exported by the script? Link to comment Share on other sites More sharing options...
Caencel Posted October 28, 2012 Share Posted October 28, 2012 (edited) just a quick problem here man, i made a wheel pack for Vice City but Blender is exporting it without textures http://www.mediafire.com/?y8313x4z3nt4611 these are the wheels exported and textures When I export this, I get an identical .dff. Is this one already the one exported by the script? yup it is the one already exported, at first sight these might look like the original wheels but that's because i used the original textures as placeholders so i can work original textures later, also i know all textures are there because i used another plugin for Blender from some japanese site (scroll down a bit, the plugin's name is in english) that i'm not using at all due to the lack of understandable documentation, also i think it's only for SA as some GTA III and VC can't be imported, but returning to the main topic, that plugin exported everything with textures. Blender Source file Edited October 28, 2012 by Caencel Link to comment Share on other sites More sharing options...
maxorator Posted October 28, 2012 Author Share Posted October 28, 2012 just a quick problem here man, i made a wheel pack for Vice City but Blender is exporting it without textures http://www.mediafire.com/?y8313x4z3nt4611 these are the wheels exported and textures When I export this, I get an identical .dff. Is this one already the one exported by the script? yup it is the one already exported, at first sight these might look like the original wheels but that's because i used the original textures as placeholders so i can work original textures later, also i know all textures are there because i used another plugin for Blender from some japanese site (scroll down a bit, the plugin's name is in english) that i'm not using at all due to the lack of understandable documentation, also i think it's only for SA as some GTA III and VC can't be imported, but returning to the main topic, that plugin exported everything with textures. Blender Source file I'll have to test this. The structure of the wheels.dff file looks okay, seems to contain texture names. Not sure yet why it doesn't load textures in-game. Link to comment Share on other sites More sharing options...
captainkman Posted December 19, 2012 Share Posted December 19, 2012 (edited) Hi everyone, I know this thread is a couple of months old, but I'd appreciate some help. I have Blender 2.58 and Python 2.7 (With 3.0 installed if necessary) I'm trying to import the freight.dff file (from GTA:SA) into Blender, but I get an error similar to the one posted by Caencel. Any suggestions? I can host the file somehwere if necesary. Edited December 19, 2012 by captainkman Link to comment Share on other sites More sharing options...
brian. Posted January 15, 2013 Share Posted January 15, 2013 Have you tried the tested build to see if the problem is persistent? (Tested on Blender 2.63 with bundled Python 3.2.) Link to comment Share on other sites More sharing options...
captainkman Posted January 15, 2013 Share Posted January 15, 2013 (edited) Have you tried the tested build to see if the problem is persistent? (Tested on Blender 2.63 with bundled Python 3.2.) Hi brian, I did eventually get Blender 2.65 and Python 3.0, and it now works. Didn't import how I imagined it would though. But it still imported. Kman. EDIT: This is what I did with the wonderful DFF importer: Edited January 16, 2013 by captainkman Link to comment Share on other sites More sharing options...
zaauriel Posted February 15, 2013 Share Posted February 15, 2013 Cant download Gtagarage not responding, any alternate downloads? Link to comment Share on other sites More sharing options...
zaauriel Posted March 18, 2013 Share Posted March 18, 2013 Hi, ive been testing this for a few days and now i wonder if it could be used to prelight some map objects. I know how to do it in max, but not in blender, any help please? Link to comment Share on other sites More sharing options...
mirh Posted June 26, 2013 Share Posted June 26, 2013 i'm using blender 2.67a (with the bundled python 3.3) and whenever i try to import the hydra model.. it gave me this Ignoring extension data of type 0x253f2f8Traceback (most recent call last): File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_scene_dff.py", line 1662, in execute ImportRenderware(self.filepath) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_scene_dff.py", line 401, in __init__ self.readSection(RwTypes.CLUMP) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_scene_dff.py", line 442, in readSection elif header[0] == RwTypes.CLUMP: res = self.readSectionClump(header) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_scene_dff.py", line 636, in readSectionClump self.readSection(RwTypes.EXTENSION) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\addons\io_scene_dff.py", line 428, in readSection raise Exception("Expected type " + str(type) + ", found " + str(header[0]))Exception: Expected type 3, found 1location: <unknown location>:-1 should i use an older blender version? Link to comment Share on other sites More sharing options...
Bernie Buddy Posted September 21, 2013 Share Posted September 21, 2013 Sorry for bumping a slightly old thread or if I've missed something, but I've been looking all over Google for a file like this but there's no download link in the OP anymore. Is there still a download somewhere else by any chance? Link to comment Share on other sites More sharing options...
Silent Posted September 21, 2013 Share Posted September 21, 2013 GTAGarage widget is still gone, the topic used to be linked to this GTAGarage submission: http://www.gtagarage.com/mods/show.php?id=21598 Link to comment Share on other sites More sharing options...
Concavax Posted October 10, 2014 Share Posted October 10, 2014 Updates? Link to comment Share on other sites More sharing options...
DYOM designer Posted April 23, 2016 Share Posted April 23, 2016 (edited) now i did install it...but when i want import a model it make erroer Edited April 23, 2016 by DYOM designer Link to comment Share on other sites More sharing options...
iPlayer Posted December 27, 2016 Share Posted December 27, 2016 Whoever gets the "Expected type 3, got X" error, try my approach which removes some safety check in this tool. 1. Go to %APPDATA%\Blender Foundation\Blender\<blender version>\scripts\addons OR C:\Program Files\Blender Foundation\Blender\<blender version>\scripts\addons (replace <blender version> with the version of the Blender you use). Exact path depends on your installation. You can try both. 2. Open io_scene_dff.py with any text editor (e.g. Notepad++) 3. Delete lines 427 and 428. Or simply comment them out using #: header = self.readFormat("III")header = (header[0], header[1], RwTypes.decodeVersion(header[2]))#if type >= 0 and header[0] != type:# raise Exception("Expected type " + str(type) + ", found " + str(header[0]))curPos = self.f.tell()res = None4. Save the file & restart Blender. This MIGHT work for some models. Worked for the models I needed though. Concavax and mirh 2 Link to comment Share on other sites More sharing options...
chickenx4 Posted May 23, 2017 Share Posted May 23, 2017 (edited) I got the current version of blender would it work Edited May 23, 2017 by chickenx4 Link to comment Share on other sites More sharing options...
theundeadsoldier Posted July 8, 2017 Share Posted July 8, 2017 Hey Maxorator can you make this plugin compatible for bully ps2 dff as well please? here's a model from bully ps2 dff in case you need: http://www.mediafire.com/file/77vth69327bmew1/sheldon.rar Link to comment 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