Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    4. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption 2

    2. Red Dead Redemption

    3. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Forum Support

    2. Site Suggestions

maxorator

[REL] Blender DFF IO For III/VC/SA

Recommended Posts

maxorator

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.

Share this post


Link to post
Share on other sites
Caencel

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

 

user posted image

Edited by Caencel

Share this post


Link to post
Share on other sites
maxorator

 

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

 

user posted image

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 by maxorator

Share this post


Link to post
Share on other sites
Caencel

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

Share this post


Link to post
Share on other sites
maxorator

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?

Share this post


Link to post
Share on other sites
Caencel
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

Share this post


Link to post
Share on other sites
maxorator

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.

Share this post


Link to post
Share on other sites
Caencel
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

Share this post


Link to post
Share on other sites
Michael-Knight1

nice things xD , now we can to create awesome low poly characters cookie.gifcookie.gif

Share this post


Link to post
Share on other sites
Caencel

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:

 

user posted image

 

 

Share this post


Link to post
Share on other sites
Michael-Knight1
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:

 

user posted image

we need great tutorial for low poly characters , etc ....

 

Share this post


Link to post
Share on other sites
maxorator

 

- 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?

Share this post


Link to post
Share on other sites
Caencel

 

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)

 

user posted image

 

-

 

user posted image

 

-

 

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

 

user posted image

 

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 by Caencel

Share this post


Link to post
Share on other sites
Caencel

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

Share this post


Link to post
Share on other sites
maxorator
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?

Share this post


Link to post
Share on other sites
Caencel

 

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 by Caencel

Share this post


Link to post
Share on other sites
maxorator
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.

Share this post


Link to post
Share on other sites
captainkman

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 by captainkman

Share this post


Link to post
Share on other sites
brian.

Have you tried the tested build to see if the problem is persistent? (Tested on Blender 2.63 with bundled Python 3.2.)

Share this post


Link to post
Share on other sites
captainkman

 

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:

user posted image

Edited by captainkman

Share this post


Link to post
Share on other sites
zaauriel

Cant download Gtagarage not responding, any alternate downloads?

Share this post


Link to post
Share on other sites
zaauriel

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?

Share this post


Link to post
Share on other sites
mirh

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?

Share this post


Link to post
Share on other sites
Bernie Buddy

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?

Share this post


Link to post
Share on other sites
Concavax

Updates? :)

Share this post


Link to post
Share on other sites
DYOM designer

now i did install it...but when i want import a model it make erroer :(

Edited by DYOM designer

Share this post


Link to post
Share on other sites
iPlayer

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 = None
4. Save the file & restart Blender. This MIGHT work for some models. Worked for the models I needed though.

Share this post


Link to post
Share on other sites
chickenx4

I got the current version of blender would it work

Edited by chickenx4

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.