Quantcast

Jump to content

» «
Photo

[REL|Beta] DFF Import/Export script for Blender

152 replies to this topic
ModelingMan
  • ModelingMan

    Crackalacking!

  • Feroci Racing
  • Joined: 23 Jan 2004

#31

Posted 13 April 2004 - 09:38 PM

QUOTE
PS and if this works wheres a new player model for vice city I wanna see one.

Well that tells me that you didn't even read any posts.

QUOTE (By Hollower Posted on Mar 24 2004 @ 01:04)
user posted image


And yes it does work, I have converted peds from GTA3 to VC for the GTA:LC mod, I also just converted a marine that someone made:
user posted image

I fixed his wrists, but Silent Viper hasn't tested it yet

Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#32

Posted 13 April 2004 - 11:48 PM

Delfi: I know importing normals would be better, there was a bug or something in Blender that prevented it from working (as soon as you enter edit mode the normals were erased). But that was several Blender versions ago so I will try again and see if they fixed it.

Switch_Designs: I really can't make much sense out of that...sentence. Zmodeler can't do skeletal models and no script can change that. My script is written for Blender's Python API and can't be used by anything else.

ModelingMan: You're doing great work!

BTW for the curious, the character in that shot is something I converted (with significant editing) from this site: http://blenderchar.weirdhat.com/
His head is based on the Blender logo.

ModelingMan
  • ModelingMan

    Crackalacking!

  • Feroci Racing
  • Joined: 23 Jan 2004

#33

Posted 14 April 2004 - 03:23 AM

QUOTE (By Hollower Posted on Apr 13 2004 @ 23:48)
His head is based on the Blender logo.

Yeah I just noticed that today.

QUOTE (By Hollower Posted on Apr 13 2004 @ 23:48)
I really can't make much sense out of that...sentence.

LOL.

@Switch_Designs: I don't understand, be more specific about your problem, don't compare it with a "blender"

BFBsnow
  • BFBsnow

    Mod Chinna

  • Members
  • Joined: 16 Apr 2004

#34

Posted 17 April 2004 - 11:10 AM Edited by BFBsnow, 24 April 2004 - 10:35 AM.

''

ModelingMan
  • ModelingMan

    Crackalacking!

  • Feroci Racing
  • Joined: 23 Jan 2004

#35

Posted 18 April 2004 - 01:24 PM

You cannot use zmodeler to export a model straight into Vice City, the whole purpose of this thread is to export them by using Blender. Zmodeler doesn't suppert bones.

BFBsnow
  • BFBsnow

    Mod Chinna

  • Members
  • Joined: 16 Apr 2004

#36

Posted 20 April 2004 - 11:36 AM Edited by BFBsnow, 24 April 2004 - 09:05 AM.

我看不懂英语

ModelingMan
  • ModelingMan

    Crackalacking!

  • Feroci Racing
  • Joined: 23 Jan 2004

#37

Posted 20 April 2004 - 11:41 AM

QUOTE (By BFBsnow Posted on Apr 20 2004 @ 11:36)
But i realy want to edit a player myself

If you be patient enough and wait for me to write a tutorial on how to get your player models into VC then you'll be able to do it yourself, this tutorial will include pics.

BFBsnow
  • BFBsnow

    Mod Chinna

  • Members
  • Joined: 16 Apr 2004

#38

Posted 20 April 2004 - 01:59 PM

oh!!realy?YOU are the haro in my heart!! waiting......

侠盗猎车手,有你而精彩!grand theft auto because you ,to be Fascinating!
(I english not well,please tell me the way to find you Guidebook,if you end it)



thanks agin
this is out chinese gtaer's website.if you want,welcome to.
chinese gtaer's Web

The gtaers all of the world are families!!!!!!!!!!!!
All of the world's gtaers solidify!!!!!!!!!!!!!!!!!!!!!!

sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#39

Posted 23 April 2004 - 01:54 AM

Hollower, I've been using Blender for a year and a half. I only started with it because Zmodeler was just not what I wanted.

This script is ideal for what I want to do. I've had to build in Blender then export as .dxf, then convert that to .lwo, then import that into zmodeler and export as .dff file.

Is it mandatory for the meshes to be converted to tris, can the game engine not cope with quads?

You can convert quads to tris from Blender's edit menu (Spacebar>Edit>Convert quads-tris + vica versa) then export.

