Jump to content

[WIP-Tool] 3DS Max Map importer by 50p


50p

Recommended Posts

Hi,

I'm sure not everyone of you has heard of this but I started to make a .map importer for 3DS Max, as well as exporter. Currently I've managed to import most Race maps that I've tested and I made a video showing 2 of the maps. I'm pretty impressed how it turned out and I'm excited to get it finished.

I can't say much about release date but I wante to make an exporter as well so I'm thinking of the best way to implement it since those are original models from gta3.img and exporting these maps straight after importing them would create custom .dff for all of the models. I'm working on a way to export the maps but I also need to identify modified models. Anyway, enjoy the video:

This is a little outdated video, currently I support checkpoints as well as spawnpoints.

I'll be making an installer and testing on different machines will begin.

Link to comment

I wonder why would you need 2 UV channels? Also, it's the GTA limitation if it doesn't support 2 UV channels on models so I can't do anything about that. What do you mean instanced models? I've loaded maps with loops generated by Roller Coaster generator plugin (where loops are created with the same model), I only load 1 model and that model is then instanced all over the scene to create the exact same scene. I'm working on the exporter now. Since I can't export .col files because Kam has encrypted some of the Max scripts (including the one responsible for exporting .col files), I can export .cst files which then can be opened inside CollEditorII and then exported as .cols. I can't get in touch with Kam so I won't get the source code for exporting .col. I want to automate as much as possible but this .col exporting annoys me. I have spoken to some people about exporting .pngs from .txd files but nobody can help me with that. aru was supposed to help me in the middle of April (which is now) to preview textures from .txds, like he did in Spark app where you can preview .txds, so if I could view the images I could then write code to export them but I'm not that advanced coder when it comes to graphics/images file formats, etc. not to mention game texture archives. I do my best though!

Link to comment

Thanks for the comments guys! I'm rewriting my Map exporter as well to export .cst files aside to .dff. .cst files are basically .col meshes but they are not supported by GTA, these files can be opened with CollEditorII which can then export .col files with just 2 clicks. I'm integrating the exporter to the rest of the tools so it's even easier to use. I'll be posting some screenshots or even a video showing the entire process from creating a map to playing it in MTA. For now, here is a screenshot: https://dl.dropboxusercontent.com/u/437 ... sample.png

That's it for now :>

Link to comment
I wonder why would you need 2 UV channels? Also, it's the GTA limitation if it doesn't support 2 UV channels on models so I can't do anything about that. What do you mean instanced models? I've loaded maps with loops generated by Roller Coaster generator plugin (where loops are created with the same model), I only load 1 model and that model is then instanced all over the scene to create the exact same scene. I'm working on the exporter now. Since I can't export .col files because Kam has encrypted some of the Max scripts (including the one responsible for exporting .col files), I can export .cst files which then can be opened inside CollEditorII and then exported as .cols. I can't get in touch with Kam so I won't get the source code for exporting .col. I want to automate as much as possible but this .col exporting annoys me. I have spoken to some people about exporting .pngs from .txd files but nobody can help me with that. aru was supposed to help me in the middle of April (which is now) to preview textures from .txds, like he did in Spark app where you can preview .txds, so if I could view the images I could then write code to export them but I'm not that advanced coder when it comes to graphics/images file formats, etc. not to mention game texture archives. I do my best though!

About instances, I'm talking about the exporter, what happen if you clone the model in max and export all the clones ?

Your tool export all of them into 1 big mesh or into 1 object repeated with different pos and rot?...

I just now remember that MTA cant scale with the col or scale only on x,y or z

Link to comment

So, currently I export one model for each mesh. If you copy objects around only the first one will be exported and others will be just separate 's in the map file. I've also added new section to map file which will define custom models which looks like this:

"filename.txd" > 
    "12345" dff="filename.dff" col="filename.col" /> 

As you can imagine, contains custom model definitions, as well as TXD attribute, this way you can specify which objects will use the same texture. At first, I added txd="" to each but it was harder to define which model will use which txd in 3ds max. You'll find out everything soon. I'll make a video tutorial on how to use the tools because it will be easier to follow for beginners than a written tutorial :>

Link to comment

It's not available yet. I'm working on it as we speak. I want to create a script that will also make .txd files. So, I'm learning about file formats to be able to convert them to DDS (DXTn compressed) format that is used for textures in DirectX games/applications. Yesterday I managed to read .txd files in 3DS Max and display all the texture names stored in the files but I'm still struggling how to convert the actual raw image data to pixels so that I can even display the textures within 3DS Max and apply them to models.that way I'll be able to import fully textured maps :> Like I said earlier, I'm researching the DXT compression as well as .txd file format. Wish me luck.

Link to comment

I actually rewrote your previous Map exporter to be able to do all this, only for myself. I made it to suit my needs but here are a few points you may find useful. I have since successfully lost half of it so can't send it to you.

- Be careful when exporting instanced objects, you need to export the one that has zero rotation as well as offset. Otherwise all the other instances will not look correct

- right click object > Object Properties > User defined.

I used this to set various parameters. You can use it to track the custom objects. It's fairly straight forward. Select all you custom object, write something like

custom = 1

to properties and when you export the map check all the various fields before exporting the dff, writing meta, etc. An example of how to use it check KAMS mapping tools, where he sets the object ID.

