Discovery Gaming Community
About mat files and making new textures... - Printable Version

+- Discovery Gaming Community (https://discoverygc.com/forums)
+-- Forum: Discovery Development (https://discoverygc.com/forums/forumdisplay.php?fid=7)
+--- Forum: Discovery Developers Forum (https://discoverygc.com/forums/forumdisplay.php?fid=183)
+---- Forum: Freelancer Modding Tutorials (https://discoverygc.com/forums/forumdisplay.php?fid=36)
+---- Thread: About mat files and making new textures... (/showthread.php?tid=40247)



About mat files and making new textures... - frozen - 05-18-2010

Files you will need can be found in this rar file-

http://www.mediafire.com/?k2d5t2o3duw

Get the NVIDIA photoshop plugin from here:
http://developer.nvidia.com/object/photosh...ds_plugins.html

There have been a few instances in the past where both other people and I have made mistakes when creating textures for freelancer. Ideally, while freelancer has no problems using TGA texture formats for models etc; for discovery (and for any freelancer related texture work, to be honest) people should try to optimize their textures as best as possible.

If you open up a vanilla mat file in UTF editor, you’ll see how the textures are in a specific format- .DDS extensions. There is a simple way to save any textures you create in such a format. Now, i know many people have Photoshop, so this is somewhat directed toward them. To ensure you save your textures in the correct .DDS format, you need to Google and download the “NVIDIA Photoshop plug-in”. This will allow you to save your textures in the required format.

Remember, your textures should ideally be square pieces, in the format of 64x64, or 128x128, or 256x256, or 512x512, etc. Considering freelancer’s age, and the player base which plays the game, making a texture the size of say... 4096x4096, is probably going to be overkill for a lot of people’s computers (im not saying its not possible, it definitely is, just suggesting to keep the texture size somewhat within normal sizes). Stick to around 1024x1024 pixels ideally, perhaps 2048x2048 pixels at most.

Freelancer textures are not made specifically for each ship. Instead, they are made as SEAMLESS TILES (This is important if you want to make textures for freelancer in the same way DA etc make em). If you were to open say.. a model from UT 3 like Malcolm, you’d notice the textures are designed specifically for him, and thus cannot really be used for any other model that would be made. Freelancer textures differ on the other hand- they can be re-used multiple times in many different situations, can be recolored etc.

As a quick example, i will show you how to save your .DDS textures using the NVIDIA plugin, and then how to assemble them into a working mat file. Say you made a new texture on a square canvas the size of 512x512 pixels, and you wish to use it for texturing a ship model you made.

http://i84.photobucket.com/albums/k13/gurj...in/matfile1.png

The image above shows a vanilla texture opened in photoshop, untouched, not modified in any way. This is the bw_panel_256.dds texture extracted from the borderworlds mat file.

http://i84.photobucket.com/albums/k13/gurj...in/matfile2.png

The image above shows the texture heavily modified in photoshop to your desire (not in this case, i kept it relatively simple but different to prove a point).

http://i84.photobucket.com/albums/k13/gurj...in/matfile3.png
http://i84.photobucket.com/albums/k13/gurj...in/matfile4.png

As you can see above, these are the steps on how to save an image in the correct DXT1 NO ALPHA settings for .DDS textures, using the NVIDIA plugin for photoshop.

http://i84.photobucket.com/albums/k13/gurj...in/matfile5.png

Above is just an image showing you how the texture looks in an image viewing program (i use xnview cuz its awesome:P) Right. We’ve got one texture, but the model you made requires some more. So using those same steps to save the textures, you can create multiple textures as shown below:

http://i84.photobucket.com/albums/k13/gurj...in/matfile6.png

After you save each and every one in the correct format, you are now free to use them to texture your models. However, don’t delete these files, you need them to make your mat file (if you made custom textures).
This is something i personally do to make 1 mat file for multiple ships using the same textures (another optimization method- use 1 mat file containing all the textures for multiple models).


About mat files and making new textures... - frozen - 05-18-2010

------------------------------------------------------

Preparing to create the MAT file.

Here is a step by step guide explaning how to make a mat file in milkshape:

We know that we have 5 custom textures that need to be put into a mat file already, so with that knowledge, i will create 5 primitives (boxes, spheres, whatever your fancy. The shapes do not really matter) in milkshape:

http://i84.photobucket.com/albums/k13/gurj...in/matfile7.png

As you can see, i have 5 seperate meshes ready for usage. The next step involves making 5 new materials in milkshape. Click on the materials tab,

http://i84.photobucket.com/albums/k13/gurj...in/matfile8.png

You now need to assign the texture to each material. To do this, click on the button that says none that is found right underneath the emissive and specular buttons. This will open a new window. You will need to navigate to the folder where you saved the .dds textures, and once you have it selected, click open

http://i84.photobucket.com/albums/k13/gurj...in/matfile9.png

When you do this, the material ## will have the new texture you made assigned to it, you can visually confirm this by looking at the material sphere which should have your texture open. The next step is to rename the texture to the same name as the texture you opened. To do this, have a look at the image below:

http://i84.photobucket.com/albums/k13/gurj...n/matfile10.png

Once you rename your first texture, repeat these steps again and again until you have all your textures open:
http://i84.photobucket.com/albums/k13/gurj...n/matfile11.png

As you will notice, i have given all the textures completely new, unique names that differ from the names used by vanilla textures. Reason is, if you have the same name for textures, when you put your model ingame, it will end up having a serious case of texture swapping so bad, even wife swappers would be put to shame.

ALWAYS USE UNIQUE NAMES FOR NEW TEXTURES. Since this texture set belongs to the same family (so to speak), i gave them the same prefix of new_...

Now, the next step involves you assigning your materials to each primitive mesh you made. To do this, click on the groups tab, select the first name in the list, and click on the select button.

http://i84.photobucket.com/albums/k13/gurj...n/matfile12.png

Next, click on the materials tab again, click once on the first material in your list, then click on the assign button. If you did it correctly, youll see the texture assigned to the mesh in your perspective view.

This is your first texture assigned. You need to repeat this procedure for ALL the textures, HOWEVER, you need to assign each texture to each different primitive. To deselect the first mesh, go back to the groups tab, with your first group selected, click on select again to deselect it. In your list, click the second name, then click on select, and so on and so forth.

http://i84.photobucket.com/albums/k13/gurj...n/matfile13.png

Once completed, you screen should look something like this:

http://i84.photobucket.com/albums/k13/gurj...n/matfile14.png


About mat files and making new textures... - frozen - 05-18-2010

------------------------------------------------------

EXPORTING THE MAT FILE...

Click on file -> export -> mat exporter.

This will open a new window asking if you want to make a new mat file or update an old one. You want to create a new one, so click that. It will open a new window asking you to save the mat files new name.

http://i84.photobucket.com/albums/k13/gurj...n/matfile15.png

http://i84.photobucket.com/albums/k13/gurj...n/matfile16.png

If you opened the textures and assigned them properly, so that you can see the textures in the perspective view, this is what you will see:

http://i84.photobucket.com/albums/k13/gurj...n/matfile17.png

Just hit continue, and your mat file is now done, congratulations.

However, there will be times when you will be asked by the mat exporter to open the textures (since the file path has not already been opened, it does not know where the textures are, so you need to point it to the correct folder). Ideally it would be best if you put all the textures in the same folder, so that the exporter can automatically find all the textures and make your mat file for you without asking you for the file path for another texture.
The next section will deal with mat files, UTF editor, and different node types and their usage.