If anyone needs any tutorials for Blender the best place is the Blender online community at www.elYsiun.com

Will play with this script over the weekend. tounge2.gif

Nice to see the BLender logo inside VC.

Sonix.

Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#40

Posted 24 April 2004 - 07:15 AM Edited by Hollower, 24 April 2004 - 07:19 AM.

QUOTE (sonix)
Is it mandatory for the meshes to be converted to tris, can the game engine not cope with quads?

Correct. Or if it can nobody knows the format. All the existing
models and exporters use triangle lists.

QUOTE (sonix)
If anyone needs any tutorials for Blender the best place is the Blender online community at www.elYsiun.com

Yep, I put a link in the tutorial. I am also a member. The forums
are the best place to get up-to-date information, as most tutorials
are very dated.

BFBSnow: can you edit the picture out of your post,
please? It is messing up the page width so posts don't wrap.
Just make it a link.

TRN4L
  • TRN4L

    Novus Ordo Seclorum

  • Members
  • Joined: 10 Jul 2003

#41

Posted 24 April 2004 - 07:40 AM

all he's gotta do is put a line break after each image and it'll be fine.

BFBsnow
  • BFBsnow

    Mod Chinna

  • Members
  • Joined: 16 Apr 2004

#42

Posted 24 April 2004 - 10:33 AM

I have already edited my speech.
thank ModelingMan and Dup.
you let me know that Speak having of English the good man!
but i can't understant the Hollower.
and I can't completely comprehend English.
I think I stay at this also have no a meaning
byebye,my friends!
Welcome to China...
user posted image

sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#43

Posted 26 April 2004 - 02:53 AM

Hollower, I've been using the script over the weekend. I have been importing vehicles, have not tried any characters yet.

Is it absolutely neccesary to extract all textures into the same folder the dff file is in before importing the dff file? I ask because I get warning messages about texture not loaded, then the script crashes with Unknown type passed to function <setEuler> . Just wondering if this is a result of the script not finding the texture files from the txd file.

Then the dff file is imported onto the different layers as the tute says, but the doors/bonnet/boot/damaged sections are not aligned correctly. Also the dummy objects don't seem to be imported, is this due to the script exiting before it finishes it's conversion?

Top work besides.

Sonix.

Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#44

Posted 26 April 2004 - 03:30 AM

QUOTE
Is it absolutely neccesary to extract all textures into the same folder the dff file is in before importing the dff file? I ask because I get warning messages about texture not loaded,

It always tries to load the textures referenced in the dff file, but they aren't required. But if you were to then re-export the same model it would have no textures in-game even if there is a proper TXD. The warning is just a reminder so you know which ones to extract if you need them.

QUOTE
then the script crashes with Unknown type passed to function <setEuler>

Hmm, I have not seen that. Does it happen with all models? Are they stock from the game or user made? Latest official Blender, or some other build? I want to duplicate it on my end so I can track it down. It's not related to the textures.

QUOTE
Then the dff file is imported onto the different layers as the tute says, but the doors/bonnet/boot/damaged sections are not aligned correctly. Also the dummy objects don't seem to be imported, is this due to the script exiting before it finishes it's conversion?

Yeah, I think all of those effects are related to premature exit. The way it normally goes is everything gets loaded first, then it sets up the hierarchy.

ModelingMan
  • ModelingMan

    Crackalacking!

  • Feroci Racing
  • Joined: 23 Jan 2004

#45

Posted 26 April 2004 - 03:38 AM

QUOTE (By sonix Posted on Apr 26 2004 @ 02:53)
but the doors/bonnet/boot/damaged sections are not aligned correctly.

The problem there is the axis of each object. You didn't fix the axis right in zmod, that's why they are not aligned.

sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#46

Posted 26 April 2004 - 05:13 AM

Hollower, thanks for the reply.

Yeah same for .dff's from the game and with those made by modders.

Blender BF latest version, will try with 2.32 official release today and let you know if I get the same results.

So I have to load the dff into Zmoddler, then align axis, then import into Blender. Seems to be the same method I was trying to use before with dxf's.

Is there no straight conversion into Blender, without having to use zmoddler at all?

Thanks

Sonix.

Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#47

Posted 26 April 2004 - 05:24 AM

