VTFEDIT HELP
Quote from radelite on May 28, 2014, 12:32 amI can do a few things with vtf edit such as editing portalgun textures or player textures but then there are some things that seem to have an invisible background like in a decal. I used photoshop to delete the background around the decal but once I finish opening the texture in hammer all around the texture is white.
Also I could use some help learning a few command lines for vmt files, again I know a few but I am limited to those few atm.
I can do a few things with vtf edit such as editing portalgun textures or player textures but then there are some things that seem to have an invisible background like in a decal. I used photoshop to delete the background around the decal but once I finish opening the texture in hammer all around the texture is white.
Also I could use some help learning a few command lines for vmt files, again I know a few but I am limited to those few atm.
Quote from CamBen on May 28, 2014, 1:27 amYou have to add an alpha channel, where white is visible/lit and black is invisible/unlit.
You have to add an alpha channel, where white is visible/lit and black is invisible/unlit.
Aperture Science: We do our science asbestos we can!
Quote from josepezdj on May 28, 2014, 2:50 amradelite wrote:I used photoshop to delete the background around the decal but once I finish opening the texture in hammer all around the texture is white.If you are sure that your texture's background is transparent, then all you need is to add the parameter $decal 1 and $translucent 1 inside your .VMT. That should do.
radelite wrote:Also I could use some help learning a few command lines for vmt files, again I know a few but I am limited to those few atm.Well, you have some information on the wiki, however, I'll try to tell you some basic knowledge so that you can have a first overview.
(Post to be edited in some minutes....)
EDIT
OK, let's go. Take a quick look to these 2 examples first:
THE SHADER
First thing you want to set up into your .VMT is the shader you'll want the engine to use to render your texture. This is declared at the very beginning of your .VMT. You then need to open a bracket for a block of code, then put all the parameters you want to control and set up, and then use another bracket to close the block.
The most commonly used shader is the Lightmappedgeneric. This is the one you'll use for almost all the textures in your map. When the compile (VRAD) finds this shader, it gathers the lighting surrounding each surface textured with your texture and it stores this information into a lightmap (thus the name of the shader "Lightmappedgeneric") which is fixed to that surface. VRAD does that for each of your map's surfaces textured with a Lightmappedgeneric texture. Lightmaps are static, meaning that the lighting stored for each of these surfaces won't ever change in game; anyways, these surfaces can still cast more lighting or shadows coming from an env_projectedtexture, which has dynamic values that can change in game.
You've surely seen another shader called VertexlitGeneric. This is a shader to render model's textures. It uses the player's position to set an amount of lighting and reflections on the model (try not to use some textures ended up with "_vertex" because you will see them behaving weird in game due to how this specific shader is managed)
Other important shader is UnlitGeneric. It does what it says, it doesn't store the lighting information into lightmaps based in the surrounding lighting when compiling, but the lighting information from the texture itself, and that's why is named Un-lit-generic. This can make it glow in the dark (which means that it has a light independent from its environment). You tipically know it from the Portal2 indicator lights textures.
One of my favourite shaders is the Refract one. You can basically create a refracting material that distort what is seen through it. With the use of some material proxies to animate a bumpmap you can even fake a waterfall or a wall of water. I've made some cool textures by using this shader already, any problem you find with it, just tell me and I'll try to help you out.
Some other interesting shaders are the "SolidEnergy" (sry, linking you to an old post of mine because of the lack of information on the wiki ) shader (used for the textures of the fizzlers, laserfields, light bridges...), "UnlitTwoTexture" (used to mix 2 different textures; note the part of "Unli", similar behavior than the UnliGeneric), "WorldVertexTransition" (used for blending textures on displacements), "WorldTwoTextureBlend".... You can take a look to the existing shaders.
SOME PARAMETERS
Depending on the chosen shader you'll have some parameters available and others not. Also, there will be some of them specifically made for only a given shader... The simplest shader is the UnlitGeneric since too few params are available (because by concept, it is self-setup). Let me tell you about some interesting parameters:
- $translucent: it admits a boolean value, 1 (= ON) or 0 (= OFF). The alpha channel of your texture will set the translucency information of each part (pixel) of your texture. The parts you set as transparent in the alpha channel won't be visible, and also the transparency level per pixel will taken into account to show them mmore/less in game.
- $selfillum: it admits a boolean value, 1 (= ON) or 0 (= OFF). This will make your texture to be self illuminated if set to "1". This is also very interesting to have glowing textures in the dark. You can also set what should be glowing and what shouldn't be via the alpha channel of your texture
- $bumpmap: it sets the path to a bump (first image on the left) or a normal (image on the right) map:
You can fake an enhancement of the relief of your texture with this parameter. You can get awesome results with a good bumpmap or normalmap.
- $ssbump: it admits a boolean value, 1 (= ON) or 0 (= OFF). If set to "1" you tell the engine to use the fake relief of your bumpmap to cerate the shadows (self-shadowing) for your material.
- $reflectivity: This is a very interesting parameter available for the LightmappedGeneric shader. You need to set 3 values between "0" and "1" (for the Red Green and Blue), and they indicate the amount of lighting you want the texture to reflect out, but without having to increase the surrounding lighting in your map. You can use it to increase the level of brightness that a texure will reflect in game: values like [.75 .75 .75] will be brighter than for example [.4 .4 .4]. But you can also use this parameter to make your textures reflect a given colour by not reflecting the same amount of lighting for R G and B. Take a look to this awesome article that explains this very well.
- %noportal: it admits a boolean value, 1 (= ON) or 0 (= OFF). Pretty self-explanatory :p
- %nopaint: it admits a boolean value, 1 (= ON) or 0 (= OFF). If set to "1" you won't be able to paint any surface textured with your texture.
- $detail: path to a detail texture. This is great to give a nice touch to your textures, have you noticed those little dots there are on the white textures in portal? those aren't part of the texture itself, but this detail texture:
Awesome, right?
- $decal: it admits a boolean value, 1 (= ON) or 0 (= OFF). If set to "1" it will stay on top of another texture without overlapping.
There are MAAAAANY more....
THE MATERIAL PROXIES
This is by far the most interesting thing regarding textures. The material proxies can make a texture animated in many ways. Take a look to this amazing article and check what you can do
If you take one of the P2 stock textures you'll notice how complex these can become:
dev_tvmonitor1a.vmt
[spoiler]
- Code: Select all
UnlitTwoTexture
{
$basetexture _rt_Camera
"%tooltexture" "overlays/command_target_orange"
$mappingwidth 256
$mappingheight 256
$surfaceprop glass$texture2 "dev/dev_scanline"
$vertexcolor 1
$one 1
$zero 0
$temp 0
$texoffset "[0 0]"
$texscale .25
$tex2offset "[0 0]"
$tex2scale 0
$a_b_halfwidth 0.1
$a_b_noise 0
$a_s_halfwidth 0.025
$a_s_noise 0
$a_t_halfwidth 0.00
$a_threshold 0.7
$alpha_bias 0.2$j_b_halfwidth 2
$j_b_noise 0
$j_s_halfwidth 0.05
$j_s_noise 0
$j_t_halfwidth 0.25
$j_threshold 3
$j_basescale 2$xo_b_halfwidth 0.035
$xo_b_noise 0
$xo_s_halfwidth 0.001
$xo_s_noise 0
$xo_t_halfwidth 0.0
$xo_threshold 0.1
Proxies
{
Sine
{
resultVar "$color[0]"
sineperiod 1
sinemin .9
sinemax .9
}
Sine
{
resultVar "$color[1]"
sineperiod .01
sinemin .9
sinemax 1
}GaussianNoise
{
mean $zero
halfwidth $a_b_halfwidth
resultVar $a_b_noise
}
Abs
{
srcVar1 $a_b_noise
resultVar $a_b_noise
}
Subtract
{
srcvar1 $one
srcvar2 $a_b_noise
resultvar $a_b_noise
}
GaussianNoise
{
mean $zero
halfwidth $a_s_halfwidth
resultVar $a_s_noise
}
Abs
{
srcVar1 $a_s_noise
resultVar $a_s_noise
}
Subtract
{
srcvar1 $one
srcvar2 $a_s_noise
resultvar $a_s_noise
}
GaussianNoise
{
mean $a_threshold
halfwidth $a_t_halfwidth
resultVar $a_threshold
}
LessOrEqual
{
srcVar1 $a_b_noise
srcVar2 $a_threshold
lessEqualVar $a_b_noise
greaterVar $a_s_noise
resultVar $temp
}GaussianNoise
{
mean $zero
halfwidth $j_b_halfwidth
resultVar $j_b_noise
}
GaussianNoise
{
mean $zero
halfwidth $j_s_halfwidth
resultVar $j_s_noise
}
GaussianNoise
{
mean $j_threshold
halfwidth $j_t_halfwidth
resultVar $j_threshold
}
Abs
{
srcVar1 $j_b_noise
resultVar $temp
}
LessOrEqual
{
srcVar1 $temp
srcVar2 $j_threshold
lessEqualVar $j_s_noise
greaterVar $j_b_noise
resultVar $temp
}
Add
{
srcvar1 $temp
srcvar2 $j_basescale
resultvar $tex2scale
}TextureTransform
{
translateVar $texoffset
resultVar $basetexturetransform
}LinearRamp
{
resultVar "$tex2offset[1]"
rate -.91
}
TextureTransform
{translateVar $tex2offset
resultVar $texture2transform
}
}
}Yeah! I know you can end up totally crazy!!! >.<[/spoiler]
That was the texture you use with the entity func_monitor, and if you remember, it produces a lot of cool artifacts and realistic TV noise on your monitor... Basically you can create variables and play with their values by setting a lot of arithmetic operations... Here you'll find a list of these material proxies. It takes some time to understand them and be able to achieve the desired animation on your texture, but they worth your time IMHO
I hope this helps you out to understand the material textures a bit more
If you are sure that your texture's background is transparent, then all you need is to add the parameter $decal 1 and $translucent 1 inside your .VMT. That should do.
Well, you have some information on the wiki, however, I'll try to tell you some basic knowledge so that you can have a first overview.
(Post to be edited in some minutes....)
EDIT
OK, let's go. Take a quick look to these 2 examples first:
THE SHADER
First thing you want to set up into your .VMT is the shader you'll want the engine to use to render your texture. This is declared at the very beginning of your .VMT. You then need to open a bracket for a block of code, then put all the parameters you want to control and set up, and then use another bracket to close the block.
The most commonly used shader is the Lightmappedgeneric. This is the one you'll use for almost all the textures in your map. When the compile (VRAD) finds this shader, it gathers the lighting surrounding each surface textured with your texture and it stores this information into a lightmap (thus the name of the shader "Lightmappedgeneric") which is fixed to that surface. VRAD does that for each of your map's surfaces textured with a Lightmappedgeneric texture. Lightmaps are static, meaning that the lighting stored for each of these surfaces won't ever change in game; anyways, these surfaces can still cast more lighting or shadows coming from an env_projectedtexture, which has dynamic values that can change in game.
You've surely seen another shader called VertexlitGeneric. This is a shader to render model's textures. It uses the player's position to set an amount of lighting and reflections on the model (try not to use some textures ended up with "_vertex" because you will see them behaving weird in game due to how this specific shader is managed)
Other important shader is UnlitGeneric. It does what it says, it doesn't store the lighting information into lightmaps based in the surrounding lighting when compiling, but the lighting information from the texture itself, and that's why is named Un-lit-generic. This can make it glow in the dark (which means that it has a light independent from its environment). You tipically know it from the Portal2 indicator lights textures.
One of my favourite shaders is the Refract one. You can basically create a refracting material that distort what is seen through it. With the use of some material proxies to animate a bumpmap you can even fake a waterfall or a wall of water. I've made some cool textures by using this shader already, any problem you find with it, just tell me and I'll try to help you out.
Some other interesting shaders are the "SolidEnergy" (sry, linking you to an old post of mine because of the lack of information on the wiki ) shader (used for the textures of the fizzlers, laserfields, light bridges...), "UnlitTwoTexture" (used to mix 2 different textures; note the part of "Unli", similar behavior than the UnliGeneric), "WorldVertexTransition" (used for blending textures on displacements), "WorldTwoTextureBlend".... You can take a look to the existing shaders.
SOME PARAMETERS
Depending on the chosen shader you'll have some parameters available and others not. Also, there will be some of them specifically made for only a given shader... The simplest shader is the UnlitGeneric since too few params are available (because by concept, it is self-setup). Let me tell you about some interesting parameters:
- $translucent: it admits a boolean value, 1 (= ON) or 0 (= OFF). The alpha channel of your texture will set the translucency information of each part (pixel) of your texture. The parts you set as transparent in the alpha channel won't be visible, and also the transparency level per pixel will taken into account to show them mmore/less in game.
- $selfillum: it admits a boolean value, 1 (= ON) or 0 (= OFF). This will make your texture to be self illuminated if set to "1". This is also very interesting to have glowing textures in the dark. You can also set what should be glowing and what shouldn't be via the alpha channel of your texture
- $bumpmap: it sets the path to a bump (first image on the left) or a normal (image on the right) map:
You can fake an enhancement of the relief of your texture with this parameter. You can get awesome results with a good bumpmap or normalmap.
- $ssbump: it admits a boolean value, 1 (= ON) or 0 (= OFF). If set to "1" you tell the engine to use the fake relief of your bumpmap to cerate the shadows (self-shadowing) for your material.
- $reflectivity: This is a very interesting parameter available for the LightmappedGeneric shader. You need to set 3 values between "0" and "1" (for the Red Green and Blue), and they indicate the amount of lighting you want the texture to reflect out, but without having to increase the surrounding lighting in your map. You can use it to increase the level of brightness that a texure will reflect in game: values like [.75 .75 .75] will be brighter than for example [.4 .4 .4]. But you can also use this parameter to make your textures reflect a given colour by not reflecting the same amount of lighting for R G and B. Take a look to this awesome article that explains this very well.
- %noportal: it admits a boolean value, 1 (= ON) or 0 (= OFF). Pretty self-explanatory :p
- %nopaint: it admits a boolean value, 1 (= ON) or 0 (= OFF). If set to "1" you won't be able to paint any surface textured with your texture.
- $detail: path to a detail texture. This is great to give a nice touch to your textures, have you noticed those little dots there are on the white textures in portal? those aren't part of the texture itself, but this detail texture:
Awesome, right?
- $decal: it admits a boolean value, 1 (= ON) or 0 (= OFF). If set to "1" it will stay on top of another texture without overlapping.
There are MAAAAANY more....
THE MATERIAL PROXIES
This is by far the most interesting thing regarding textures. The material proxies can make a texture animated in many ways. Take a look to this amazing article and check what you can do
If you take one of the P2 stock textures you'll notice how complex these can become:
dev_tvmonitor1a.vmt
That was the texture you use with the entity func_monitor, and if you remember, it produces a lot of cool artifacts and realistic TV noise on your monitor... Basically you can create variables and play with their values by setting a lot of arithmetic operations... Here you'll find a list of these material proxies. It takes some time to understand them and be able to achieve the desired animation on your texture, but they worth your time IMHO
I hope this helps you out to understand the material textures a bit more
Quote from Arachnaphob on May 29, 2014, 2:15 amjosepezdj wrote:everythingWow, that's friggin useful! Thanks for typing that up. You should post that here. It would be super helpful.
Wow, that's friggin useful! Thanks for typing that up. You should post that here. It would be super helpful.
Musical website Moddb