Page 1 of 1

A custom texture with multiple pictures

Posted: Sun Jul 25, 2010 7:49 pm
by Bowl of Gravy
I have tried but failed at making a custom texture for my disco/rave map for tf2.
I want it to have 4 colors (red,yellow,blue,green) switch off like on a disco floor.

(FYI)On de_absurdity below the disco floor (not secret room) there are 4 planes with almost exactly what I want to happen.

If Kenny could tell me or if somebody else knows how that would be nice to help me out :D

Re: A custom texture with multiple pictures

Posted: Sun Jul 25, 2010 9:44 pm
by AlphaKennyOne
That is done by creating an animated texture. I'm going off of my memory on this, because i've never tried to make an animated texture for TF2. This is just a modified version of how I did it for CSS.

What you do is make 4 .tga files, each one is your "frame" of animation, so one .tga will be a solid color of red, then blue, etc. Save those .tga images in the following format:

"imagename000.tga" for the first one, and "imagename003.tga" for the last.

Then create a .txt file and call it "imagename.txt" (the "imagename" always being the same as your .tga files.) Inside that .txt file, you should have the following, exactly as you see it below.

"startframe" "0"
"endframe" "3"

Put that .txt file and your 4 .tgas into a folder in the "sourcesdk_content\tf\materialsrc" directory. That folder you made should also be in your "team fortress 2\tf\materials" directory. Make sure it's the same name, because if it isn't, then Vtex won't find a place for your textures, and it'll give you an error. If you don't have a "materialsrc" folder in your "sourcesdk_content\tf\" directory, make one. Leave that directory open, and open another one and go to "sourcesdk\bin\orangebox\bin" and look for "vtex.exe". Drag your "imagename.txt" file onto the vtex.exe and release it. Vtex should then automatically make your animated texture, and place it in the proper directory: "team fortress 2\tf\materials". Now you'll have to make your .vmt files. To do that, make a new .txt file, and put the following in it:

Code: Select all

"LightMappedGeneric"
 {
  "$baseTexture" "foldername/texturename"
  $surfaceprop metal [Change "metal" to whatever you want this texture to act like when walked on or shot. Basic surfaceprops are metal, concrete, wood and glass.]
  "Proxies" 
       { 
         "AnimatedTexture" 
         { 
            "animatedTextureVar" "$basetexture" 
            "animatedTextureFrameNumVar" "$frame" 
            "animatedTextureFrameRate" "2" [Set this number higher if you want it to flash faster]
         }
    } 
 }
Feel free to change "LightMappedGeneric" to "UnlitGeneric" if you don't want your texture to be affected by lights, ie: to make it always seem to be fully lit up. That's what I used for my animated textures. Save that file as "imagename.vmt", ensure that you keep the same name for all your .tga files, .vmf and .vmt files, for convienience's sake.

That should be it. Like I said, this was all from memory, so if something doesn't work out right, let me know and i'll see how I can go about fixing it.

Re: A custom texture with multiple pictures

Posted: Sun Jul 25, 2010 11:03 pm
by Bowl of Gravy
AlphaKennyOne wrote:That is done by creating an animated texture. I'm going off of my memory on this, because i've never tried to make an animated texture for TF2. This is just a modified version of how I did it for CSS.

What you do is make 4 .tga files, each one is your "frame" of animation, so one .tga will be a solid color of red, then blue, etc. Save those .tga images in the following format:

"imagename000.tga" for the first one, and "imagename003.tga" for the last.

Then create a .txt file and call it "imagename.txt" (the "imagename" always being the same as your .tga files.) Inside that .txt file, you should have the following, exactly as you see it below.

"startframe" "0"
"endframe" "3"

Put that .txt file and your 4 .tgas into a folder in the "sourcesdk_content\tf\materialsrc" directory. That folder you made should also be in your "team fortress 2\tf\materials" directory. Make sure it's the same name, because if it isn't, then Vtex won't find a place for your textures, and it'll give you an error. If you don't have a "materialsrc" folder in your "sourcesdk_content\tf\" directory, make one. Leave that directory open, and open another one and go to "sourcesdk\bin\orangebox\bin" and look for "vtex.exe". Drag your "imagename.txt" file onto the vtex.exe and release it. Vtex should then automatically make your animated texture, and place it in the proper directory: "team fortress 2\tf\materials". Now you'll have to make your .vmt files. To do that, make a new .txt file, and put the following in it:

Code: Select all

"LightMappedGeneric"
 {
  "$baseTexture" "foldername/texturename"
  $surfaceprop metal [Change "metal" to whatever you want this texture to act like when walked on or shot. Basic surfaceprops are metal, concrete, wood and glass.]
  "Proxies" 
       { 
         "AnimatedTexture" 
         { 
            "animatedTextureVar" "$basetexture" 
            "animatedTextureFrameNumVar" "$frame" 
            "animatedTextureFrameRate" "2" [Set this number higher if you want it to flash faster]
         }
    } 
 }
Feel free to change "LightMappedGeneric" to "UnlitGeneric" if you don't want your texture to be affected by lights, ie: to make it always seem to be fully lit up. That's what I used for my animated textures. Save that file as "imagename.vmt", ensure that you keep the same name for all your .tga files, .vmf and .vmt files, for convienience's sake.

That should be it. Like I said, this was all from memory, so if something doesn't work out right, let me know and i'll see how I can go about fixing it.
Ok, basically all I had to do was put the 4 files in VTFEdit and make it into a .tga then use that coding for the .vmt. The whole thing you were trying to do never worked out, I tried billions of things, it always had errors.

One more thing, your texture lit up in your map below the disco floor, I was wondering how to do that..

Re: A custom texture with multiple pictures

Posted: Mon Jul 26, 2010 1:13 am
by AlphaKennyOne
Not sure exactly what you mean, but it sounds like an error with the texture "bleeding through" the func_brush on top of it.

Re: A custom texture with multiple pictures

Posted: Mon Jul 26, 2010 6:55 pm
by Bowl of Gravy
I meant by that your textures were really bright even in a non-bright room.
But THANK YOU anyway for all your help! :)

Re: A custom texture with multiple pictures

Posted: Mon Jul 26, 2010 9:26 pm
by AlphaKennyOne
Yeah, that's due to the "UnlitGeneric" setting instead of the "LightMappedGeneric", but you're welcome.