IPB

Welcome Guest ( Log In | Register )

Can Blender be programmed to output BF2 Objects?
oldrick
post May 11 2017, 08:42 AM
Post #1


Captain
***

Group: Soldiers
Posts: 39
Joined: 27-August 15
Member No.: 10,819



I, personally, can not write the code to get Blender to export BF2 objects.
I'm asking if it can be done.

BACKGROUND
Originally DICE created the BF2 objects with a 3D software called MAYA. First using version 4.5 then upgrading to version 6.0.1. But, the objects in MAYA weren't quite ready for game use. Using utilities they wrote for MAYA everything DICE created was Exported to a proprietary file format. After an object was created using MAYA it was then brought in to BF2Editor and "adjusted" in the Object Editor function of BF2Editor. The output from BF2Editor was then ready for use in the game.
When you install BF2Editor you get a small set of tools to be used with MAYA. There are in the folder ../EA GAMES/ Battlefield 2/maya. These tools are add-ons or extensions for MAYA mostly written in mel (MAYA Embedded Language). There are a few other tools in there as well. But, for various reasons, MAYA didn't catch on with the BF2 modding community.


When BF2 was released there was another 3D software by Discreet called 3dsmax. A coder, going by the name Rexman, wrote a series of tools (mostly in maxscript) for 3dsmax that allowed the creation and export of BF2 objects. Now, Rexman's tools required a special utilitty to convert 3dsmax format into the proprietary BF2 file format but the utility was built into the tools. Rexman's tools worked with Discreet 3dsmax versions 5, 6, and 7. It helped that Discreet had a "Student Version" which was cheap enough for most people to afford. It had reduced function but enough capability for BF2 modding. This attracted people to BF2 modding. Autodesk took over from Discreet and made some changes. With the changes Autodesk 3ds MAX 8 no longer supported Rexman's tool kit. Luckily, some people were skilled enough they adapted Rexman's tools to Autodesk 3ds MAX 8 and 9.

BUT
These older versions of 3D software that support Rexman's tools (and derivatives) are no longer available. Even worse newer Operating Systems don't run the old software even if you have a working copy. And to make it really painful (as Dnamro pointed out to me) the latest hardware (circa 2017) doesn't have device drives for Windows XP. So you can't even build a system with new hardware that will run an old OS and old software.


Blender is a 3D software that is Open Source. And, based on what I have read, it can be programmed with Python code to do many things.

SO...

Can Blender be adapted to output BF2 objects?

The best choice-
Can Blender can be programmed to duplicate the entire structure that Rexman's tools require? And if this can be done can the "conversion utility" inside the tool kit change the object into the proprietary BF2 file format?
(Two major coding projects)

