User Tools

Site Tools


arma:texturing:merging_textures

Merging Textures

In ArmA we should use 1 texture per 1 model to have best performance. So the old days OFP texturing of 75 textures puzzle of 64×64 res is not proper way anymore, we need to use one texture per model or at least trying to use one. Some BIS models use 2 textures like the UH60 because the interior is on one etc. But great model would be only with one texture. You can use texture size up to 2048×2048 as long as its power of two.

This is the OFP addon porting really. Make sure you read the section fixing tutorial also, which is necessary after you have merged your textures.

Merging textures is done easily by using PAnTool and OFP O2. What you do is create one big merged texture in pantool and then use O2 to change the p3d model. More of this below…

PMC Texture Merging Tutorial

So how to merge those old OFP textures then, or any other texture you wish to use?

Well first of all we use three (or four) utils to merge them, first we use PanTool to combine the textures into one big texture, we use Texview2 to save it into paa/pac format, then we use the export version of O2PE to save our model to old format p3d and finally we use old OFP O2 to merge the textures as new O2PE's merge feature is not working.

Here is the step by step tutorial.

  1. In PanTool select File → New Merged Texture
  2. Adjust your windows desktop resolution to high enough so you can drag the MergeTexture window into 2048×2048 if you so choose to do so. Or slide the merged texture window to far left so you can adjust its size from right edge.
  3. Drag and drop all your wanted small textures from the browser into this MergedTexture window and organize them as you see fit.
  4. Use File → Save As… and select texture name + TGA extension. We call it MyTexture.TGA now.
  5. Open Texview2, load MyTexture.TGA and choose File → Save As… and use MyTexture.pac file name.
  6. Open the MyTexture.PTM file with your favorite text editor. Edit all addon paths and file names to be case-sensitive and 100% correct! Edit the ending models[] part to put your p3d name you're going to merge these textures into.
  7. Use O2PE export version to save your p3d to the old p3d format with File → Export → P3D Old Version… feature (skip this if its already in old p3d format).
  8. Use OFP O2 to load up your exported p3d.
  9. Select all faces (CTRL-A), then use Surfaces → Merge Textures, choose MyModel.PTM file. O2 will display nothing at this point. Now check face properties (E) to see if the paths + texture names changed.
  10. Repeat 9 to all LODs.

Done.

If there was errors after following those ten steps, then most likely your PTM script file was incorrect, some paths must have been upper/lower case letters or addon path name were wrong etc. That PTM script with is very strict about its configuration, take good care preparing it. You can also run the script as many times you like, it only changes the textures it finds matches for, so if there is errors on the script… nothing happens. Check the unchanged textures from face properties and then search the PTM to check where there is problem and fix it.

Hope this helps someone who's looking into merging textures into ArmA compatible/quality requirement standards

Read PMC Tactical forum texture merging tutorial topic.

PanTool Wider Window

Today I continued my VTE objects texture merging which I've been doing for past… for so long that I'm numb already. I discovered something very very cool.

I used PanTool (because Synides method is otherwise great but the damn atlas tool messes textures up too many times) in normal 1024×768 desktop resolution as I wasnt expecting these textures to require me to change my desktop to fit 2048 merged texture size. Then by accident I moved the merged texture image too far out of the pantool screen… what happened?

Well there was small slider appearing into the bottom of the screen, then I moved the image more further… and discovered that hell yeah baby I can resize the merged texture window to 2048 size even without increasing my desktop resolution to fit the merged texture in pantool at one time!

pmc.editing.wiki_images_pantoolscroll-01.jpg

And now some scrolling of the merged texture window… and we can increase its size the same as we would have high resolution in windows desktop!

pmc.editing.wiki_images_pantoolscroll-02.jpg

Very cool :)

Edit: of course that method only works for horizontal adjustment, so you can do what I did in the screenshots 2048×1024 texture, you cant do (or at least I cannot adjust it) for 2048×2048 resolution.

PTM long file names

Another small issue I came about, was that of course those long path + file names will be cut short by OFP O2. So now I usually do this following change;

Lets say your PTM file for the texture goes like this:

         class item00037 {
            x=1984.000000;
            y=256.000000;
            w=64.000000;
            h=128.000000;
            scale=0.000000;
            name="vte_air\data\m1a1_driv_darktrubka.paa";
            angle=0.000000;
         };

Now I take O2PE and mass name all texture paths, so they are removed. You'll do this by adding 'vte_air\data\*' and to replace that with just '*' when the path disappears, do this for all paths you got there. Then simply do to this ptm file edit removing the path all together, it will look like this after editing:

         class item00037 {
            x=1984.000000;
            y=256.000000;
            w=64.000000;
            h=128.000000;
            scale=0.000000;
            name="m1a1_driv_darktrubka.paa";
            angle=0.000000;
         };

Now you don't have to worry about too long path+file names when running the merge textures in OFP O2.

Merged PTM files

Another neat thing I discovered was that if you want to merge two or more textures at once, you dont have to consequently run each and every of the PTM files, you can just create one ptm with all the texture merge info.

Here is how my ptm 1 looks (naturally edited to be shorter/better example):

