[Tutorial] Titanfall 2 to Source (WARNING: LONG OP + LOTS OF IMAGES)
28 replies, posted
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
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.
https://files.facepunch.com/forum/upload/109991/16e87745-0bae-40af-837f-c382056d22d2/image.png
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.
https://files.facepunch.com/forum/upload/109991/8fe6bb27-889c-424f-9815-95318a72bad9/image.png
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.
https://files.facepunch.com/forum/upload/109991/095253a3-1d9c-44b7-a1d3-0fc4f28626dd/image.png
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.
https://files.facepunch.com/forum/upload/109991/fca18166-5147-49bc-bc0b-1f27affd3279/image.png
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.
https://files.facepunch.com/forum/upload/109991/91b92597-199e-4801-b7db-15fa98249745/image.png
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.
https://files.facepunch.com/forum/upload/109991/c00bd1aa-636a-4dd5-96e2-a2346202bdff/image.png
STEP 3.) Enable "Auto-detect launched applications".
https://files.facepunch.com/forum/upload/109991/f13ef0dc-f134-4219-8c88-1d3f7d5d8f1c/image.png
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:
https://files.facepunch.com/forum/upload/109991/cb2f6534-7d1b-4714-847f-92f4609cc07c/image.png
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.
https://files.facepunch.com/forum/upload/109991/6444d6cc-eff0-4675-ae2a-79ddcf203644/image.png
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.
https://files.facepunch.com/forum/upload/109991/1d201ee8-d091-4afe-b986-a839c829f0b0/image.png
STEP 10.) Open the Graphics Frame that has your model in it.
https://files.facepunch.com/forum/upload/109991/b887d25d-ff8c-480a-8f96-a2acc584ade5/image.png
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.
https://files.facepunch.com/forum/upload/109991/2c3d419a-e995-4ef2-82d8-6f3becfd94a2/image.png
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.
https://files.facepunch.com/forum/upload/109991/eec35293-38c5-42e1-8d5b-060253439c08/image.png
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. Actually it might be, I wrote this section at like 6:00 AM. Sorry.
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."
https://files.facepunch.com/forum/upload/109991/32efdbd4-e4ab-4fc8-964d-6aed887d4f59/image.png
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.
https://files.facepunch.com/forum/upload/109991/b61ee40b-c9dc-4dbc-a3c0-40c99606fe74/image.png
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.
https://files.facepunch.com/forum/upload/109991/82ed0a0d-c19a-4e15-b316-f584d331ad1c/image.png
Nice work (didn't realise Crowbar was open source so that's pretty cool too).
I guess the Titanfall .vtf files are a different format to Valve's then?
Didn't EA disallow the usage of Titanfall 2 models a while back since some Chinese douchebags started stealing and making profit off of em?
They're locked away in proprietary archives that no one knows anything about. They're still .vtfs, more than likely, since there's still a handful of vtfs stored in the vpks.
Which archives?
.rpaks, supposedly. They sure as shit aren't in the .vpks.
The version of Intel GPA I downloaded has got a different design so I have no idea where the textures panel is located.
Is there any way to change set it to use the design you're using?
https://files.facepunch.com/forum/upload/156671/31c4fb20-671b-4898-98f7-59a14d97ec63/Unbenannt.png
As far as I know you can get the vtf/vmt from the VPK files and you're ready to use them.
They are usually saved under materials/models/[ModelName]
To be sure, this isn't the case for Titanfall 2 VPKs. Trust me, I've checked.
I'm having some problems with the nomal maps. (I'm importing it into Unity, not Source)
The maps cause the entire titan to be completely reflective, no matter what i use as metallic texture.
I tried inverting the blue channel and applying the roughness mask as alpha but I think I did something wrong when trying to invert the color channel.
Glad someones getting somewhere with my tools.
Wouldn't have gotten far at all without them.
Thanks for making this. I might mess around with the models one of these days.
When applying the roughness as alpha after inverting the blue channel my normal map looks like this:
https://files.facepunch.com/forum/upload/156671/c263f185-e7a0-4682-9276-62883c9748e3/normal5.png
And I can't seem to get it to work in Blender or Unity.
This is for porting to Source. You don't put the roughness in the alpha of the normal map with other engines.
Re-read the title.
Ok, sorry. :/
If you have the install file you used for the GPA version you are using in this post, please send it to me as Intel has removed legacy downloads for the program. I have gotten this to work only once, briefly. I was trying it on DX 12 and its froze a really long time on startup so I ended process, but for a few frames, the HUD displayed, alas I had already tasked the game program to close.
https://files.facepunch.com/forum/upload/240457/53d257d6-d948-4338-a55c-bcf99377ede8/image.png
Updated the OP with the installer I used.
What I meant was the actual file you used to install GPA onto your system. They changed the program 3 days ago and now the version I can get is not the same as what you have. Also, they took away the ability to download the older versions.
https://files.facepunch.com/forum/upload/240457/084c93c0-2918-4515-a135-9b6f0a61d7e1/image.png
wait what in the fuck, I changed the link to a google drive upload, standby
Are all the .vtf files in the .vpk files good to go? I don't remember if the version is different but I thought I saw in the other thread (but can't find it now) that some of them use a new encoding formats.
I never tested importing them into SFM...
VTF Edit loads them correctly and they work just fine in Unity and Blender so they probably work in SFM too.
https://files.facepunch.com/forum/upload/156671/e709d23c-5a9e-4c56-86a1-df0c6c1a7c34/1.png
Thanks for this, I was losing my mind trying to get textures for some models.
Yeah, SFM can read the .vtfs from the first game just fine. Still, you'd probably want to save them with different compression flags since you'll be opening them up to separate the channels and everything anyways.
Intel GMA keeps complaining it can't find 'xperf.exe', meaning I cannot capture frame data whatsoever when hooked into Titanfall.
Thank You, tutorial is great
While I get this is old, but I was wondering if you could still share the photos/tutorial/intel gpa considering I have no idea what to do now after being pointed here.
Sorry, you need to Log In to post a reply to this thread.