A poor second choice-
(If Rexman's tools can't be duplicated and/or his conversion utility can't be made to work.)
Can Blender be programmed to output MAYA 6 format? Then could the utility in the DICE MAYA tools be made to work on this file to create the BF2 format?
(Also two major coding projects.)
Go to the top of the page
 
+Quote Post
2 Pages V   1 2 >  
Start new topic
Replies (1 - 14)
Dnamro
post May 11 2017, 10:42 AM
Post #2


CinC (for now)
Group Icon

Group: Mr. Admin
Posts: 6,899
Joined: 28-December 03
From: Fort Hood, TX
Member No.: 46



I actually started learning to 3d model with Blender, but gave it up due to the lack of tool support for Battlefield.

There is a major problem with trying to use the 3dsmax and the Maya plugins to figure out how to export and import the BF2 formats with Blender: Both use compiled utilities to read write the BF2 format which hides the true format from us. I believe this was to speed up the process, since compiled code runs faster than scripted code. Now, for 3dsmax, the tools have been updated to support 32 bit version of max 2009. Since the compiled coded was created in 32 bit, it won't work with 64 bit versions of 3dsMax and Autodesk stopped supporting 32 bit versions of Max after Max 2013.

As far as updating Maya, I can't even get the Maya 6 installer to work on any OS newer than Windows 7.

At least 3dsmax 9 will still work with Win 7 and can be used to export/import on Win 10, but graphic artifacting is too frustrating to use Max 9 on Win 10 to try to do any model editing.

As far as using Blender, the best reference to try to write python script to read the Battlefield model format is Remdul's BFMeshView and BFMesh parser tools that he posted the source code on GITHUB:


https://github.com/ByteHazard/BF2Mesh

It is a BF2 mesh loader in the form of a command line tool, and was intended to serve as documentation.
For more details on how to process or render the data, see BfMeshView source code (although it has become a bit messy over the years):

https://github.com/ByteHazard/BfMeshView

But that only gets us the file structure to read the BF2 file format. Writing is probably more than just reversing the process. Also trying to figure how to recreate a 3dsmax or Maya Schematic in Blender is another challenge.


Personally, the only tools that I commonly use are for Navmeshing, which is in standard obj format and AImeshes which are in collision mesh format. So, I was actually looking at modifying the current obj file exporter to work better for Navmeshing.

Then I was going to see about writing a collision mesh importer/exporter tool for Blender. I messed around with modifying the Python code for navmeshing, so I was hoping it would not be too hard to figure it out for Blender. Currently, the plugins will only export a collision mesh as part of a standard mesh. I have successfully used another Standard mesh to export the collision when I was having issues with getting one to export and it worked just fine for navmeshing. So I believe that it should be possible to export a collision mesh separately from the standard mesh.

Anyway, it would be huge, but it will be a matter of starting small and then slowly adding.


--------------------
No, my Avatar is not my dog.
Go to the top of the page
 
+Quote Post
clivewil
post May 12 2017, 10:38 AM
Post #3


meh.
Group Icon

Group: Mr. Admin
Posts: 2,008,262
Joined: 24-July 07
From: Perth, Western Australia
Member No.: 3,545



QUOTE (Dnamro @ May 12 2017, 12:42 AM) *
At least 3dsmax 9 will still work with Win 7

after closing max, do you end up with a rogue 3dsmax.exe process that won't die unless you kill it manually? that's what happens with max 7 under win 7, and it also seems a whole lot less happy in general than when it's running under xp - less stable, less able to handle large or complex objects, and also memory leaks meaning i need to save often and quit/restart regularly - but it does work to a reasonable degree


--------------------
Go to the top of the page
 
+Quote Post
zukov
post May 12 2017, 11:02 AM
Post #4


Captain
***

Group: Soldiers
Posts: 55
Joined: 3-June 15
Member No.: 10,671



the Blender plugin would be a dream, with "make a Human" tool you have a endless soldiers characters

maybe ask help to blender foundation, a german guy achieved a plugin for crysis wars (cryengine 2) just for the statics and in crysis 3 is fully functional

for some aspects the engines are similar......... there is a plug in also for Arma 3


limk to collada cgf

collada cgf for blender

This post has been edited by zukov: May 12 2017, 11:31 AM
Go to the top of the page
 
+Quote Post
Dnamro
post May 12 2017, 11:23 AM
Post #5


CinC (for now)
Group Icon

Group: Mr. Admin
Posts: 6,899
Joined: 28-December 03
From: Fort Hood, TX
Member No.: 46



QUOTE (clivewil @ May 12 2017, 11:38 AM) *
QUOTE (Dnamro @ May 12 2017, 12:42 AM) *
At least 3dsmax 9 will still work with Win 7

after closing max, do you end up with a rogue 3dsmax.exe process that won't die unless you kill it manually? that's what happens with max 7 under win 7, and it also seems a whole lot less happy in general than when it's running under xp - less stable, less able to handle large or complex objects, and also memory leaks meaning i need to save often and quit/restart regularly - but it does work to a reasonable degree


No major issues running in Windows 7 for Max 9. The only issue I encountered, was after the system has been idle and then when you go back to open it back up, Max 9 won't respond. The work around that I found was to attempt to close it from the icon on the task bar. It then asks to save the data. I tell it to cancel and I can open it back up. It seems to be about as stable as it was on XP. If I does crash it's almost always because I had not restarted the system in a while and just put the laptop to sleep, or have too many applications open at one time.


--------------------
No, my Avatar is not my dog.
Go to the top of the page
 
+Quote Post
Dnamro
post May 12 2017, 11:35 AM
Post #6


CinC (for now)
Group Icon

Group: Mr. Admin
Posts: 6,899
Joined: 28-December 03
From: Fort Hood, TX
Member No.: 46



QUOTE (zukov @ May 12 2017, 12:02 PM) *
the Blender plugin would be a dream, with "make a Human" tool you have a endless soldiers characters

maybe ask help to blender foundation, a german guy achieved a plugin for crysis wars (cryengine 2) just for the statics and in crysis 3 is fully functional

for some aspects the engines are similar......... there is a plug in also for Arma 3


Someone asked for a BF1942 exporter/importer back in 2010 and the only response was crickets chirping in the background. (No response)

https://www.blender.org/forum/viewtopic.php?t=17031

The problem is that it would require specific knowledge background and very little incentive for someone to take the time. A better approach would be to attempt it and and then ask for help with specific problems as you go along. Blender developers are more likely to respond to specific questions rather than a general request to create a complete add-ons, especially for a 10 year old game no longer supported by the developers.


--------------------
No, my Avatar is not my dog.
Go to the top of the page
 
+Quote Post
oldrick
post May 13 2017, 05:53 PM
Post #7


Captain
***

Group: Soldiers
Posts: 39
Joined: 27-August 15
Member No.: 10,819



Looking at a .staticmesh in a Hex Editor shows that most of the file seems to be just numbers. But, near the end of the file you see ASCII that can be read. And the stuff that can be read lists several .dds files. Including the folder "tree" of where the .dds file can be found in the Objects_Server.zip file. It appears that the .staticmesh doesn't have any textures in it but does have pointers to which folder inside the Objects_Server where the .dds file that is used to texture the Static Object can be found.

I haven't gotten into .bundledmesh yet.

Now, Remdul's bfmeshview can output an .obj file from a .staticmesh (based on something I read. I am a Klutz at code and haven't even got bfmeshview to work yet) so it would seem there is an Object inside the .staticmesh file. And the .staticmesh file must be some kind of numerical (binary?) equivalent to an .obj file which has lists of vertices and faces. Did MAYA even have a numerical (binary?) file format? Or, was the text .obj format it's only output? I'm just wondering if a .staticmesh file could be read by an old version of MAYA or an old version of Blender that can import old MAYA formats.