class inftexmerge {
   class PanTool1 {
      class items {
         class item00000 {
            x=0.000000;
            y=256.000000;
            w=256.000000;
            h=256.000000;
            scale=0.000000;
            name="uh1cgsite.paa";
            angle=0.000000;
         };
      };
      w=2048.000000;
      h=1024.000000;
      alpha=0.000000;
      file="Uh1gs_alpha_ca.paa";
 
      models[]=
      {
         "MyModel.p3d"
      };
      mergedpath="APath";
   };
};

Now, thats familiar PTM for everyone, right. OK.

Then I have my ptm 2 file that looks like this:

    class inftexmerge {
       class PanTool1 {
          class items {
             class item00000 {
                x=0.000000;
                y=0.000000;
                w=512.000000;
                h=256.000000;
                scale=0.000000;
                name="uh1cbsid.pac";
                angle=0.000000;
             };
          };
          w=2048.000000;
          h=1024.000000;
          alpha=0.000000;
          file="Uh1gs_co.paa";
 
          models[]=
          {
             "MyModel.p3d"
          };
          mergedpath="APath";
       };
    };

So how do we merge these two PTM files together, so we dont have to run them separetely in O2 then?

Well you need to look the classnames which are all so familiar from OFP and ArmA configs to us by now, so we'll just add another class PanTool1 there, calling it PanTool2, here is my complete and working merged PTM file for two textures:

    class inftexmerge {
       class PanTool1 {
          class items {
             class item00000 {
                x=0.000000;
                y=256.000000;
                w=256.000000;
                h=256.000000;
                scale=0.000000;
                name="uh1cgsite.paa";
                angle=0.000000;
             };
          };
          w=2048.000000;
          h=1024.000000;
          alpha=0.000000;
          file="Uh1gs_alpha_ca.paa";
 
          models[]=
          {
             "MyModel.p3d"
          };
          mergedpath="APath";
       };
       class PanTool2 {
          class items {
             class item00000 {
                x=0.000000;
                y=0.000000;
                w=512.000000;
                h=256.000000;
                scale=0.000000;
                name="uh1cbsid.pac";
                angle=0.000000;
             };
          };
          w=2048.000000;
          h=1024.000000;
          alpha=0.000000;
          file="Uh1gs_co.paa";
 
          models[]=
          {
             "MyModel.p3d"
          };
          mergedpath="APath";
       };
    };

As you can see I only copy pasted the second textures class PanTool1 right after the first textures class, then naming it differently so there is no conflict, I used name PanTool2.

Of course one could argue that it takes more time to edit this merged PTM file than to just use two (or more) ptm's in O2… but let me tell you, if you have lets say three textures and 7 LODs plus view gunner, pilot and cargo… that is a lot of PTM's to be ran on all of those LODs while you could run just one.

If I didn't explain this clearly or someone has some questions, feel free to ask :)

Manual PTM file creation

PTM file is what the old OFP O2 will read to merge textures in the p3d file automatically.

I've been checking your textures carefully and I think probably just one 2048×2048 file will do for all the tank however, if you decide to do merge them you should do it in steps and not all at the same time since you have two problems, 1 there are away too many texture files and 2 they have many different sizes.

If you decide to merge them I think you should merge them by groups (sizes) first and than in the end join all of them.

Texture Merge tool in O2.

13 separate M4A1 textures into 2 larger textures, 1 is 2048×1024, the other is 2048×2048. They sound large, but from what I've read and heard, it'll better than 13 separate textures.

Basically, you merge all of the textures manually (using Photoshop or whatever), making sure to retain the ^2 dimensions (in my case, with the textures being quite hi-res to begin with, using 2048 and 1024 pixels as my dimensions). Then you have to write a .PTM file, that O2 uses to remap the existing UV Maps, onto the new larger texture.

class inftexmerge
{
	class object01
	{
		class items
		{
 
			class item00000
			{
				x=0.000000; 
				y=0.000000; 
				w=512.000000; 
				h=256.000000;
				scale=0.000000; 
				name="SJB_M4TEST\tex\fixorb.pac"; 
				angle=0.000000; 
			};
 
			class item00001
			{
				x=0.000000; 
				y=0.000000; 
				w=512.000000; 
				h=256.000000;
				scale=0.000000; 
				name="SJB_M4TEST\tex\fixorb.pac"; 
				angle=0.000000; 
			};
 
			class item00002 
			{
				x=0.000000;
				y=256.000000;
				w=512.000000;
				h=256.000000;
				scale=0.000000;
				name="SJB_M4TEST\tex\ris.pac";
				angle=0.000000;
			};
 
			class item00003 
			{
				x=0.000000;
				y=512.000000;
				w=512.000000;
				h=512.000000;
				scale=0.000000;
				name="SJB_M4TEST\tex\Stuffed.pac";
				angle=0.000000;
			};
 
			class item00004 
			{
				x=512.000000;
				y=0.000000;
				w=256.000000;
				h=512.000000;
				scale=0.000000;
				name="SJB_M4TEST\tex\30magPolyM4.pac";
				angle=0.000000;
			};
 
