Go Back   Knife Edge > RealFlight - Designer's Corner > RealFlight G3 - Designer's Corner
Use of this site is subject to our Terms of Use. | Looking for technical support? Read this!

Reply
 
Thread Tools Rating: Thread Rating: 58 votes, 5.00 average. Display Modes
  #61  
Old 05-08-2008, 01:09 PM
Bob_holcomb Bob_holcomb is offline
Registered User
 
Join Date: May 2008
Location: Suffolk, VA
Posts: 2
Rayvel,

I'm new on the forums and I was browsing since I just bought G4 and was pleasantly surprised to this thread on exporting models from Blender. I'm one of the blender developers and actually wrote the original 3DS import/export scripts for blender a few years ago (it was even more buggy than the ones included now ).

Would you mind if I used your script to help update the 3DS export in Blender? If there is anything that I can do to help, please let me know. Also, do you know if KE plans on releasing the KEX format documents? I'd be happy to help build an exporter/importer for it.

cheers,

Bob
__________________
--------------------------------------------------------------------------
Halfway down the trail to Hell....
Reply With Quote
  #62  
Old 05-09-2008, 04:06 AM
maxkop's Avatar
maxkop maxkop is offline
Registered User
 
Join Date: Aug 2005
Posts: 775
Hello Bob,

nice to hear that another programmer showing interest in this project. I'm working very long with the scripts from rayvel under blender. So here's an overview what the script does at the moment:

It creates a .3ds - file with working naming conventions (in object, and material names) and correct hierarchy with node support in the .3ds - file. In addition it creates a .sup - file. The empty's of blender are used as pivot points to define the rotational axis for rudder, elevator, ailerons and all that stuff. The connection between which pivot is referring to which 3D - Object is generated over the properties dialog in blender. These properties are exported to the .sup - file. After .3ds - file and .sup - file is exported blender automatically fires up the 3ds2kex.exe, which is reading out .3ds and .sup - file and generates the .kex - file for the Realflight Simulator. The script is compatible with the official version 2.45 of blender, but I'm already working with it under one of the new release candidates 2.46 without problems. The script supports generating aircafts for G3.5 as well as G4.0 (the new beta - 3ds2kex - exporter).

At the moment there are only 2 bugs left, which might not be solveable by changing the script.

1:

It seems that the .3ds - file format is limitated to the convention that one vertex - coordinate can only carry one UV - Texture - Coordinate, so the script is doubling each vertex on a seam line, leading to the effect that one object is getting hard edges, because the faces are surfaced smoothed individually according how you splitting the whole object up into different UV - Regions for texturing. I've already made a bug - report here.

2: Together with the new 3ds2kex - beta exporter, we have control over advanced features like individual surface smoothing of objects and animated light effects. The light effects are already working, but are only accesable by editing the .sup - file manually. Global Surface Smoothing values are crashing G4 during import of the .kex - file. KnifeEdge is (hopefully) already working on this problem.

Point 1 is the big problem. 2 is secondary. If no smoothing values are applied all objects are brutally smoothed under 60, which can lead to bad shadow - effects on the objects. So in general, I control the surface smoothing over the Edge - Split - Modifier in blender. But this trick only works as long as my UV - Mapping is not interferring the work of the the Edge - Split - Modifier. Many thanks for your interest in this project.

I don't know how much interest KnifeEdge is showing in releasing the .kex - file documentation, to write a direct .kex - exporter for blender. An official statement would be good.

Greets,

Max
__________________
Only two things are infinite: the universe and human stupidity... and I'm not sure about the universe.

- Einstein -
Reply With Quote
  #63  
Old 05-09-2008, 10:21 AM
rayvel rayvel is offline
Registered User
 
Join Date: Jun 2007
Posts: 44
Bob - I'd be happy to contribute to the official Blender release. In fact I have been planning to circle back with this script to the Blender source but just have not had the time. If you'd like to take it from here I would be more than happy.

Drop me a PM if you'd like to sync up over email.

As for KEX specs they have not shown any signs to release their proprietary format to the public. The only reason at this point would be to overcome the UV-mapping seams and smoothing as Max mentioned. Could always try to export a non-standard 3DS file providing more than 1 UV coordinate for a vertex but I've no idea what impacts this would have on the KEX converter.

... and welcome to the forums and RF!! Look forward to your involvement!