Nah, I think ModelingMan is falling back on the old Zmod answer to alignment problems. I'm certain it's because the script exited prematurely, before it could finish setting the parents, location, and rotation.

The script was developed under official versions from 2.31 - 2.32. I don't typically bother with the unofficial builds, maybe they broke one of the functions I used.


sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#48

Posted 27 April 2004 - 01:37 AM

Hollower, you're right. I have been using your script today with 2.32 official release and the dummies are loaded correctly.

However, when adding my own wheels (and using the wheelmod and 249), it's necessary to snap them to the main dummy for the vehicle, instead of snapping them to the wheel dummies. This then puts the wheels in the correct location. If they are snapped to the wheel dummies, they are the same distance away from the car, that the wheel dummies are from the main dummy.

Looks mad though in game. devil.gif

When I've run the script, then opened the UV window to check the UV co-ords were aligned correctly, I found all of them are below (-Y) and to the right (+x) of the image area, but still show up on the model in the correct place. Is this working correctly?

I unpacked the relevant textures, but after export, the spec map doesn't show and the colour information from carcols is now disregarded.

Click here to see screenshot.

Top image is of my Columbian Cartel car in VC, as you can see the whole model is black. The UV's are correct as you can see the lights are in the correct places, but there are no spec or reflection maps showing.

Any ideas as to what Imight be doing wrong. I've even tried exporting from Blender, importing into Zmoddler to load the textures, but when I imported that version into the game, the car was invisible. angry.gif If I don't load any textures in zmoddler, then I get the result of the speeder in the second screenshot, although it's not invisible.

Also the wheels have no rubber, as I can't seem to add any textures into the txd files, only replace, so adding a new UV image in Blender and mapping it, produced these invisible tyres.

I will be very grateful of any help you can give me.

Thanks,

Sonix.

Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#49

Posted 27 April 2004 - 02:56 AM

QUOTE
when adding my own wheels (and using the wheelmod and 249), it's necessary to snap them to the main dummy for the vehicle, instead of snapping them to the wheel dummies. This then puts the wheels in the correct location. If they are snapped to the wheel dummies, they are the same distance away from the car, that the wheel dummies are from the main dummy

This was one of the most annoying problems I wrestled with myself. The only fix I found is...

1. Before parenting anything, do a CTRL-A "apply scale/rot" on the child object.
2. Do parent without inverse CTRL-SHIFT-P instead of the usual CTRL-P.

QUOTE
When I've run the script, then opened the UV window to check the UV co-ords were aligned correctly, I found all of them are below (-Y) and to the right (+x) of the image area, but still show up on the model in the correct place. Is this working correctly?

Yeah, they are straight from the dff. Rockstar must have used tiled UV maps.

QUOTE
I unpacked the relevant textures, but after export, the spec map doesn't show and the colour information from carcols is now disregarded.

I'm not sure on this one. The TXD texture name may not match the dff. The reference to a texture in a dff is just a string. The script uses the filename minus extension to set this string, NOT the name in the Tex field. On import those two strings match but on export only the filename is read. I did it that way to get around the stupid 20 character limit of the Tex field.

I can see on the bikes that carcol is working even without textures. I don't know why the cartel car is black.

I really appreciate the feedback! I need to rewrite some stuff for the next Blender release whenever that is, so any bugs I can fix before then helps a lot.


sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#50

Posted 27 April 2004 - 04:51 AM

Hi Hollower, thanks for the reply.

The bikes are exports from zmodeler, which is why the carcols are intact.

Inside Blender's 3D windows (ALT+Z for UV face view mode) and when I render, the spec maps are correct, it's only on export that they become dark black.

The wheels problem is easily solved by adding them then snapping them to the main dummy, CTRL+P works fine if they are snapped to this position. Could use the apply rot as you say instead, but both methods work.

Texture is unchanged and named columb.txd to match columb.dff. I've used the landstalker car as the base and just renamed the origonal files in gta.img then added my txd and dff files for the columb as landstal.txd&.dff.

Perhaps I need to rename the truncated names back to the orig length, but I'm not changing the textures yet, just using the originals, so I'm not sure if this is an issue.

A cool addition to your script would be bmp or tga options for textures, as tga can hold the alpha channel as well as the colour (This you know of course.) I saved a copy of the script which has the .bmp extension changed to .tga, but the script still asks for the alpha files. Would be cool to have the option of loading one file per texture instead of two, also would make texture xtraction simpler, 1 tga with alpha and colour. Blender would need to be told to use the texture's alpha, but seeing how you have managed to get the textures to map correctly on import, I can't see this being too difficult.