			models[]=
			{
				"SJB_M4A1_proxy.p3d" 
			};
			mergedpath="C:\O2_Viewer\SJB_M4TEST\tex"; 
		};
	};
};

And

class inftexmerge
{
	class object01
	{
		class items
		{
 
			class item00000
			{
				x=0.000000; 
				y=0.000000; 
				w=1024.000000; 
				h=512.000000;
				scale=0.000000; 
				name="SJB_M4TEST\tex\foregrip.pac"; 
				angle=0.000000; 
			};
 
			class item00001
			{
				x=1024.000000; 
				y=0.000000; 
				w=512.000000; 
				h=512.000000;
				scale=0.000000; 
				name="SJB_M4TEST\tex\stuffed2A.pac"; 
				angle=0.000000; 
			};
 
			class item00002 
			{
				x=1536.000000;
				y=0.000000;
				w=512.000000;
				h=512.000000;
				scale=0.000000;
				name="SJB_M4TEST\tex\stuffed2B.pac";
				angle=0.000000;
			};
 
			models[]=
			{
				"SJB_M4A1_proxy.p3d" 
			};
			mergedpath="C:\O2_Viewer\SJB_M4TEST\tex"; 
		};
	};
};

Those are my two example .PTM files I used.

X = The top left point of the texture (where it starts)
Y = The height of the two left point defined in X
W = How wide the texture is (in pixels)
H = How high it is (again, in pixels)

The above .PTM file stuff is case sensitive.

The normal maps, as well as the cfgMaterials working. edit the values in cfgMaterials to make the “shine” less intense in most circumstances.

UV Editor

Panda[PL] said: Guys you can merge 2 or 4 textures into one in the UV editor now! Open it up, use “filter by main texture” to select first texture, then scale it by half. While scaling you can pick which point will be preserved - pick upper left corner. Select next texture, pick upper right corner. Then you can add 2 more using lower corners and save. Merge the 4 textures in any program (including paint) and make a .paa. Just filter the faces to find the ones using old 4 textures one by one and make them use new texture.

PanTool

Scars09 said: merging textures is a method to get many small textures to one big. you texture in o2 with the small ones. when you done, you open up PanTool “file\new merged texture”. you will get a new, empty 2048×2048 texture. you the can drag and drop all your small textures in the new big one and place them to fit in as many as possible. then you save the merged texture. this will not only generate the texture but also a script file. this file contains the textures use and where they are placed in the merged one. then you open up o2 again and execute the script with “surface\merge textures”. this has to be done for any textured lod´s of the model.

That was the script generated by pantool (don't look on the sizes, script was used with textures twice as big as shown in the picture) merged single textures don't perform as good as merged unwrapped textures, but better the all the single textures as a single files. the script usually needs some tweaking, you have to add the correct path and the model name, just open it with editor and check if everything is OK. this have to be done manually cause pantool didn't know the model or the path, its just a texture tool.

In my example i posted above the modelname was gunb the mainfolder sc9_egunb on the drive h:\ texturepath in my case was “sc9_egunb\texturename.paa” modelpath in my case “sc9_egunb\gunb.p3d” mergedpath=“h:\”; the texture often is generated as a tga, use pantool to make a .paa or .pac out of it.

In O2, select all the parts of the model, open up the face properties and check if “allow merging textures” is hooked. Then run the PTM script.

Tips

Skaven said this: You should do texture merging in steps and not all at the same time since you have two problems:
1) there are away too many texture files
2) they have many different sizes.

If you decide to merge them I think you should merge them by groups (sizes) first and than in the end join all of them.

Vehicle Cockpit

When you are looking helicopter or aircraft in O2 and use mass texture rename tool, make note of the textures listed there might be located in the cockpit area.

If you split textures for alphas, hull and cockpit… then you still might have problem with the actual cockpit textures for Pilot View LOD.

Be careful with cockpit textures in O2 mass texture rename listings…

It is easy to just merge everything you see in models texture list from mass texture rename tool, but it is not that easy if you want to do a good job. You must organize the textures to alpha channel transparent ones (_CA textures), main vehicle (_CO textures) and finally the cockpit/interior only textures (usually _CO textures). Most cases cockpit for Pilot-View LOD is different than what you can see from outside of the aircraft ie 1.0 and other resolution LODs.

Quick summary

  1. Use mass texture tool to track down each and every texture used, write them down on a list.
  2. Sort the list for alpha channel textures, hull/airframe (exterior) and cockpit (interior) textures. Do this by going into gunner/pilot view and looking resource window sections. I'm actually not sure if this is the right method, cant remember so clearly from BIS models, but it “feels” right to me, alphas need to be separated or they look ugly, exterior is obviously own texture and then interior textures arent shown to outside world, so they arent visible in last LOD so they can be on their own texture.
  3. Merge textures according to the planned list in PanTool.
  4. Clean out the PTM file.
  5. Export model from O2PE.
  6. Load model with OFP O2.
  7. Run Merge Textures → PTM file to all LODs available.
  8. Load merged model with O2PE.

Done.

arma/texturing/merging_textures.txt · Last modified: 2017-10-06 20:26 by snakeman