This guide will cover porting Titanfall 2 models to SFM and Source on the whole.
A lot of effort went into creating this guide, but that doesn't mean it's perfect. Still, it couldn't be as good as it is without the help of:
- BlueFlytrap for figuring out most of the workarounds that I used to get around Source's limitations.
- Zeqmacaw for creating Crowbar.
- REDxEYE for helping Zeq figure out Titanfall 2's v53 .mdl format.
- Kuro for figuring out a method for making colored specular/specularity masks work in Source.
- Soul_ for antagonizing the people that I also antagonize.
- And a bunch of the other helpful (and helpfully bitter) folks in the OSFM Discord.
This guide does not cover porting to Garry's Mod per se, although it's pretty par the course for any Source game. You can post renders and workshop links to what you've done here, if you want.
Requirements:
- 3DSMax, preferably 2014 or above. I don't use Blender, so you're on your own there.
- Game Zombie's .smd plugin
- Batch Import/Export script by Jos Balcaen
- Titanfall 2 - Try and guess why. Also, you flat out can't get textures if you're using the trial version.
- A very rough, working knowledge of the source engine. Search Google for a guide, I won't go very in-depth here.
- GIMP 2.8 for converting raw bitmaps to .vtfs. (Adobe Photoshop is fine too. If all else fails, just use GIMP - it's free.)
- .vtf plugin for GIMP.
- Crowbar - For decompiling v53 .mdls and recompiling later.
- Cra0kalo's Titanfall .vpk Tool
- Intel GPA 17.2 (IMPORTANT THAT YOU USE THIS VERSION, newer versions have a vastly different UI and sometimes export textures with weird gamma issues.)
Table of contents:
Section 0 - Copyright disclaimer shit.
Section 1 - Acquiring rigged models.
Section 2 - Acquiring textures.
Section 3 - Preparing meshes.
Section 4 - Preparing textures.
Section 5 - Materials Method 1: Colored Specular
*easier, generally recommended, but less accurate
Section 6 - Materials Method 2: CustomHero [Coming soon]
[SECTION 0]
Copyright Disclaimer
I DO NOT own IP rights to Titanfall 2. Titanfall, Titanfall 2, and all assets are property of Respawn Entertainment and EA. All assets in this tutorial are used without permission. If contacted and requested to do so, I will promptly remove this guide in it's entirety.
I ask that all other readers observe and acknowledge the following, or stop reading the thread at once.
[SECTION 1]
Acquiring rigged models
STEP 1.) Open Cra0's .vpk tool.
Ignore the popup if it tells you there's an update available - 3.3 is the most up to date version at the time of this writing.
STEP 2.) Navigate to and open the .vpk of your choice. Choose a model, and extract wherever you'd like.
You'll find .vpks in "<disk>\Program Files (x86)\Origin Games\Titanfall2\vpk". You might as well extract the entire models folder, if you plan on porting more than one model. Do note that the majority of model textures are NOT stored in .vpks.
Important note: Most multiplayer content is stored in englishclient_mp_common.bsp.pak000_dir.vpk.
STEP 3.) Open Crowbar, and decompile your model into its component .smds.
Unlike other Source games, Titanfall 2 .mdl files contain all necessary mesh and model information.
For the sake of this tutorial, we'll be porting the model "robot_stalker.mdl". A finished port of the Stalker will be available for download at the bottom of this thread. Also check my workshop for other ports to base your work off of, if you so desire.
Most models consist of a handful of meshes.
Important note: Despite seemingly decompiling them, Crowbar 0.56 does not support Titanfall 2 animations, which are stored in .mdl files suffixed: _core, _workspace, _embark, etc.This DOES include ref animations, which can be very troublesome. More on that in Section 3.
These are the files you should be left with. You can ignore/delete the LOD .smds and .qc files if you have no use for them. Neither will be relevant to this tutorial.
You now have your meshes! Congrats. Now you need materials. Just a warning, this part fucking sucks.
[SECTION 2]
Acquiring Textures
STEP 1.) Open Intel GPA Graphics Monitor.
Setting up Intel GPA tp extract shit from Titanfall 2 is finicky and inconsistent, but once you get it working once it should work fine every time afterwards. Keep this window open during the next steps.
STEP 2.) Open Origin, if it's not already open, and set it to Offline Mode.
This is the most important step. GPA can't hook into Titanfall 2 without Origin being in offline mode.
STEP 3.) In your system tray, right click on the blue Intel GPA icon and select Preferences from the dropdown.
STEP 3.) Enable "Auto-detect launched applications".
Important note: You may have to disable safe boot in your BIOS settings in order for this setting to work. Also, it is not recommended to open any other programs while Auto-detect is enabled. Disable it ASAP once you've gotten the textures you want.
STEP 4.) Close the preferences window, and add Titanfall2.exe to the list of programs in the "Analyze Application" window if it does not show up by default.
STEP 5.) Run Titanfall 2 from the "Analyze Application" window.
You should see this box in the corner of your screen if GPA has hooked-in correctly:
STEP 6.) You may now re-enable Online Mode in Origin.
The steps prior to this need not be repeated on the next occasion that you're searching for models, other than Step 3. Always remember to re-disable Auto-detect when you are done.
STEP 7.) Go ingame and find the model that you are looking for... Yes, physically.
Your model must appear on screen in order to rip its textures. Stalkers appear in almost all campaign missions, but particularly in the mission "Blood and Rust." Once you've found your model, press CTRL+SHIFT+C to capture the frame.
Tip: You can find weapon, titan, and playermodel textures in the multiplayer customization menu.
STEP 8.) You can now exit Titanfall 2 and turn off Auto-detect in GPA's preferences.
STEP 9.) Open Intel GPA graphics frame analyzer.
Tip: You can quickly open it by right clicking the Intel GPA icon in your system tray.
STEP 10.) Open the Graphics Frame that has your model in it.
This might take a minute or two, it's a huge file. The window will look like this.
STEP 11.) Once the frame opens, note this box on the middle-left of the window.
Tick "Entire Frame" at the top.
STEP 11.) Direct your attention to this box, which will be on the righthand side of your screen. Click the "Textures" tab, and scroll down until you find what you believe to be your texture/s.
There will be 6 or so textures for each material, and 1 to 3 materials depending on your model. The stalker has three materials with all of the maps listed below.
Important Note: For this tutorial, you will need the following:
- Albedo
- Normal map (yellow)
- Roughness map (red)
- Specularity/metalness map (typically greyscale, like any other spec map; may have muted versions of the basetexture's tones)
- Ambient Occlusion
- Emissive map (Also grayscale, but usually black with glowing highlights like eyes and thrusters masked in white)
STEP 12.) Right click the texture as it shows up in the viewport, and click save.
You have the choice of .dds, .bmp, .png, and .jpg. I recommend .bmp.
You have to do this for each texture.
One by one.
Oh also, they're unnamed.
It sucks. If you wanna try using Ninja Ripper, go for it, but it doesn't detect all of the maps, nor all of the right colors in the albedo.
So fucking finally, you've got your model's textures. Relax, take a break. You've been through a lot, and you're pretty much through with the worst of it. I'm not being facetious either, the rest of this is pretty simple.
[SECTION 3]
Preparing Meshes
In the case of the Stalker model, not much needs to be changed. However, with heavier duty models like Titans and shit, consider the following:
- The .smd format has limits on how many vertices it can contain. To get around this, you may need to divide the mesh/es into smaller chunks. This is the case with the Titans, whose cockpits I just compiled as separate bonemerge-able .mdls.
- Some bones are going to be in the wrong resting position/bindpose. The only way to fix this, that I know of, is to compile it as is and change the bone positions in SFM to a more natural/correct position, save that animation as a .dmx, and recompiling with that .dmx set as your reference sequence. There's not a more-graceful workaround, at least that I know of.
Anyways, on with this part of the tutorial. You will be creating duplicate meshes for use with Source's colored specular workaround. Don't worry, it's not as confusing as it sounds.
STEP 1.) Import your model into 3DSMax.
In the case of the Stalker, it is comprised of multiple .smds. To import each .smd at once, you can use the batch import script linked at the very top of the page. Note that you also need the .smd import script for this to work at all.
Note: Your model may import flipped 90 degrees on the y axis. You can fix this in 3DS if you really want to, but I recommend just putting "$upaxis y" in your .qc later.
STEP 2.) Perform any necessary edits, apply materials, etc.
I moved a handful of bones to what looks like the correct position by looking at references. I can't provide an exact tutorial for something like this - you just kind of need to "wing it."
Materials, however, are easier to explain. Create and apply materials in 3DSMax as normal, but clone them all, adding the suffix _cs to the clones, and the suffix _col to the originals. It doesn't have to be exactly that, but you do need to know which is assigned to your colored specular mesh, and which is applied to your albedo mesh. So keep that in mind.
STEP 3.) Duplicate your meshes as clones. Rename them based on if you're using the CustomHero or Colored Specular method.
Note: You're using the colored specular method because I haven't updated this guide with CustomHero instructions yet.
Also, I'd recommend naming your meshes something simple, like adding the suffix _cs to the colored specular meshes, and _col to the meshes that will have your albedo texture applied. Ensure the correct materials are applied to the correct meshes, and you should be good to go.
STEP 4.) Re-export, and you're done with the mesh preparation.
[SECTION 4]
Preparing Textures
STEP 1.) Import your albedo, AO mask, and emissive mask into a single GIMP image.
Tip: If you want, you can store ALL of your textures in one .xcf via descriptive layer groups, rather than separate images.
STEP 2.) Move your AO mask layer above your albedo layer, and set the blend mode of the AO map to "Multiply."
Like so.
STEP 3.) Move your emissive mask layer above your AO mask layer, and set the blend mode of the emissive mask layer to "Addition." Merge all layers, and export as .vtf.
Like so.
Important note: It's up to you to decide what compression flags you use - if you care enough about them, you'll know which ones do what.
STEP 4.) Import your normal map, invert its blue channel, and apply the roughness mask (the red one) as an alpha channel. Export as .vtf, making sure to check the "Bump" option in the export settings.
STEP 5.) Import your specularity mask, and export it as .vtf.
Your materials are now set up. Obviously, they need to go wherever your .smds are expecting them to be.
[SECTION 5]
Materials Method 1: Colored Specular
While not all of the specular maps are colored, per se, model stacking is still necessary. There aren't going to be steps for this one, just examples of .qc's and .vmts for you to roughly follow. The .qc is self explanatory, whereas .vmts are something that matter on a case by case basis; you'll just need to play around with the params.
QC Sample
(robot_stalker.qc)
$upaxis y
$scale 1
$modelname "robots/stalker/robot_stalker.mdl"
$mostlyopaque
//$mostlyopaque in particular is important for the workaround to actually work.
$bodygroup "red_box"
{
studio "red_box.smd"
blank
}
$model stalker_body_col "stalker_body_col.smd"
$model stalker_legs_col "stalker_legs_col.smd"
$model stalker_arms_col "stalker_arms_col.smd"
$model stalker_body_cs "stalker_body_cs.smd"
$model stalker_legs_cs "stalker_legs_cs.smd"
$model stalker_arms_cs "stalker_arms_cs.smd"
//Note that the colored specular meshes are referenced AFTER the albedo-textured meshes. If you're familiar with colored specular, you'll know why this is. If you're not, you'll figure it out when you get to the .vmt section.
$texturegroup "skinfamilies"
{
{ "rbt_stalker_upperbody_col" "rbt_stalker_lowerbody_col" "rbt_stalker_head_col" }
{ "rbt_stalker_upperbody_red_col" "rbt_stalker_lowerbody_red_col" "rbt_stalker_head_red_col" }
{ "rbt_stalker_upperbody_suicide_col" "rbt_stalker_lowerbody_suicide_col" "rbt_stalker_head_suicide_col" }
{ "rbt_stalker_upperbody_suicide_red_col" "rbt_stalker_lowerbody_suicide_red_col" "rbt_stalker_head_suicide_red_col" }
}
$cdmaterials "models/robots/stalker"
$sequence idle "stalker_ref_new.dmx" activity ACT_IDLE -1 loop fps 30
Yep, that's it. You'll probably want to add $attachments and more bodygroup options, of course, especially for the stalker in particular. But for instructional purposes, this .qc structure is fine. If you peeked inside the .qc generated by Crowbar, you'll notice a _bunch_ of different unnecessary commands.
VMT Sample - Colored Specular
(rbt_stalker_head.vmt)
"VertexLitGeneric"
{
"$basetexture" "models\robots\stalker\rbt_stalker_head_s" //note that this is the specularity texture, NOT the albedo
"$bumpmap" "models\robots\stalker\rbt_stalker_head_n"
"$color2" "[0.00 0.00 0.00]"
"$additive" "1.00" //These two commands are what make this workaround work at all. If you've ever used additive for decals or something, it's just a derivative of $translucent, but it applies an albedotinted "additive" blend effect to anything behind it. Setting the $color2 to total black masks out everything except for the specular reflections.
"$phong" "1.00"
"$phongboost" "4.5334" //this is up to your discretion - just depends on how intense you want the specular reflection to be. That's just a random decimal at the end, I didn't do any math or anything to come to that number in particular.
"$phongexponent" "5.00" //generally doesn't need to exceed about 15 or 20, that I've seen.
"$phongexponenttexture" "models/titans/buddy/phongexp_255" //literally just a 32x32 texture with only a pure green channel. For fully-masking albedotint.
"$phongfresnelranges" "[3.00 5.00 7.00]" //these are kind of old ranges, but they should work for what you're using them for.
"$phongalbedotint" "1.00" //ALWAYS have this enabled for colored specular.
}
So yeah that's that xd
Even though I never showed you the model or materials beforehand, this is the final result that I wound up with. I might clean this up when I'm less tired. For now, You've got the most documentation anyone's ever done on Titanfall 2 shit. Post any questions down below as long as it isn't asking me where to download a tool that I linked above or why you're having trouble getting models out of your pirated version of the game.