- Your script exports with default dff parameters, you need to change it to export only with UV and vcol only that is this line:

DFFout dffFile $selection false true true false 1.0 0x1803FFFF undefined 1 false;

(This may be the correct version compare to your script)

This way we have lighting on the objects and it saves on file size as it strips all the car/player atributes

Link to comment
I actually rewrote your previous Map exporter to be able to do all this, only for myself. I made it to suit my needs but here are a few points you may find useful. I have since successfully lost half of it so can't send it to you.

- Be careful when exporting instanced objects, you need to export the one that has zero rotation as well as offset. Otherwise all the other instances will not look correct

- right click object > Object Properties > User defined.

I used this to set various parameters. You can use it to track the custom objects. It's fairly straight forward. Select all you custom object, write something like

custom = 1

to properties and when you export the map check all the various fields before exporting the dff, writing meta, etc. An example of how to use it check KAMS mapping tools, where he sets the object ID.

- Your script exports with default dff parameters, you need to change it to export only with UV and vcol only that is this line:

DFFout dffFile $selection false true true false 1.0 0x1803FFFF undefined 1 false;

(This may be the correct version compare to your script)

This way we have lighting on the objects and it saves on file size as it strips all the car/player atributes

I do use the user-defined object properties (set/getUserProp) to check if the model has been imported by KAM's script. Imported models contain "FrameName" which is the same name of the model defined in .ide files as well as gta3.img (and other .imgs). I may add my own custom data if I'll need to but so far it works fine. I've noticed the rotation problem before and I'll be resetting the rotation and position to 0.0 for the exporting and then move/rotate it back after exporting. As far as I remember that's what I did in my old script. Currently I'm trying to find information on .dds file format (which is part of what .txd files contain) but I can't find any information on how to convert/decompress the actual 4x4 data blocks to pixel colors. I've found lots of information on how to compress the files but nothing on how to decompress them and aru was going to help me with this one but he seems to be inactive and AFK all the time. I've been researching for 5 days now and found nothing that can help me.

If I did know how does the DirectX reads the .dds files and displays the textures then I could make a TXD material in 3DS Max and apply them to models. If I won't find any more information then I'll have to export the .dds from .txd and use the .dds files themselves. What I've just written may seem a little complicated for someone who doesn't know much about 3DS Max and/or MAxScript'ing. Anyway, back to research.

Link to comment

I do need to write the code myself to work entirely inside 3DS Max. I don't want to export .dds from .txd, I simply want to read the data and create textures in memory out of it. I have tried quite a few libraries but none of them has code that is understandable, especially in a language that I can't write. I simply don't understand graphics programming in terms of graphical file formats. I even tried to read up on other file formats like .jpg, .png, .gif and .tga. It's a nightmare especially if you don't know where to start.

Link to comment
  • 2 weeks later...

I've worked some time on my own model importer and so far it works fine but it only supports static models (no skeleton/animated models are supported). I've also read up on .img file format and it's pretty easy so I also made an .img archive viewer that will also let users import the models straight from the .img files (no need to export the model from .img archive with Spark or IMG Tool before importing to 3DS Max). It's in very early stages so no release date known yet. I'm also thinking of a TXD material in 3DS Max for models, so that users could texture their model within 3DS Max and export the .txd as well as .dff. Last but not least, I've researched the .col file format as well and made a script to import .col files, works fine too.

I made a short video showing only one of the scripts, which is .img viewer, so enjoy (watch on YouTube for 1080p quality):

Link to comment
  • 3 weeks later...

It has slowed down drastically due to me learning OpenGL. I want to include a preview window so that you can view the models before you import them, as well as a TXD viewer to preview textures. I've made a TXD material that is pretty slow because of drawing pixels onto bitmaps being very slow in MAXScript but basically I can open .txd files in Material editor and apply them to models. It's still in very early stage and material IDs don't match the mesh material IDs.

Also, it's difficult to make dynamic UI in 3DS Max because the UI is pretty much static, that is, all UI elements have to be defined at once in a script. So, making scripts in MAXScript like mine isn't that much fun.

Link to comment
  • 3 weeks later...

I haven't touched the project for couple of weeks but I'm back to it and I'm hoping to make a proper model viewer as well. As you can see in the last video I posted here, I made an .img viewer as well, that means I can import GTA models right to 3DS Max without exporting the model from .img and then manually importing it with KAM's script, I just double click the file from the list and it imports that model for me. I'm really excited about this project especially when I achieve something I've always wanted.

I'm not sure if you've seen the latest screenshot I showed the guys on IRC, DuTcHtUrK, because yesterday I finally made a working TXD viewer for 3DS Max:

3ds_txd_viewer.png

Here are some more screenshots of the tools that will come as a package/kit (these are still in development so there may be more):

https://dl.dropboxusercontent.com/u/437 ... viewer.png

https://dl.dropboxusercontent.com/u/437 ... terial.png

https://dl.dropboxusercontent.com/u/437 ... sample.png <-- map settings shown in the map settings window are taken from the meta.xml and these are also saved within .max file so that you can save your map in 3DS Max and re-open it the settings will load with the map!

I don't know of any release date but I'm sure I will inform you guys here. There are some minor bugs but I'll make sure they are gone before release, also I've still got to do the model previewer which will work similarly to the TXD viewer but instead of the actual texture it will show the model.

Have a nice day!

Link to comment
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...