However, Rexman's tool's for 3dsmax require (enforce?) a hierarchy beyond just the base object. Is it possible a .staticmesh is actually several meshes inside a single file? A 'primary' mesh for the object plus all the other related meshes like lod's, etc?

Do Rexman's tools copy the texture file(s) for an object into the correct location inside the Object_Server.zip? If it does then that would explain why they are so complex. The tools would have to determine where the texture has to be copied to in order for the game to find it. Or, does the utility to convert Rexman's RMesh to the final .staticmesh handle that?

I haven't written anything that could be called code in over 30 years. So, I don't really understand Remdul's source code and I certainly can't make any sense of Rexman's maxscript tools.

This post has been edited by oldrick: Sep 8 2017, 07:55 AM
Go to the top of the page
 
+Quote Post
Dnamro
post May 13 2017, 06:32 PM
Post #8


CinC (for now)
Group Icon

Group: Mr. Admin
Posts: 6,899
Joined: 28-December 03
From: Fort Hood, TX
Member No.: 46



Yes, BFMeshView can export to Obj format. I haven't used it and don't know how accurate the OBJ format export actually is. My experience is that if 3ds Max can't export to obj format and keep the UV map, then I would not expect Remdul's tool to be able to either, which is the big problem with importing the BF format into 3ds Max or Maya. Remdul explained the problem was that your converting from one format to another and anytime you do that you may lose some information, and the model may get corrupted. So, importing into BFMeshView, 3ds Max, Blender or Maya from BF2 format is a data loss point, and then exporting into obj format is another. Every time you convert from one format to another, there is a potential for the model to become corrupted from the original.

Both plugins for Maya and 3ds Max use compiled code to help with the conversion, that we don't have access to look at.

Even though Remdul's code is released on GITHUB, it is very difficult to follow because it is not well documented and is very complicated because it handles all models from BF1942 to BF Heroes. Yes, the BF model format is mostly binary.

I used to code C/C++, but that was over 15 years ago. I will have to brush up to try to figure out the file formats. Right now I am going through Remdul's collision mesh importer to start with. Since it is more focused, it should be easier to use for the BF2 Collision mesh format, although, I am struggling to figure out the 3ds Max data structure format, but at least all the info is online.


--------------------
No, my Avatar is not my dog.
Go to the top of the page
 
+Quote Post
Dnamro
post May 13 2017, 08:23 PM
Post #9


CinC (for now)
Group Icon

Group: Mr. Admin
Posts: 6,899
Joined: 28-December 03
From: Fort Hood, TX
Member No.: 46



Going through Remdul's collisionmesh importer script for 3dsMax made me realize that this will be a lot harder than we had thought. Importing is not the issue. Remdul, figured out how to import and made his code available. I was able to figure out the format for a collision mesh from reading through his script and believe that I could create a script to import into Blender. The problem is that not all the data was needed to import the models into 3ds Max, so he skipped over that data, some of it he did not figure out what it represented. Most likely it was used by the game engine, just not needed to import into max. So, this will be a challenge to fill in these blanks and make sure that all the data is exported correctly.


