Killing Floor 2

Killing Floor 2

62 ratings
KF2SDK: Custom Textures / Materials
By 76561198027781948
From what I remember, TWI claimed that the SDK doesn't support custom textures. There's always a way around that though, and you're about to find out how.
   
Award
Favorite
Favorited
Unfavorite
Initial Setup
I'm not going to walk you through the mapping process in this tutorial, that's something you can do on your own.

In the meantime, however, I'm going to make the assumption that you know how to make simple map geometry. I'm using CSG for this tutorial (built-in Add / Subtract) but the same thing applies to modular maps.

To start off, I've made a simple 512x512x512 hollow cube:



Hollow means it's, well... hollow. Which means I can apply textures on the inside. At this point, you can have anything from a simple room to an entire map created. This isn't a mapping tutorial, but one about applying custom textures to your map. So let's get started!
Texture Prepping
A map isn't a map without textures! Well, not a good one anyway.

At this point, you can either have a textureless map or one with stock KF2 textures applied. Either way, that part doesn't matter. What you should be worrying about now is what textures you're actually going to use for the map. Since I've got some handy, I'm going to use textures from a map I previously made / ported:



These textures are taken directly from Doom and stylized a little with normal maps and specular in some cases. With the method I'm using, the parameters are simple enough that I get a lot of flexibility.

I use Adobe Photoshop CS6 to edit my textures, but you can really use anything. The important part is that you wind up getting your texture(s) in .tga format. Here, you can see one of my textures in Photoshop:



Of course, I exported this and my other textures as .tga files. Do this same thing with your normal / specular maps, all as separate files. Don't try and put anything in the alpha channel unless you texture is transparent. We'll get to that later.

SDK time!
Importing To SDK
Now that you've got your textures created, it's time to actually get them in-game.

To use them in the SDK, you're going to need a map to put them in. I'm using a simple cube in my example, but you can have a full-on map if you'd desire. First thing's first, save your map to a file. I'd advise saving it in the Unpublished folder, which is in:

C:\Users\YOU\Documents\My Games\KillingFloor2\KFGame\Unpublished\BrewedPC\Maps

For the purpose of this example, I'm going to call my map KF-TextureTesting.

Next, open the Content Browser. (View -> Browser Windows -> Content Browser if it's not already) After saving your map, you'll notice that you have a new package in the package list. It should correspond to the name of your map, like so:



Opening it up, if it's a plain map like mine, should tell you that there are no files to show. If you want to make sure you've got the right package, pop a light in and build the lighting. It should now contain some shadowmap textures. You don't have to import the textures into the map package itself, but it's easier and works a lot better.

First thing's first, import your textures into the package. Right-click the blank space to the right of the package list (assuming you don't know this) and hit Import. Then, browse for your textures. I have two, one diffuse and one normal.



WHEN IMPORTING NORMAL MAPS:
Make sure your compression settings are set to TC_NormalMap and that your LODGroup is set to TEXTUREGROUP_WorldNormalMap. This ensures proper functionality of normal maps.



Now I've got two textures in my map package, a diffuse and a normal for the texture I want:



These won't work though! We need to prep them even more.
MIC Creation
Textures are textures, but materials are materials!

You can't use raw textures in your maps like this, we've got to do a little bit of preparation first. Ordinarily, you'd just make your own Material and optionally make a MaterialInstanceConstant from that. TWI probably assumes that this is the way you're going to try and do it, and I have. It doesn't work. So we're going to try a little something different.

There are two things we need to be concerned with here: Materials and MaterialInstanceConstants. Materials rely off of raw textures, and MICs rely off of Materials. If you make a custom texture with your own Material, the game won't recognize it and your textures will show up as the default checkerboard. However, since MICs rely on Materials, we can do some trickery. Right-click where your textures are and select New MaterialInstanceConstant.



A window should show up, but it's pretty self-explanatory. Give your new MIC a name you can recognize. I like to identify mine by putting _MIC at the end.



Double-click the new MIC you just made and it should open up a menu that looks something like this:



This is where you'll notice the important part of our MIC, the Parent parameter:



You can browse through the KF2 Environment files and find a Material (Material, be sure!) to base your MIC off of. Browsing is a pain though, so I'll attach a list of good-to-use parents at the end. I usually use this one as a base, however:

Material'Env_Mat_Lib.Metal.Env_Basic_Metal_PM'

Copy this and pop that into your Parent field, it should bring up a really shiny metal texture in the preview. Right now, we're inheriting all of the texture's properties from Env_Basic_Metal_PM, which is a Material included with the base KF game. This way, the game recognizes the material and it doesn't have to load it from another package. We can, however, swap some things out. Right now, you should be seeing something like this:



Notice the Parent parameter has been changed. From here, we're going to actually start swapping out the metal material's textures with our raw textures that we imported. Extend Parameter Groups -> Texture Parameter Values and you should have a list of texture parameters.



What you're seeing is a list of parameters in the stock KF2 material that can be changed by the MIC. A MIC takes a material and changes editable parameters, which is why one comes in handy here. Also notice that the checkboxes are unticked. By ticking a checkbox, you tell the MIC that it should override one of the material's texture parameters with one that you specify. In this case, we intend to do just that.