I'll do some more work with the script today and give you some more feedback. I'm unfortunately not fluent with Python, but after reading through the whole script I can work out what's happening. Would love to be able to help in anyway I can.

Thanks again,

Sonix.



tlayte
  • tlayte

    Player Hater

  • Members
  • Joined: 27 Apr 2004

#51

Posted 27 April 2004 - 08:36 PM

Hey this sounds like a great script. However I dont use blender.

I was just wondering if you could help me out with the file format so I can make a plugin for max 5/6.
I read the page at http://www.chronetal...ex.php?page=dff over and over for hours, got a headache, and learned little. You obviously have a good understanding of the format, and a more in depth one than that site can offer (i see nothing about bones in there for a start)

I downloaded the script to see if I could learn about the format by how you load it, but I have never used python before, so it didn't help. So is there another page with a better description of the format, or if not can you help me out, would be nice to be able to use max for models biggrin.gif
Oh and before I bother, has someone else done it already? hehe

sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#52

Posted 29 April 2004 - 12:45 AM Edited by sonix, 29 April 2004 - 12:51 AM.

Hollower, found out the texture problem, I was using the columb.dff+.txd files from GTA3. This is why the specular maps were not showing.

Still can't get extra wheel meshes to show uv maps in game. This is after uv mapping them inside Blender and assigning the correct material also. I've tried using the textures that are already inside the txd file, instead of adding new ones.

Any ideas?

Tlayte, you can get .3DS exporters for Blender, use this excellent script, to import into Blender, the export using the .3DS script, and open in Max. Reverse the process to get the models back to .dff format.

Thanks,

Sonix.

tlayte
  • tlayte

    Player Hater

  • Members
  • Joined: 27 Apr 2004

#53

Posted 29 April 2004 - 01:56 PM

Yea sonix i guessed that, i expect i could do the same with zmodeller instead of blender too couldn't I? But im still wanting to make a plugin for max 6 anyway smile.gif
Guess I'll make my own thread instead of trying to steal this one, hehe

Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#54

Posted 05 May 2004 - 08:24 PM

Blender 2.33 was recently released, and a small change to one of the API functions causes the script to exit with an error during import.

I made a quick 'one line' fix which you can download here.

The zip contains only the fixed script with no instructions so please do not distribute, and download the original if you need the instructions. I'm still working on the next 'official' version but I wanted to get this bugfix out as quickly as possible.

By the way, blender.org has finally updated the online user documentation to better reflect current releases. Now I'm just waiting for the API docs... sleepy.gif

sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#55

Posted 05 May 2004 - 11:59 PM

Nice one Hollower, thanks for the update. I haven't downloaded 2.33 yet, but will soon.

You can't believe how useful this script really is. biggrin.gif

Sonix.

Demarest
  • Demarest

    what could be

  • BUSTED!
  • Joined: 12 Jul 2003

#56

Posted 06 May 2004 - 01:17 PM

Pinned!

Overdue, but meh...

ModelingMan
  • ModelingMan

    Crackalacking!

  • Feroci Racing
  • Joined: 23 Jan 2004

#57

Posted 07 May 2004 - 09:56 AM

Good to see this got pinned, it's a great script. Thanks Hollower smile.gif

By the way, I discovered that blender doesn't import/export matte colors, I had ripped Mario from the N64 rom and after I converted it in Blender and inserted it ingame the matte colors where gone confused.gif

You know of a way to fix this, or does Blender not deal with matte colors at all?

sonix
  • sonix

    Stoned Monkey.

  • Members
  • Joined: 23 Apr 2004

#58

Posted 10 May 2004 - 01:44 AM

QUOTE (ModelingMan @ May 7 2004, 09:56)
You know of a way to fix this, or does Blender not deal with matte colors at all?

Hi ModelingMan,