--------------------
No, my Avatar is not my dog.
Go to the top of the page
 
+Quote Post
Dnamro
post May 16 2017, 06:09 PM
Post #10


CinC (for now)
Group Icon

Group: Mr. Admin
Posts: 6,899
Joined: 28-December 03
From: Fort Hood, TX
Member No.: 46



Well, I heard back from Remdul. He confirmed, what I was afraid of -- that he did not figure everything out. One example is that there is a section of data in the collision mesh, called ydata and zdata, that was not needed for importing and he skipped over and never figured out exactly what it was used for. He believes that it is some sort of collision detection optimization information used by the game engine. The problem is that without knowing how this data is generated or how to update it, the collision meshes may not work correctly in game without valid data. I will do some testing and set up the data fields to be logged. That way I can try changing the collision meshes and see if or when the data changes based on different changes to the collision meshes. It may not be changed at all for collision 3/AImesh modifications, which means writing a import/export tool for Blender in order to create or change AImeshes should just reading the y/zdata, saving is somewhere, and then just writing it back out when exporting.

Also, he said that the BF2 plugins for for him for 3ds Max 2015. Now, this may be possible that max versions after 2013 may work or they may be able to be modified to work. Since Max 2014 + are only 64 bit, it may very well be possible that it will work with both 32 and 64 bit plugins. It would make sense that Autodesk would not want to prevent loyal fans from upgrading to the most current version because of a lack of 32 bit tool support. Currently, I don't have a newer version to test with. Is there anyone with Max 2014 or later that can test the BF2 plugins?


--------------------
No, my Avatar is not my dog.
Go to the top of the page
 
+Quote Post
mschoeldgen
post May 19 2017, 11:19 AM
Post #11


Major
****

Group: Soldiers
Posts: 738
Joined: 26-September 04
From: Berlin
Member No.: 410



Probably the least painful way to make any 3D Modeller with scripting capabilities export BF2 Models would be to generate Rexmans intermediate format RMesh which is then converted by his 'sceneparse.exe' to the valid BF2/2142 mesh.
The format of this format may be examined by looking at the _MainExporter-ms and rSceneDump.ms Maxscripts and of course in RMesh.ms and RMesh_Import.ms

Once the RMesh file (*.dat) is exported you can feed it into sceneparse.exe.


--------------------
http://www.xww2.com Reviving the past on todays game engine
Go to the top of the page
 
+Quote Post
Dnamro
post May 19 2017, 05:07 PM
Post #12


CinC (for now)
Group Icon

Group: Mr. Admin
Posts: 6,899
Joined: 28-December 03
From: Fort Hood, TX
Member No.: 46



QUOTE (mschoeldgen @ May 19 2017, 12:19 PM) *
Probably the least painful way to make any 3D Modeller with scripting capabilities export BF2 Models would be to generate Rexmans intermediate format RMesh which is then converted by his 'sceneparse.exe' to the valid BF2/2142 mesh.
The format of this format may be examined by looking at the _MainExporter-ms and rSceneDump.ms Maxscripts and of course in RMesh.ms and RMesh_Import.ms

Once the RMesh file (*.dat) is exported you can feed it into sceneparse.exe.


Hey Bud,

I not only agree, I think it may be the only way. There are just too many missing pieces in our collective understanding of the BF model format as well as a complete understanding of how to convert the BF model into a use-able format. Thanks for pointing us in the right direction and keeping us from going down the wrong rabbit hole. I also believe that the sceneparse.exe will work with newer 64 bit versions of 3ds Max and other 3d modelling software. It may be easier to figure out how to get everything working with newer versions of 3ds max first. bigthumb.gif




--------------------
No, my Avatar is not my dog.
Go to the top of the page
 
+Quote Post
mschoeldgen
post May 20 2017, 07:45 AM
Post #13


Major
****

Group: Soldiers
Posts: 738
Joined: 26-September 04
From: Berlin
Member No.: 410



QUOTE (Dnamro @ May 19 2017, 06:07 PM) *
It may be easier to figure out how to get everything working with newer versions of 3ds max first. bigthumb.gif

My knowledge of newer Max Versions than Max 9 is nil and so i'm not in a position to say if it is possible to run the maxscripts from Rexman from those. At least it should not be impossible to edit the maxscripts to make them work, although how much work it is i cannot tell.

It is a bit annoying that Autodesk and their successors did change the syntax of Max' scripting language so that newer versions won't work with older scripts - and that doesn't only concern our little modding community but a lot of users around the globe.


