Quantcast

Jump to content

» «
Photo

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

26 replies to this topic
maxorator
  • maxorator

    VC:MP lead developer

  • Members
  • Joined: 24 Feb 2006
  • None
  • Contribution Award [Mods]

#1

Posted 25 August 2012 - 07:09 PM

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.
  • Silent, PerikiyoXD, Jeansowaty and 1 other like this

Caencel
  • Caencel

    Bugpills

  • Members
  • Joined: 05 Sep 2012

#2

Posted 05 September 2012 - 06:18 PM Edited by Caencel, 07 September 2012 - 10:09 PM.

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

maxorator
  • maxorator

    VC:MP lead developer

  • Members
  • Joined: 24 Feb 2006
  • None
  • Contribution Award [Mods]

#3

Posted 09 September 2012 - 07:19 PM Edited by maxorator, 09 September 2012 - 07:36 PM.

QUOTE (Caencel @ Wednesday, Sep 5 2012, 21:18)
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.

Caencel
  • Caencel

    Bugpills

  • Members
  • Joined: 05 Sep 2012

#4

Posted 10 September 2012 - 07:11 PM

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


QUOTE
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

maxorator
  • maxorator

    VC:MP lead developer

  • Members
  • Joined: 24 Feb 2006
  • None
  • Contribution Award [Mods]

#5

Posted 11 September 2012 - 09:01 AM

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?

Caencel
  • Caencel

    Bugpills

  • Members
  • Joined: 05 Sep 2012

#6

Posted 14 September 2012 - 12:51 AM

QUOTE (maxorator @ Tuesday, Sep 11 2012, 03:01)
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

maxorator
  • maxorator

    VC:MP lead developer

  • Members
  • Joined: 24 Feb 2006
  • None
  • Contribution Award [Mods]

#7

Posted 14 September 2012 - 10:54 PM

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:
QUOTE
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.

Caencel
  • Caencel

    Bugpills

  • Members
  • Joined: 05 Sep 2012

#8

Posted 14 September 2012 - 10:57 PM

QUOTE (maxorator @ Friday, Sep 14 2012, 16:54)
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:
QUOTE
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

Michael-Knight1
  • Michael-Knight1

    Never Give UP

  • Members
  • Joined: 08 Jul 2012

#9

Posted 14 September 2012 - 11:04 PM

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

Caencel
  • Caencel

    Bugpills

  • Members
  • Joined: 05 Sep 2012

#10

Posted 16 September 2012 - 05:28 PM

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


Michael-Knight1
  • Michael-Knight1

    Never Give UP

  • Members
  • Joined: 08 Jul 2012

#11

Posted 16 September 2012 - 05:37 PM

QUOTE (Caencel @ Sunday, Sep 16 2012, 17:28)
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...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 ....

maxorator
  • maxorator

    VC:MP lead developer

  • Members
  • Joined: 24 Feb 2006
  • None
  • Contribution Award [Mods]

#12

Posted 17 September 2012 - 10:46 PM

QUOTE (Caencel @ Sep 16 2012, 17:28)
- 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.
QUOTE (Caencel @ Sep 16 2012, 17:28)
- 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.
QUOTE (Caencel @ Sep 16 2012, 17:28)
- 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.
QUOTE (Caencel @ Sep 16 2012, 17:28)
- 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...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?

Caencel
  • Caencel

    Bugpills

  • Members
  • Joined: 05 Sep 2012

#13

Posted 18 September 2012 - 02:18 AM Edited by Caencel, 18 September 2012 - 02:22 AM.

QUOTE
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 (*)

QUOTE
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

QUOTE
I don't do DRM.


not quite sure what's that but it was something i thought it would matter.

QUOTE
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

Caencel
  • Caencel

    Bugpills

  • Members
  • Joined: 05 Sep 2012

#14

Posted 28 October 2012 - 12:05 AM

just a quick problem here man, i made a wheel pack for Vice City but Blender is exporting it without textures