About the script...
The script has had quite extensive modification to properly support 3DS exporting, at least as far as things look good in Deep Exploration and the sim (I don't actually have a copy of 3dsmax).

It needs some cleanup and commenting for a few of the last revisions, but I have tried to identify the areas of change. I'll add some further comments here which may help, you're free to take the script source and use as you please (especially since you are the primary copyright holder!!)
  • Line 54: New imports, needs some cleanup. Use of Blender Registry would probably be removed as this is only used for the KEX features
  • Line 65-117: Would be removed as this is the registry stuff for KEX only
  • Line 124: "sane_name" method added "buckets" to hold unique names per object type (material, img file, objects, etc) and isFilename indicator. If it is a filename a warning is printed if the name is longer than 12 characters (3ds maximum supported). What I have seen other applications do is they will create copy of the file using 12 characters max name but I have not implemented this at this time.
  • Line 175-183: Added 4 new 3DS chunks for specularity, transparency, percentage and masterscale
  • Line 235 & 253 & 367: Needed to change the file packing method for shorts to handle >32767 values separately from others. Changed int packing method. Changed face packing method.
  • Line 521: Re-enabled COLOR2 chunk
  • Line 526: Added PERCENT chunk
  • Line 540: Small fix in add image method
  • Line 560: Image name inclusion in material name (need to review this if needed or not needed)
  • Line 570-580: Added specularity, reflectivity, transparency output. Used default values as noted from Blender (1, 0.2, 0) if no material is used
  • Line 582-584: Removed output of the material image. Exported ONLY uses the UV-mapping image(s). Could possibly make some changes here for more general purpose usage. Exporting both material image and UV image caused problems with KEX converter (KEX wants 1 image only)
  • Line 619: Changes usage of face.v to face.verts
  • Fun begins...
  • Line 796: Must use this function to get the true local space matrix of an object (the localspace returned by the object directly is wrong, or at least not something 3DS is happy to use)
  • Line 817-883: Mesh objects for 3DS must use a matrix relative to the parent object, which is different than Blender. So must do a bunch of math to convert from Blender's matrix to 3DS matrix.
  • Line 885-908: Re-enabled kfdata. I made some changes to the function but really they could be backed out and instead pass the appropriate values to the input parameters (see comments)
  • Line 911-944: Changed math for track chunks. Main thing to watch for is Blender's scripting will sometimes use radians and sometimes degrees so need to make some conversions back and forth here
  • Line 946-1020: Main changes are empties export using their name (not DUMMY) for KEX support. Also the computation of the rotation, scale and position relative to parent.
  • Line 1023-1137: KEX only stuff
  • Line 1170-1182: Note the CS_GLOBALOPTIONS stuff is KEX only
  • Line 1233-1266: Retrieve object matrix and some conversion from radians to degrees, typically pass rotations around as quaternions
  • Line 1309-1337 & 1348: KEX only
Reply With Quote
  #64  
Old 05-13-2008, 04:06 PM
Bob_holcomb Bob_holcomb is offline
Registered User
 
Join Date: May 2008
Location: Suffolk, VA
Posts: 2
Rayvel,

Thanks. I'll see about pushing your changes upstream. I should have some time this weekend. I also contacted KE about the KEX format, but have not heard back yet.

Cheers,

Bob
__________________
--------------------------------------------------------------------------
Halfway down the trail to Hell....
Reply With Quote
  #65  
Old 11-17-2008, 06:11 AM
bill daniels bill daniels is offline
Registered User
 
Join Date: Jul 2006
Posts: 5
blender

hi i have downloaded blender but when i try and open a file, it tells me there is an error, and its not a blender file, can you edit a current aircraft with it or does the file have to be made from scratch thanks bill oh by the way my version is 2.48a
Reply With Quote
  #66  
Old 11-17-2008, 06:43 AM
maxkop's Avatar
maxkop maxkop is offline
Registered User
 
Join Date: Aug 2005
Posts: 775
Blender 2.48a is incompatible with the scirpt. Download Blender 2.47 and python 2.5.2....than the 3ds2kex - script should work together with the 3ds2kex converter

Greets,

Max
__________________
Only two things are infinite: the universe and human stupidity... and I'm not sure about the universe.

- Einstein -
Reply With Quote
  #67  
Old 11-17-2008, 07:37 AM
rads rads is offline
Registered User
 
Join Date: Oct 2008
Posts: 1
Blender 2.48a work fine but ...

Blender 2.48a work fine for Me but I change this line in script to not use International characters (change international to similar english):
-------------------
__author__ = ["Campbell Barton", "Bob Holcomb", "Richard Larkang", "Damien McGinnes", "Mark Stijnman"]
--------------------

I prepare complete my Edge540 in this blender version and export it do RF G4.5 .
All work fine.

Rads.
Reply With Quote
  #68  
Old 12-16-2008, 03:28 AM
miroslav_karpis miroslav_karpis is offline
Registered User
 
Join Date: Dec 2008
Posts: 1
Hi,

I have tried the script but I'm getting from 3ds max 'Improper file format' error. I'm trying to import 60MB blend file. (23 MB in 3ds format).

please does anybody know that what can be the problem?
Reply With Quote
  #69  
Old 12-16-2008, 06:02 AM
maxkop's Avatar
maxkop maxkop is offline
Registered User
 
Join Date: Aug 2005
Posts: 775
The script was created to generate a .3ds - file, which is useable for the 3ds2kex - exporter, not to create a .3ds - file for 3dsmax. The internal .3ds - export script from blender is not working with the latest version of 3dsmax....

Greets,

Max
__________________
Only two things are infinite: the universe and human stupidity... and I'm not sure about the universe.

- Einstein -
Reply With Quote
  #70  
Old 12-16-2008, 10:20 AM
rayvel rayvel is offline
Registered User
 
Join Date: Jun 2007
Posts: 44
Thanks for the tip on the problem with the latest version of blender. There is a new version 0.99 attached to the thread that fixes this problem with the international characters. No other changes in this version.
Reply With Quote
  #71  
Old 12-16-2008, 10:31 AM
rayvel rayvel is offline
Registered User
 
Join Date: Jun 2007
Posts: 44
Quote:
Originally Posted by miroslav_karpis
Hi,

I have tried the script but I'm getting from 3ds max 'Improper file format' error. I'm trying to import 60MB blend file. (23 MB in 3ds format).

please does anybody know that what can be the problem?
In general the 3ds2kex export script should produce a 3DS file compatible with both Max and Deep Exploration - though this is largely untested. During my (limited) testing everything loaded correctly in Deep Exploration trial version. Since I don't own either Deep Exploration or Max I can't really do any more on this front. If you are able to produce a smaller blend project that doesn't open correctly in Max, I'd be happy to work with you over PM (send me the blend file) and try to make the necessary fixes.

I have been contacted by a person using the script to produce exports for a game called Trackmania and he has altered the script so it works with Trackmania models. It could be his script (Creating Custom Cars with Freeware) will work for your particular blend file and produce a result that works in Max. Give it a try!
Reply With Quote
  #72  
Old 07-21-2009, 03:42 PM
maxkop's Avatar
maxkop maxkop is offline
Registered User
 
Join Date: Aug 2005
Posts: 775
Corrected Script Version for Blender 2.49a

Hello,

this is the script of rayel added by the small changings of post #67. It will now directly work with blender 2.49a. Attached as .g3x - file and .txt file.

Installation instructions:

1 ) Rename .g3x to .zip
2 ) Extract
3 ) Place the export_3ds2kex.py - file into your blender - scripts folder (Location depends on where you have choosen it during the installation of blender)
4 ) Have fun

