ArmA 1 Forum, ArmA 1 Home, ArmA 1 Config, ArmA 1 Tools, ArmA 1 File Formats, ArmA 1 Missions, ArmA 1 3D Modeling, ArmA 1 Terrain, ArmA 1 Texturing, ArmA 1 Scripting
ArmA 1 aka Armed Assault (ArmA)
How to process a weapon model for ArmA standards. Texture merge and optimizing.
This uses the Synide Move UV's method.
In my example I'm using VTE_typ56.p3d assault rifle model. This model has three LODs, them being points/faces: LOD 1.0 1120/1324, LOD 2.0 578/800 and LOD 3.0 177/174. This model doesn't have geometry or view pilot LODs or shadow volumes.
This is what I did.
1) open the model in O2 and examine it. Does it have proper LODs, meaning enough of them and lowest resolution LOD is 100 or less points. This has minimum of LODs, it is not too bad as it ends up in 177 points which is quite nice but still over our set limit of one hundred.
2) there was OFP style muzzle flash, so I deleted it from all the LODs, including the faces and selections. Then I opened BIS M16 and copy pasted its muzzle flash proxy to my model. I then aligned it correctly for the muzzle. Now the model has all it needs for proper muzzle flash.
3) then I made sure all res LODs have LODNoShadow = 1 property added.
4) I examined the textures, it has terrible texturing, for example only a small part of model textured with ca\weapons\data\m249_co.paa texture which is 2048×1024 resolution, absolutely way too big for such small texturing. In total this models 1.0 LOD has 9 textures while 2.0 LOD has strangely 10 and 3.0 LOD has 4 textures.
First thing I did for fun of it to list all the textures from the menu Tools → Mass texture & material renaming, this feature lists all the textures in the model. I could always look the Resource Library → Current Model → Textures, which lists them also, but the first choice lists then nicely with full paths too.
5) I copied all the textures into my nvidia atlas creation tool directory.
6) I opened the textures one by one in texview2 and saved to TGA format.
7) I examined the textures in a ACDSee image viewer. I use acdsee as its so quick and easy to view several images, it lists the resolutions on to bottom status line so its much easier to look than in PhotoShop (in which I don't even know where to check image size quickly). Looks like the 9 textures are in sizes of 5 for 1024×256, 1 for 1024×1024, 1 for 64×64, 1 for 512×256 and 1 for 512×512. So while we could fit them all on the 2048×2048 texture I would rather remove some of them to save space (we also could resize the textures, but I have no experience on that yet but I believe it can be done).
8) then I went back to O2 to examine which texture uses the most smallest part or rather most stupid texturing that we could easily replaced with some other texture, therefore removing one texture from the list.
I managed to remove one texture by this method without any noticeable quality degradation to the model. Visual image was just the same.
9) I then opened the atlas creation tools MergeTextures.cmd bat file and added all those remaining TGA file names there. I actually have a small bat file to list all the TGA files in the dir into a text file from where I can easily paste them into this cmd file. This List_TGAs.bat file looks like this: [code]dir /b *.tga >List_Of_TGA_files.txt[/code] After I just click it I can open the List_Of_TGA_files.txt text file and paste the file names into the MergeTextures.cmd file.
The MergeTexture.cmd file then looked like this: [code]AtlasCreationTool -nomipmap -width 4096 -height 4096 -o type68 1sks1.tga 1sks2.tga ak74_co.tga dl.tga QS_AK2.tga QS_AK3.tga sks1b.tga sks2b.tga type63.tga readdxt type680.dds[/code] The type68 will be the merged texture name, but its actually created as type68000.tga file name. After I run the cmd file it creates this file.
10) open the type68000.tga with PhotoShop. Just examine it that it looks all right and then use Save As… to just resave it. Why save like this? Well the atlascreation tool writes the TGA so that Texview cannot open it, you either have to hex edit the 2020 to 2028 or open/save it through photoshop (or other compatible paint program).
11) Then I deleted the type680.dds and type68000.tga files as well as the source TGAs for the merge. I copied the type68.tai and type68.tga files into the dir where the synMoveUV.exe util resides.
12) I opened the .tai file with text editor, it looked like this:
ak74_co.tga type680.dds, 0, 2D, 0.000000, 0.000000, 0.000000, 0.500000, 0.500000 QS_AK3.tga type680.dds, 0, 2D, 0.500000, 0.000000, 0.000000, 0.250000, 0.250000 1sks1.tga type680.dds, 0, 2D, 0.500000, 0.250000, 0.000000, 0.500000, 0.125000 1sks2.tga type680.dds, 0, 2D, 0.500000, 0.375000, 0.000000, 0.500000, 0.125000 sks1b.tga type680.dds, 0, 2D, 0.000000, 0.500000, 0.000000, 0.500000, 0.125000 sks2b.tga type680.dds, 0, 2D, 0.500000, 0.500000, 0.000000, 0.500000, 0.125000 type63.tga type680.dds, 0, 2D, 0.000000, 0.625000, 0.000000, 0.500000, 0.125000 QS_AK2.tga type680.dds, 0, 2D, 0.750000, 0.000000, 0.000000, 0.250000, 0.125000 dl.tga type680.dds, 0, 2D, 0.750000, 0.125000, 0.000000, 0.031250, 0.031250
I removed the commented atlas stuff, this is the important part for us. Now I edited the TGA's to list our addon paths. It came out like this:
vte_wpn\t\ak74_co.tga type680.dds, 0, 2D, 0.000000, 0.000000, 0.000000, 0.500000, 0.500000 vte_wpn\t\QS_AK3.tga type680.dds, 0, 2D, 0.500000, 0.000000, 0.000000, 0.250000, 0.250000 vte_wpn\t\1sks1.tga type680.dds, 0, 2D, 0.500000, 0.250000, 0.000000, 0.500000, 0.125000 vte_wpn\t\1sks2.tga type680.dds, 0, 2D, 0.500000, 0.375000, 0.000000, 0.500000, 0.125000 vte_wpn\t\sks1b.tga type680.dds, 0, 2D, 0.000000, 0.500000, 0.000000, 0.500000, 0.125000 vte_wpn\t\sks2b.tga type680.dds, 0, 2D, 0.500000, 0.500000, 0.000000, 0.500000, 0.125000 vte_wpn\t\type63.tga type680.dds, 0, 2D, 0.000000, 0.625000, 0.000000, 0.500000, 0.125000 vte_wpn\t\QS_AK2.tga type680.dds, 0, 2D, 0.750000, 0.000000, 0.000000, 0.250000, 0.125000 vte_wpn\t\dl.tga type680.dds, 0, 2D, 0.750000, 0.125000, 0.000000, 0.031250, 0.031250
Then I need to specify which merged TGA file will replace the old texture names. This file name is not important right now as we can easily rename it on O2 with the mass rename feature, but I call it now type68_co.tga already, which will be the final name too. I take the type680.dds string and replace it with my path + file name of the texture I want to use, which is vte_wpn\tex\type68_co.tga and of course add comma between the two textures.
So the fully edited .tai file looks like this now:
vte_wpn\t\ak74_co.tga,vte_wpn\tex\type68_co.tga, 0, 2D, 0.000000, 0.000000, 0.000000, 0.500000, 0.500000 vte_wpn\t\QS_AK3.tga,vte_wpn\tex\type68_co.tga, 0, 2D, 0.500000, 0.000000, 0.000000, 0.250000, 0.250000 vte_wpn\t\1sks1.tga,vte_wpn\tex\type68_co.tga, 0, 2D, 0.500000, 0.250000, 0.000000, 0.500000, 0.125000 vte_wpn\t\1sks2.tga,vte_wpn\tex\type68_co.tga, 0, 2D, 0.500000, 0.375000, 0.000000, 0.500000, 0.125000 vte_wpn\t\sks1b.tga,vte_wpn\tex\type68_co.tga, 0, 2D, 0.000000, 0.500000, 0.000000, 0.500000, 0.125000 vte_wpn\t\sks2b.tga,vte_wpn\tex\type68_co.tga, 0, 2D, 0.500000, 0.500000, 0.000000, 0.500000, 0.125000 vte_wpn\t\type63.tga,vte_wpn\tex\type68_co.tga, 0, 2D, 0.000000, 0.625000, 0.000000, 0.500000, 0.125000 vte_wpn\t\QS_AK2.tga,vte_wpn\tex\type68_co.tga, 0, 2D, 0.750000, 0.000000, 0.000000, 0.250000, 0.125000 vte_wpn\t\dl.tga,vte_wpn\tex\type68_co.tga, 0, 2D, 0.750000, 0.125000, 0.000000, 0.031250, 0.031250
13) Back in O2 I use the mass rename feature to change *.pa? into *.tga file names. The *.pa? means that .paa and .pac file names are changed. I save the model.
14) Now I copy the model into the directory where the synmoveuv.exe and .tai file is located.
15) I open the MoveUV_1.cmd batch file and write there:
synMoveUV type68.tai VTE_type68.p3d
16) now I run the MoveUV_1.cmd batch file. The util creates vte_type68_m.p3d file which is the modified model with merged textures.
If there was any path errors on the .tai file the synmoveuv will crash, no errors no nothing, it will simply crash.
17) I copy the type68.tai and type68.tga files into my VTE_wpn_merge_files/ directory for storage, maybe I need them later who knows, nice to have some backup of this process. Then I delete the type68.tai and VTE_type68.p3d file from this dir.
18) I copy the type68.tga and vte_type68_m.p3d file into armawork VTE_wpn/ directory.
19) I rename the type68.tga into Type68_co.tga which will be the final and official file name for this merged texture. I also overwrite the original (hey I do have backups! hehe) VTE_type68.p3d with this new vte_type68_m.p3d merged model.
20) I move the Type68_co.tga texture into VTE_wpn/tex/ dir which will be the final place to keep the textures.
21) I open the Type68_co.tga in PhotoShop and choose Filter → NVidia Tools → NormalMapFilter. Then I select Scale 5 and press OK to create the normal map. When its done I choose Save As and save it under Type68_nohq.tga file name (yes a TGA).
22) then I open Type68_co.tga with TexView2 and choose Edit → Filter, then choose Load and browse to the LinkerSplitSpecularMap.bitfilt file I created from the Linker Split's normal/specular map tutorial. Now TexView2 processes that 2048×2048 file a loong time in my computer. After its done processing it, I'll save the file to Type68_smdi.paa file name which is .paa format yes.
23) I load Type68_co.tga with Texview2 again and save it to Type68_co.paa format.
24) I open Type68_nohq.tga with Texview2 and save it to Type68_nohq.paa format, now I can delete the Type68_nohq.tga file as its not used anymore, but I'll still keep the Type68_co.tga just in case.
25) Now I create text file but I name it Type68.rvmat which will be the RVMAT config file. This config file looks like this:
ambient[] = {1, 1, 1, 1}; diffuse[] = {1, 1, 1, 1}; forcedDiffuse[] = {0, 0, 0, 0}; emmisive[] = {0, 0, 0, 1}; specular[] = {0.746, 0.746, 0.746, 1}; specularPower = 50; PixelShaderID = "NormalMapSpecularDIMap"; VertexShaderID = "NormalMap"; class Stage1 { texture = "vte_wpn\tex\type68_nohq.paa"; uvSource = "tex"; class uvTransform { aside[] = {1, 0, 0}; up[] = {0, 1, 0}; dir[] = {0, 0, 0}; pos[] = {0, 0, 0}; }; }; class Stage2 { texture = "vte_wpn\tex\type68_smdi.paa"; uvSource = "tex"; class uvTransform { aside[] = {1, 0, 0}; up[] = {0, 1, 0}; dir[] = {0, 0, 0}; pos[] = {0, 0, 0}; }; };
The important lines here are the class stage1 and stage2 texture lines, these tell which normal/specular maps we are going to load with this _co main texture. Yeah of course the number values are important too, but I have not fiddled with them much, this is just copy paste from BIS M16 rvmat.
26) Now in O2 I open the VTE_type68.p3d file has the merged textures. Looks fine. But I still don't feel happy about the 3 LODs going from 1120 points to 177 points. So I copy the VTE_type68.p3d into my Models_Modo/ directory. I also take the Type68_co.tga texture and copy it to my Modo texture directory (it happens to be Models_modo/textures).
27) I start p3dm2lxo tool from Synide and load up VTE_type68.p3d model. It lists all the LODs from the model, I choose 1.0 and press the blue “play” button. p3dm2lxo util gives no display of success or failure, but in the dir it created VTE_type68-1.0.lwo lightwave object file (or something like that).
28) Now I start Modo 302 and load (CTRL-O) the VTE_type68-1.0.lwo file. It asks that Default file (texture) not found, do I want to select alternate, I choose No button. Now it loads the model up, if I have the Texture button selected it will be displayed nicely with textures as Modo somehow finds the Type68_co.tga from the texture dir (don't ask me how, I'm no modo expert hehe).
29) Now comes important part, if you start to edit the .lwo file, its very likely you can get Modo to crash, so first thing we do is to choose File → Save As and select Luxology Scene .lxo file format from the drop down and save our model to VTE_type68-1.0.lxo file name. Then we close all (CTRL-SHIFT-W). Now we can delete the VTE_type68-1.0.lwo file as its not necessary anymore.
30) Then I open the VTE_type68-1.0.lxo file and my model is ready in Modo.
31) I choose the Polygon mode (or something) with space bar, then I click the muzzle flash proxy and press H key to hide it. As I rotated the model around I press A key to center it nicely to the screen.
32) Now I click the Polygon editing mode on the vertical bar (sorry I don't know any name for it hehe), its the one that's from up to down; basic, def, duplic, mesh, ver, edge, POLY and uv.
33) then I choose Select → All (CTRL-A) however the CTRL-A wont work unless you keep mouse cursor over the vertical Poly button (strange). Now all the polygons in my model has been selected.
34) Then I click Reduction Tool button. It opens a dialog “Reduct”, it says by default Number 100. Now I LMB click once on the viewport, this causes the numbers to update. In this models case its comes to 1323 polygons. Now I edit the value by adding “/2” after it, meaning 1323/2 which comes to 50% less than the original number which is how much we want to reduce the polygons after each resolution LOD downstep.
35) So now polygon reduction tool has nuked the polygons and I have model with 662 polygons. Now I choose the Statistics window (lower right corner). I click the arrow before vertices, then I click arrow before By polygons. Now it shows plus, minus, zero and then number 52 in this case. That means that there is 52 points/vertices without any connection to polygons, which means we can remove them as they have no use. So I click the plus sign and now all the vertices are selected, then I press DEL key and they are deleted, nice.
As I have the O2 open I'm looking at the original model, its values were 1120 → 578 → 177. Well the 1.0 and 2.0 LOD step is OK and the 3.0 LOD is okay too, but the down step from 2.0 to 3.0 is bit large. Well I have no hard facts how it effects the engine and I haven't got experience to observe this ingame how it visually looks, but my goal is to add one new LOD between two and three while making one more new LOD after the previous 3.0 LOD. So it would be
LOD | Points | Remarks |
---|---|---|
1.0 | 1120 | |
2.0 | 578 | |
3.0 | 578/2 | NEW |
4.0 | 177 | |
5.0 | <100 | NEW |
At least thats how I think it should be done, I'm more than interested of hearing suggestions about this.
So we want to create LOD with about 290 polys or so.
36) now I have to select the polygon mode again with space bar. Then again Select → All to select the model, then click Reduction Tool again. Now it says 562 polygons and I LMB click somewhere on the viewport and it updates usually, but at the moment of writing this tutorial, it doesn't, hmm. Anyways.
37) Now it says 562 so I add the same /2 to it and hit enter, now it reduces them down to 281 polygons.
38) Again I go to statistics window, vertices and by polygons and this time there are 16 vertices without connections, I choose them with the plus sign and delete them with the DEL key.
39) Now I want to save my model as its on proper size for my new LOD. So I choose File → Save As and from the drop down choose LightWave Object .lwo format. As this is going to be new LOD but going to replace old 3.0 I name it VTE_type68-3.0_newlod.lwo name.
40) As the existing lowest res LOD was 177, I want to make my next one about 90 which is enough for our limit for lowest LOD which is 100 or less. I do the same procedure again to reduce the polygons, not forgetting to delete the leftover vertices. Now I save this to file name VTE_type68-5.0.lwo as it will be a new LOD numbered like this. Now I can exit from Modo.
41) I open lxo2p3dm util and choose VTE_type68-3.0_newlod.lwo model. The util wont give out any display of success or failure, but in the dir there is now VTE_type68-3.0_newlod_lwo.p3d file. Then I must close lxo2p3dm util because if I try to convert another model it will crash. So I exit and restart, then convert the VTE_type68-5.0.lwo model.
42) Now in O2 I browse and load the VTE_type68-3.0_newlod_lwo.p3d model, I do select all (CTRL-A) and recalculate normals (F5) for it. Then I copy it to clipboard with CTRL-C, then I browse and open VTE_type68.p3d model again. O2 asks if I want to save the copied model but I say no.
Now I must renumber the LODs as this upcoming new LOD will be 3.0 which we already have. So I renumber 3.0 into 4.0 number by RMB the 3.0 and choosing 4.0 on the field. Then I RMB on the same LOD window and select New, it creates LOD number 5.0 which I now rename to 3.0 number which is selected at the same time. Finally I just paste the model from clipboard (CTRL-V) into this LOD and save the VTE_type68.p3d model.
43) I open the VTE_type68-5.0_lwo.p3d model, do same select all and recalculate normals for it, then copy it to clipboard.
44) Then open VTE_type68.p3d, RMB the LOD window to create new LOD which will automatically be numbered 5.0, I select the LOD and paste the model from clipboard again. Then save the VTE_type68.p3d model.
45) Now I select the mass rename feature, the window shows that we have three textures used in the model, first is something called “default”, which is from Modo as it wanted to have some texture on the muzzle flash proxy, then p:\vte_wpn\tex\type68_co.tga which is again from Modo and then the real vte_wpn\tex\type68_co.tga texture. So we select the “default” and replace it with “” which deletes it completely, then we rename the p:\vte_wpn\tex\type68_co.tga into vte_wpn\tex\type68_co.tga and finally the TGA into paa extension, so we have vte_wpn\tex\type68_co.paa texture used.
46) Now we must go through all the LODs and in the resource library window double click on the type68_co.paa texture to select it, then we hit E to get into Face Properties. Here we add vte_wpn\tex\type68.rvmat to the Material edit field, press apply and OK. We must remember to do this for ALL LODs.
So now our model has merged texture and two new lower resolution LODs. To sum it up the statistics came to:
LOD | Points |
---|---|
1.0 | 1120 |
2.0 | 578 |
3.0 | 231 |
4.0 | 177 |
5.0 | 91 |
The main idea is to have 50% less points in each lower res LOD, so that was my goal here.