Source Filmmaker

Source Filmmaker

798 voti
Changing Textures Using Material Overrides
Da 6000 ANGRY BEES
A handy, step-by-step guide to using Material Overrides to replace a model's texture with another texture. Very useful for all sorts of clever SFMing tricks!
 
Vota  
Aggiungi ai preferiti
Preferito
Rimuovi dai preferiti
Introduction
There are a lot of reasons why you'd want to change the texture on one specific instance of a model without changing it for all of the others. Maybe you want to use alpha layers to punch a hole in a zombie to expose it's gooey innards, Left 4 Dead style. Maybe you want to change the text on a billboard without changing it on other billboards. Maybe you want to give two Scouts different hair colours. Or maybe you want to go completely nuts with the Resizable Texture Panels and have access to more than 16 textures. Who am I to judge?

Whatever reason you wanted to do this, doing so before version 9.8.6 of SFM was a real pain - material overrides did not support changing texture paths, so either you'd have to temporarily replace one of the existing skins on the model, or you'd have to hex/recompile a duplicate with the skins you want. Both time-consuming and annoying!

As of 9.8.6, however, this issue has been fixed and you can now change texture paths more or less on a whim. Let's learn how to do it!
Requirements
  • Source Filmmaker. Obviously.
  • A model you want to change the texture on.
  • A replacement texture... or a tool to whip up a replacement texture. I use Nemesis's VTF Plugin for Photoshop.

For the purposes of this tutorial, I've made a copy of one of the Soldier's textures (soldier_red.vtf), moved it somewhere memorable (where is unimportant, as long as you can remember the path!), renamed it and messed around with it a bit, removing the class decal and recolouring it to be yellow.

(I didn't do a very good JOB of the recolour, mind, but this is fine for demonstration purposes.)
Preparation
Right! Let's get started. Create a new session, load a map, and create an animationset of the model you made a replacement texture for. Place it as you wish, then duplicate it.

We'll be completely ignoring one of these - he'll act as our "before" model. As for the other one, right click it in the Animation Set Editor and select "Add Override Materials".


Nothing will happen. Nothing visible, anyway - SFM just set up a few little things for us that allows us to change material settings for this animationset and this one alone - our "before" model will remain unaffected, and as soldierly as ever. Now, right click your animationset again and select Show In Element Viewer > Model.
Execution
Welcome to the Element Viewer, a place typically intended for experts only. Don't worry! Hold my hand and we'll get through this together.

Click the "+" next to "Materials" at the bottom of the list. A sub-list will open, giving a list of materials used by your model. Click the "+" next to the one you want to override (in this case, soldier_red). You'll see another sub-list, of some cloaking-related parameters. Feel free to ignore that.

Now, right click the material's name (not the mtlName parameter) and select Add Attribute > String.

You'll be asked for a name. Name it "$basetexture" and click OK.

You'll notice that our animationset's body has turned completely black. Don't panic! This is normal, and I guess kind of cool looking if you're, like, 13 years old.

Click in the blank space to the right of the word $basetexture, and enter in the path to your modified vtf file, with the file extension and the "materials" folder removed. So, for example, if your texture was in usermod/materials/replacements/soldier_yellow.vtf, you'd enter in "replacements/soldier_yellow".


And volia! If all has gone well, you should have a model bearing your modified texture, standing next to an unaltered model. If your model has a pink checkerboard instead of your custom texture, you messed up the file path. Check for typos!
Homework
So, using this tutorial, you overrode an animationset's $basetexture with one of your own. That's pretty cool, and your brain's probably already full of ideas on what you can do with this. But this isn't everything you can do with material overrides! Here are a few other things you can do, to poke you in advanced directions...

  • Not Just $basetexture: The 9.8.6 patch allows all texture paths to be overridden, not just $basetexture. $bumpmap, $detail and such are all fair game, allowing you to heavily alter a model's visual appearance and artstyle.
  • Not Just Strings, Either: You can also override other elements inside a material, with a little ingenuity - for example, adjusting a model's $phongexponent and $phongboost "int" variables to make it look wet and shiny, like they've just gotten out of water. Check the values in the original .vmt file using a text editor, and be sure to check the Valve Developer Wiki for deeper documentation of everything you could ever possibly want to know.
  • Alpha Layer Fun: As I alluded to in the introduction, you can use alpha layers in your $basetexture for all sorts of things. The official Valve TF2 zombie skins use this to "cut" holes in the player models for the "gory holes" model to sit comfortably in.
  • Have Fun!: Keep this in mind above all else. It's no use making a movie with 75 different, unique Pyros in every shot if you're bored out of your mind while making it. Make stuff in SFM to entertain yourself above all else - the YouTube hits, adoring fans and Saxxy trophies are just a pleasant bonus. :)

I hope you got something out of this tutorial and it helps you with your projects! If you did something cool with this little trick, or if you learn other clever tricks to pull with this stuff, post it in the comments!
< >
155 commenti
BOOF THE PASS 3 giu, ore 18:50 
I would love to see you do a tutorial on how you changed the colours via photoshop/gimp?
Volans | RGL.gg 21 apr, ore 12:13 
What's not mentioned is that you need to place the retextured .vtf files into the SFM folder. Find where the default texture is located in that same dropdown menu from the materials subfolder, and place your updated ones (rename them though) in there.
👉Dave👈 27 dic 2018, ore 23:38 
It is not working with scout.I Wrote AAREPS/scout_green but it isn't working...HELP PLS
OfficerFunks 24 dic 2018, ore 0:45 
i dont have materials when i go there
MimikyuRocks 22 nov 2018, ore 0:09 
Thanks, I got bumpmap on a w freddy model which makes it look nice!
WenRex16 10 lug 2018, ore 13:07 
And if I do not try to change the color to the original text,
but would it be rather add a texture on the current one?
An example the same soldier but with summer suit.
Scout Commando Prox 29 apr 2018, ore 10:05 
Whenever I try to use this method to edit and change textures, I for some reason get a glitch or something where when looking at the edited texture from a distance, it suddenly gains a different texture. I was attempting to edit a jacket for Sniper, but I ended up with something that looks like this when looking at it from a distance in SFM: http://prntscr.com/jbn967

Does anyone know what this is and knows how to fix this?
Maun 20 apr 2018, ore 12:51 
@Lepi you have to right click the models tree in the animation box and click add override materials
PheonixDstryer 19 apr 2018, ore 15:41 
Why does my materials box thing never show?
GrapeBoye 1 apr 2018, ore 9:27 
Hey!
I'm trying to retexture scout, but none of the materials apply for his shirt. Any fixes/workarounds/fixing my brain?