Leave your MIC window open and head back to the Content Browser where you have all of your imported textures. Since I imported diffuse and normal maps, I'm going to plug them into the MIC.

Click your diffuse texture in the Content Browser and highlight it, causing a yellow square to appear around it. Then head back to your MIC window and hit the green arrow next to Tex2d_Diff.



The MIC's using our raw texture, but it's not showing up in the preview window. What's wrong? Remembering what I said earlier, tick the checkbox beside Tex2d_Diff and look at the preview window:



We're making progress! Do the same with the normal map you imported, if you've got one. Again, if you've got a specular, do the same.



We're making progress! My textures aren't the greatest, I just wanted something to bring it out a tad bit. Bricks aren't supposed to be that shiny though, maybe we can fix that.
Parameter Tweaking
Your material's ready to be imported to the map at this point, your MIC is ready to go. Shininess, though!

Our brick texture's a little too shiny, which would make sense since we based our MIC off of a metal Material. Luckily, TWI's been kind enough to prove us with some parameter values that we can change.

Under Parameter Groups, open the Specular tab. Here, we've got a few values that can affect how shiny our texture is:



As you can see, all of the checkboxes are unticked. The values shown are those coming straight from the Material that we inherited from. Bump Scalar_Specular_Intensity down to about 0.2, ticking the box, and look at the difference it makes:



By changing parameters in the MIC like this, you can affect how the texture looks in the end. If we tweak more parameters in the MIC, we can make a great impact on the final appearance of our bricks. Another parameter to look at is the false reflection, which can be changed to 0 like so:



Our bricks are still a little shiny, but not nearly as bad as before.



By using textures that aren't of poor quality like mine are and using actual baked maps, you can get a much better result by tweaking parameters and toying with your materials / textures.
Finishing Up
Tweaking your parameters and textures can go a long way. Once you're done, however, your MIC is ready to go.

You can apply your new MIC in two ways: dragging the Content Browser thumbnail onto a surface, or selecting surfaces, right-clicking them, and picking Apply Material.



Save your map like you normally would by hitting File -> Save Current Level, or save it into a different location. Either way, your textures and MIC are built-in to your map package and your map will load them automatically.

You can do this with as many textures as you want, and MICs can also be used for adding custom textures to static meshes. With this method, you can add custom static meshes, textures, and even reskin existing meshes!
Final Words / Parents


Editing MICs is fun!

You can use this method in plenty of ways for plenty of things, as I've said before. If you ever find your texture looking like junk and you're not pleased with it, or you just want a different set of parameters to mess with, try a new Parent. KF2 has lots of materials in its files, so you're bound to find one you're happy with.

Speaking of such...

Handy Parent Parameters:
Copy-paste these into the Parent parameter of your MIC and change values as necessary.

Material'Env_Mat_Lib.Screen.Env_Screen_Basic_PM'
(Full-bright, good for screens / lights)

Material'Env_Mat_Lib.Metal.Env_Basic_Metal_PM'
(Very shiny, good for metal or as a base texture with tweaked parameters.)

MaterialInstanceConstant'ENV_Paris_MAT.Building.Generic.Env_Paris_Gen_Bldg_02_Railing_LOD_MIC'
(Has alpha but may be a little flat, good for transparent textures.)

A friendly reminder:
When importing transparent textures for an alpha MIC, remember to tick this checkbox in the import menu:



For modular map designers:
Remember that you can go to Static Mesh Actor -> Static Mesh Component -> Rendering -> Materials to give your static mesh a custom material.



Have fun making your own maps with custom textures! As always, TWI, don't do something to take this functionality away. This is just to hold everyone off until actual custom texture support comes along. If anyone has an alternate solution of doing this, let me know!
34 Comments
BurBon 29 Jun, 2020 @ 10:38am 
And I have another question for you - how can I export game textures to *.tga or any other graphic file format?
Wednesday 4 Sep, 2017 @ 2:46pm 
How does one make a Normal Map for their texture? I am usually really good with photoshop but this one perplexes the shit out of me.
RockMax 20 Sep, 2016 @ 1:27pm 
Thank you! This helped me so much!
Domaaaaaaaaaaaaaa 6 Apr, 2016 @ 7:21pm 
wow ok this helped me a lot LOL just gotta read every word it works now :)
Domaaaaaaaaaaaaaa 6 Apr, 2016 @ 5:30am 
This seem REALLY complicated for a noob like me, but at least thx for making it.
Dmitriy 20 Mar, 2016 @ 2:35am 
MIC should work fine. As for my previous problem you can import any size of texture, and there is a LOD B ias setting which you need to tweak in texture properties for it to look ok
76561198027781948  [author] 26 Aug, 2015 @ 10:13am 
Custom textures might not even work anymore, I was just told they patched it. Look at the medic gun textures.
MorriganVH 25 Aug, 2015 @ 4:54am 
Hi , good tutorial . I have a question , How to make a texture that emits light constantly Material ? Because I am bright textures with your technique but I can not.
76561198027781948  [author] 10 Aug, 2015 @ 6:06am 
Hm, that's weird. Good to know.
Dmitriy 10 Aug, 2015 @ 12:58am 
Ok, I got it, you need to import 2048x2048 texture. And put your in game Texture settings to Ultra