Source Filmmaker

Source Filmmaker

1,253 평점
Changing Textures Using Material Overrides
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!
3
   
어워드
즐겨찾기
즐겨찾기됨
즐겨찾기 해제
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!
댓글 224
crackles77 2024년 4월 19일 오전 8시 42분 
Is There A Way To Change The cally3d Models Textrues?
Piper 2024년 2월 12일 오전 7시 51분 
this guide makes me hard.
Ukeria 2024년 1월 29일 오후 12시 43분 
Ty but can i change it mid animation?
✞Ryder✞ 2023년 9월 26일 오후 1시 24분 
good tutorial helped me alot
KenDoStudios 2023년 9월 12일 오후 3시 33분 
didnt work here is me doing the same things but no effect https://files.catbox.moe/y4uw9b.png
Aeon-Reaper 2023년 8월 15일 오후 2시 58분 
Just to be clear, can you replace the texture of a model with another model's texture?
Ruba 2023년 8월 4일 오전 8시 55분 
w guide:jeannehappy:
kruusapuu 2023년 8월 3일 오후 2시 13분 
Thank you so much for this, helped me a lot
isaac from the binding of isaac 2023년 7월 25일 오후 9시 46분 
what is AAREPS? and why wont it work whenever i put it in?
TOE8311 2023년 6월 24일 오후 2시 39분 
oh i did do something wrong, im dumb