By matte colours I presume you mean vertex colours? If you import a GTA3 or GTAVC vehicle into Blender using this script, the vertex colours are imported and exported correctly. (Which version of Blender are you using? If you're using the official release of 2.33 make sure you have the new .PY script with the fix for 2.33. The link is in Hollower's post above. If you don't have 2.33 use the official release of 2.32)

To check that the vertex colours are showing inside Blender, with the mouse pointer over one of the 3d windows, press Z to cycle from wire frame to shaded, CTRL Z for scene lights effect on textures and ALT Z to view UV textures. Usually, transparent materials are coloured pink in UV view mode, and chrome material is pink in shaded view mode. The vehicle body colour is green. (I think this is saved in the DFF format.) You should be able to see if the model you're importing has the colours present.

It maybe possible the model you imported doesn't have the vertex colours saved, but I don't know about this, is it a dff file?


Hollower, I have been using the script today. I came across a minor problem which might be a bug. This is using 2.32 and the b script version. When I try to add new object into an existing dff, the objects are not in the right place in game. (For eg. adding rotors into the BfInjection model (don't ask why)) I add the new objects and add the relevant empty. Then after sorting out the heirarchy correctly, I export the model.

Before I add the new dff to the game, I've gotten into the habit of importing the new dff file into Zmodeler to check the new objects are in the right place, but they are always mis-aligned. I've used CTRL A to apply size/rot, but with no effect. If the extra mesh is snapped to the empty, then it is offset to the left and behind of the empty. If I snap the extra mesh to the central bfinject empty, they are offset behind and above the empty.

I've tried the method I used for adding extra wheels to the vehicle, which was to snap them to the main empty(dummy) but again still mis-aligned.

Can you please offer any advice as this is driving me nuts. blink.gif

Thanks,

Sonix


Hollower
  • Hollower

    theomachist

  • Members
  • Joined: 09 Sep 2002

#59

Posted 10 May 2004 - 05:14 AM Edited by Hollower, 10 May 2004 - 05:26 AM.

ModelingMan: I am also unsure what you mean by matte colors. If you mean the base material color, it is imported (the green and red colors on cars for example). But it may not be displayed in-game. I think vehicals are the only type that show untextured materials with their base color. I'm basing this on what I've seen when running Vice from a program called 3DAnalyze with textures disabled. When I do everything is white, except for vehicals. What format did you import from? Does this mario game also use dff files?

Sonix: Vehical actually don't have vertex colors. What you're describing are the material colors. About your alignment problem, the solution I gave previously works for me. I know you said CTRL-P worked fine, but trust me it causes problems like this. In more detail, here are the steps I have used...

1. create and edit the mesh seperate from the vehical
2. convert quads to triangles
3. make sure the origin is correct (that's the point where it will be attached)
4. exit edit mode
5. CTRL-A "Apply size/rot"

6. select the mesh and the empty it is to be parented to, so that the empty is the lighter pink color meaning it is the 'active' object (you may have to select via SHIFT-F4 "Data Select" mode when things are on top of eachother)

7. CTRL-SHIFT-P "Make parent without inverse". The object should automatically snap to the parent. If it doesn't, select just the child and do ALT-G "Clear location". If ALT-G makes it move to the center of the scene, it was not parented correctly.

I hope that works for you!

ps. those two vlo object names that are too long are automatically fixed by the exporter

ModelingMan
  • ModelingMan

    Crackalacking!

  • Feroci Racing
  • Joined: 23 Jan 2004

#60

Posted 10 May 2004 - 03:02 PM

QUOTE (By sonix Posted on May 10 2004 @ 01:44)
Which version of Blender are you using?

2.31a
QUOTE (By sonix Posted on May 10 2004 @ 01:44)
transparent materials are coloured pink in UV view mode,

Well I haven't used transparent and they still show as pink.
QUOTE (By sonix Posted on May 10 2004 @ 01:44)
It maybe possible the model you imported doesn't have the vertex colours saved, but I don't know about this, is it a dff file?

Yep it's a dff and the vertex colors where exported as I checked in RWAnalyze.

QUOTE (By Hollower Posted on May 10 2004 @ 05:14)
But it may not be displayed in-game.

You're right about that.
QUOTE (By Hollower Posted on May 10 2004 @ 05:14)
What format did you import from? Does this mario game also use dff files?

I imported it as a dff file. The mario game doesn't use DFF files, I actually ripped it from the N64 rom with a plugin included, it saves it as a VRML file which I imported into 3dsmax then exported to 3ds, and retextured in zmodeler.

Another thing about the model ingame is that it appears weird, probably due to the difference in physique between Tommy Vercetti and Mario.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users