Tutorials

Creating Reflective Textures



This tutorial assumes that you have a basic understanding of how env_cubemaps work (there are 2 tutorials about them already), and that you've already made your own custom texture and got it showing up properly in your maps, but you want to make it shiny, using env_cubemaps.

I've got my texture up and running, called "Greymetal1wornedges", but it's not giving me the kind of shine that metal should have, no matter how many env_cubemap entities I put next to it.

Getting your textures shiny is easy- just use your favourite text editor to go into your vmt file (which, as you probably know, is in your Steam\steamapps\yournamecounter-strike source\cstrike\materials folder, if you're working on Counter Strike) and add this line in the vmt file:
"$envmap" "env_cubemap"

An example of what a basic vmt file will look like;

"lightmappedgeneric"
{
	"$baseTexture" "Greymetal1wornedges"
	"$surfaceprop" "metal"
	"$envmap" "env_cubemap"
}



This will work in the game- however, it's way too shiny to look realistic (except maybe for adding details.) It needs to be toned down to be of any real use.

I think the best way to do this is to add a mask. This is basically a greyscale image, where the black will block the reflection completely, and the white will be the full reflection that we got before. Once you've made your greyscale image tga and compiled it, add the following line to your vmt; "$envmapmask" "SRNgreyscale1" (where my greyscale is called "SRNgreyscale1", obviously.)

So my finished vmt file now looks like this;

"lightmappedgeneric"
{
	"$baseTexture" "Greymetal1wornedges"
	"$surfaceprop" "metal"
	"$envmap" "env_cubemap"
	"$envmapmask" "SRNgreyscale1"
}



Put the texture where you want it in your map, stick an env_cubemap next to it, compile and run. You should get a nice reflection as you move around it. (Unless you are running an advanced compiler, you may need to run "buildcubemaps" in the console to get the reflections to show up properly.)


somerandomnerd

View comments ( 25 )

Back to top