or:

1) Rename export_3ds2kex.txt to export_3ds2kex.py
2 ) Place the export_3ds2kex.py - file into your blender - scripts folder (Location depends on where you have choosen it during the installation of blender)
3 ) Have fun

Greets,

Max
Attached Files
File Type: g3x export_3ds2kex.g3x (12.2 KB, 121 views)
File Type: txt export_3ds2kex.txt (43.8 KB, 105 views)
__________________
Only two things are infinite: the universe and human stupidity... and I'm not sure about the universe.

- Einstein -
Reply With Quote
  #73  
Old 10-09-2009, 12:38 AM
dbc1012 dbc1012 is offline
Registered User
 
Join Date: Oct 2009
Posts: 2
Export script on Vista

Hi I'm new to this forum and am just starting to work on building objects to add to v 4.5. So first off thanks for building this exporter. It seems so much easier than the gmax path (although I'm yet to have success)!

I've had a little bit of trouble getting the export module to work on my system:
Blender: 2.49b
Python: 2.6.2
Windows Vista SP-2

Basically if I use the script from posting #1 (v99a) the export option does not appear in blender (on the above configuration).
However if I use the script from posting #72 the export option does appear in blender.
My suspicion is that there are some spurious characters in the first 3 bytes of the file that cause python/blender to choke on the script (v99a).
Hopefully I've uploaded this version which removes the initial characters and updated the version number to 99b (and a number of lines have automatically had trailing spaces removed - which I hope aren't significant in python)

Oh and for those of you trying to find the blender scripts directory on Vista try:
C:\Users\your_user_name\AppData\Roaming\Blender Foundation\Blender\.blender\scripts
Attached Files
File Type: txt export_3ds2kex.txt (43.5 KB, 47 views)
Reply With Quote
  #74  
Old 12-10-2009, 12:05 PM
lupus78 lupus78 is offline
Registered User
 
Join Date: Dec 2009
Posts: 2
how to

Hi,

I have the following configuration:
Blender 2.49b
3ds2kex converter (stable and beta too)

I followed this how to and, all the other i found on this forum, but i still have no success.

I created a realy simple modell (attached), and name everything accordingly to the guidelines, but when i create the KEX file, the parts dosen't show up in RealFlight under Visual Mesh, and i can't associate them with the objects!

I used the ~CS_SOMETHING naming convention, and partented the objects in blender too.

i would be happy if anyone could help.
Attached Files
File Type: zip glider1.zip (40.6 KB, 23 views)
Reply With Quote
  #75  
Old 12-10-2009, 07:32 PM
bosshawg's Avatar
bosshawg bosshawg is offline
Registered User
 
Join Date: Dec 2007
Location: Norfolk,England
Posts: 65
Here Try This!

Hope the Zipping Worked.See Posts #48 & #49 that's where Problem Was.Twisted Pivot on your Rudder.Look at Shading Button(F5) in .blend file and notice the special Realflight Name given to the Material(~SBS).At the bottom of this Page http://www.knifeedge.com/KEmax/plane_tutorial.php there are some more.Good Luck!...
Attached Files
File Type: zip Glider1c.zip (85.6 KB, 27 views)
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:14 AM.