http://www.mediafire...y8313x4z3nt4611

these are the wheels exported and textures

maxorator
  • maxorator

    VC:MP lead developer

  • Members
  • Joined: 24 Feb 2006
  • None
  • Contribution Award [Mods]

#15

Posted 28 October 2012 - 01:15 AM

QUOTE (Caencel @ Sunday, Oct 28 2012, 03:05)
just a quick problem here man, i made a wheel pack for Vice City but Blender is exporting it without textures

http://www.mediafire...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?

Caencel
  • Caencel

    Bugpills

  • Members
  • Joined: 05 Sep 2012

#16

Posted 28 October 2012 - 05:00 AM Edited by Caencel, 28 October 2012 - 05:04 AM.

QUOTE (maxorator @ Saturday, Oct 27 2012, 19:15)
QUOTE (Caencel @ Sunday, Oct 28 2012, 03:05)
just a quick problem here man, i made a wheel pack for Vice City but Blender is exporting it without textures

http://www.mediafire...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

maxorator
  • maxorator

    VC:MP lead developer

  • Members
  • Joined: 24 Feb 2006
  • None
  • Contribution Award [Mods]

#17

Posted 28 October 2012 - 05:08 AM

QUOTE (Caencel @ Sunday, Oct 28 2012, 08:00)
QUOTE (maxorator @ Saturday, Oct 27 2012, 19:15)
QUOTE (Caencel @ Sunday, Oct 28 2012, 03:05)
just a quick problem here man, i made a wheel pack for Vice City but Blender is exporting it without textures

http://www.mediafire...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.

captainkman
  • captainkman

    Player Hater

  • Members
  • Joined: 19 Dec 2012

#18

Posted 19 December 2012 - 08:44 AM Edited by captainkman, 19 December 2012 - 09:46 AM.

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.

brian.
  • brian.

    Possible Descendant Of Kraff

  • BUSTED!
  • Joined: 13 Jan 2012

#19

Posted 15 January 2013 - 08:27 PM

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

captainkman
  • captainkman

    Player Hater

  • Members
  • Joined: 19 Dec 2012

#20

Posted 15 January 2013 - 10:00 PM Edited by captainkman, 16 January 2013 - 11:35 AM.

QUOTE (brian. @ Tuesday, Jan 15 2013, 20:27)
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

zaauriel
  • zaauriel

    Player Hater

  • Members
  • Joined: 25 Apr 2011

#21

Posted 15 February 2013 - 05:26 PM

Cant download Gtagarage not responding, any alternate downloads?

zaauriel
  • zaauriel

    Player Hater

  • Members
  • Joined: 25 Apr 2011

#22

Posted 18 March 2013 - 12:08 AM

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?

mirh
  • mirh

    Peon

  • Members
  • Joined: 01 Aug 2012
  • Italy

#23

Posted 26 June 2013 - 07:47 PM

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
CODE
Ignoring extension data of type 0x253f2f8
Traceback (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 1

location: <unknown location>:-1

should i use an older blender version?

Bernie Buddy
  • Bernie Buddy

    Player Hater

  • Members
  • Joined: 27 Jun 2013

#24

Posted 21 September 2013 - 06:47 AM

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?


Silent
  • Silent

    Chief Vision™ Alterer

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#25

Posted 21 September 2013 - 10:18 AM

GTAGarage widget is still gone, the topic used to be linked to this GTAGarage submission:

http://www.gtagarage...ow.php?id=21598

Concavax
  • Concavax

    Punk-ass Bitch

  • Members
  • Joined: 26 Dec 2013
  • None

#26

Posted 10 October 2014 - 05:29 AM

Updates? :)

DYOM designer
  • DYOM designer

    Crackhead

  • Members
  • Joined: 12 Apr 2016
  • Algeria

#27

Posted 23 April 2016 - 02:11 PM Edited by DYOM designer, 23 April 2016 - 02:12 PM.

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




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users