====== Port ArmA 2 Weapon Using Blender ======
[[https://www.pmctactical.org/forum/viewforum.php?f=68|ArmA 3 Forum]], [[:arma3|ArmA 3]], [[arma3:config|ArmA 3 Config]], [[arma3:missions|ArmA 3 Missions]], [[arma3:modeling|ArmA 3 3D Modeling]], [[arma3:scripting|ArmA 3 Scripting]], [[arma3:terrain|ArmA 3 Terrain]], [[arma3:texturing|ArmA 3 Texturing]], [[arma3:tools|ArmA 3 Tools]]
Step-by-Step: How to convert an ArmA 2 weapon to ArmA 3 Using Blender.
Project Setup:
CUP\
CUP_Weapons\
CUP_AK
CUP_AmmoBoxes
CUP_East_Attachemnts
CUP_AK, CUP_AmmoBoxes and CUP_East_Attachments are all separate addons even though everything is packed into a CUP_Weapons.pbo.
CUP_AK looks like this:
CUP_AK\
data\
anim\
AK.rtm
AK_GL.rtm
(model.cfg)
sfx\
*.*
UI\
gear_*.paa
*.paa
*.rvmat
*.p3d
(cfgAmmo.hpp)
(cfgMagazines.hpp)
config.cpp
(model.cfg)
I opted to go for my own structure instead of sticking with the old organization simply for the fact that I didn't want to have Weapons, Weapons_E, Weapons_BAF etc. Therefore, the hierarchy is different, and self-contained (minus inter dependencies with the other addons in CUP).
**1. Import the model.**
I am using Blender and the FHQ Arma Toolbox, so my description here is pretty much tailored for the Blender workflow. You will have to adapt (after surviving and before winning) to your specific software. If that software is O2, consider getting Blender ;)
**2. Go through all lods and remove the muzzle flash proxy.**
I have a .blend file where I have prefabricated proxies for a weapon family (currently working on the AK's). I usually remove all proxies (most of the time, just the "zasleh") and add them again later
**3. Center the weapons.**
In Blender, I activate all layers, select all objects, and them move them on the Y axis until they are centered. BIS' Arma 2 models are not centered, which will give issues especially with West weapons and and their attachments. Make sure that the weapons are centered correctly. I do this in wireframe mode since most iron sights have a center line, or at least something that can be used to adjust the center.
Remember that you have to apply the transforms after you done this (press CTRL-A and select "Location").
**4. Go through the materials**
I usually go through all my Blender materials and rename them to something sensible other than "Arma Material 1". Depending on the number of materials, I either directly change the paths of my textures and RVMats in the material panel, or use the Tools Panel's rename/reparent functions.
If needed, I copy over the textures into my project. RVMat's need personal encouragement (i.e. editing) to make sure the paths are right. Whenever possible, I use Arma 3 files. For example,
texture="ca\Data\env_land_co.tga";
in stage 7 can be replaced with
texture="a3\data_f\env_land_co.paa";
(you can leave it as tga as well, the engine will find the right file)
**5. Proxies**
At this point, I load in my proxy template and move the proxies into fitting positions. I then go through all the layers, starting at 1. I make a duplicate of the proxy template I just modified and move it to the next layer, then I select the one I still have in this layer, shift-select the weapon, and press CTRL-J to merge the proxy into the weapon. Repeat that for all LOD's, except for shadows where I delete the proxies for the muzzle flash, and the geometry and memory LOD's which don't get proxies. When you delete the muzzle flash proxy, make sure to also delete the empty vertex groups.
**6. Icons**
I usually convert the base CO texture to tga or PNG and apply it to the base model to for rendering. Select all faces by material, and in the UV Image editor apply all the right textures to the model.
Next, switch the viewport to Front Ortho view, and go to the Render tab. Set the width and height to 512 by 256 at 100% size. Go to the Shading panel further down, and switch "Alpha" from "Sky" to "Transparent". Position your viewport view so that the weapon is visible and allow a bit of space for the attachment, especially a silencer. Make a render by clicking the OpenGL render button (alternatively, you can use Cycles or Blender Internal to render the image, but OpenGL will do just fine). Save as a png for later.
**7. Export**
At this point, the weapon should be ready for export. Save the blend file and export the weapon, in this case to CUP_AK
**8. Verify in Bulldozer**
Make sure you added your model to model.cfg, then check its textures and function in the bulldozer.
**9. Generate the icons**
The general format for the icons is gear__X_ca.paa, where is an arbitrary character string for the weapon (like, ak74s) and X is either literally X (used when no attachments are present), or a combination of m, t, and s. Check the Biki for the exact names. This is currently manual work, I plan on doing something that will replace step 6 to make this automatic.
**10. Config.**
Copy the config from the original config.cpp, and modify it for your weapon. This is a lenthy process that I am not going to go into here, it's just too much. Check out the samples that come with the Arma 3 tool chain, or ask kju ;)
Source [[http://dev.withsix.com/projects/cup/wiki/Using_Blender_For_Weapon_Import|dev heaven]].