--------------------
http://www.xww2.com Reviving the past on todays game engine
Go to the top of the page
 
+Quote Post
Dnamro
post May 21 2017, 08:19 PM
Post #14


CinC (for now)
Group Icon

Group: Mr. Admin
Posts: 6,899
Joined: 28-December 03
From: Fort Hood, TX
Member No.: 46



QUOTE (mschoeldgen @ May 20 2017, 08:45 AM) *
My knowledge of newer Max Versions than Max 9 is nil and so i'm not in a position to say if it is possible to run the maxscripts from Rexman from those. At least it should not be impossible to edit the maxscripts to make them work, although how much work it is i cannot tell.

It is a bit annoying that Autodesk and their successors did change the syntax of Max' scripting language so that newer versions won't work with older scripts - and that doesn't only concern our little modding community but a lot of users around the globe.


I believe that it should be able to be made to work with never versions since 2013. I don't think it matters that the sceneparse is only 32 bit. That may have been an issue in versions of max that had a 32 bit version, but not that there is only a 64 bit version, I have hunch that it is possible.

It sure is annoying that Autodesk does not make their scripting language backwards compatible.

Anyway, going through the code, I did notice that there are parts of the rmesh that are skipped by the max script, with a note that it is not needed by 3ds Max. This backups the issue that every time you do a conversion between the BF model format and into the Modeling tool of choice, there is data loss. Without a good understanding of the data, it's impossible to be certain if it's important or not. That's why I am trying to figure out the data format. That has to be the first step. Hopefully between the rmesh and what Remdul has figured out, a good understanding of the BF format will eventually be possible. Unfortunately, the Max script code is not well documented, which makes it all the more difficult. At this point I just want to see if its even possible. Because if the data structure can be figured out for the BF Model, then it's just a matter of finding someone that can write Python code for a Blender Addon.


--------------------
No, my Avatar is not my dog.
Go to the top of the page
 
+Quote Post
Dnamro
post May 22 2017, 07:17 PM
Post #15


CinC (for now)
Group Icon

Group: Mr. Admin
Posts: 6,899
Joined: 28-December 03
From: Fort Hood, TX
Member No.: 46



I took a quick look through the Maya plugins and even the BF42 plugins to include the updates for Max versions up to 2013, and they all use a conversion tool to convert from an rmesh type intermediate model data structure. What is most interesting is that the BF42 plugins were only updated to Max 2013. I never realized the significance of that until I found out that Max stopped supporting a 32 bit version with Max 2014.

Then I confirmed that the 64 bit versions of 3d modeling software will not play well with 32 bit sceneparser:

Mixing 32-bit and 64-bit Environments

Here is the list of environment-mixing restrictions within which you must operate when developing plug-ins with Version 9 and later of the 3ds Max SDK:
Microsoft provides an OS-level compatibility layer, called WOW64, which allows 32-bit applications to run under 64-bit Windows; but it cannot be used in any other context, such as allowing 32-bit and 64-bit components of a single application to cooperate with one another.
You can run 32-bit systems on 64-bit machines, but you can't do the opposite (64-bit systems on 32-bit machines).
You can compile 32-bit and 64-bit plug-ins on both 32-bit and 64-bit computers using Microsoft Visual Studio; the compiler is a 32-bit application that runs in both environments.
You can only run 64-bit 3ds Max on a 64-bit machine running 64-bit Windows.
You can only use 32-bit plug-ins with the 32-bit version of 3ds Max.
You can only use 64-bit plug-ins with the 64-bit version of 3ds Max.
You can simplify your 3ds Max SDK work environment by running 64-bit Windows on a 64-bit computer, building 32-bit and 64-bit plug-ins on the same machine for your users according to their needs.

Reference:
http://help.autodesk.com/view/3DSMAX/2017/...B35FE60BEBA_htm

It seems that the biggest problem with older max scripts not working with newer versions is probably because of the 32/64 issue. This would be the same issue with Blender 64 bit, but at least Blender does have a 32 bit version available -- and most likely will continue for some time. However, converting the scripts from 3ds Max to Blender is beyond my capability. Also the scripts for the plugins are not well documented. It would take someone well versed in Max script to be able to decipher the Rmesh structure based on the scripts. Remdul's BFMeshView does not help either, because he only figured out enough to be able to read the BF Models, but he skipped anything that he did not need for his tools to work.





--------------------
No, my Avatar is not my dog.
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 24th September 2017 - 04:31 AM