Alpha is the fourth channel of an image, it acts as a mask and is usually used for transparency. In Source engine it can be used for multiple things such as transparency, colorable textures, and different kind of masks, e.g. phong mask.
This tutorial will cover the creation of transparent and colorable textures using Blender.
I'm using Blender because it allows you to paint directly on the model and preview how it's gonna look in-game. If you know how to apply this tutorial to your own software then feel free to do so.
Tools that you will need:
Blender + Blender Source Tools
Crowbar - Decompiling
VTFEdit or Paint.NET + .VTF plugin - Converting textures
First you have to get the model and texture that you want to edit. See Extracting game content for information on how to extract those from the game.
For this tutorial I'll be using Alyx, and my goal is to make part of her pants invisible, the required files are:
Model (all model files are required):
Texture (only get the textures you want to edit):
Material files are not needed but you can extract and open them if you don't know which textures you should get.
To actually do something with the extracted model you have to decompile it first.
To decompile your model open Crowbar and go to the Decompile tab. Select your model by clicking Browse
in the MDL input line, then select the output folder and click Decompile
.
From all the decompiled files only one is actually needed, in this case alyx_reference.smd. The name will be different depending on the model you're using but for most GMod models its <character_name>_reference.smd.
Before you can edit the textures you'll have to convert them to a different format. This step is pretty simple, all you have to do is open the .vtf file in VTFEdit or Paint.NET and save it as a .png file.
At this point you should have:
First you have to import your model to Blender.
File
> Import
> Source Engine
.Import SMD…
at the bottom.Here are some very basic controls if you're new to Blender:
RMB
- Select objectsMMB
- Rotate viewShift + MMB
- Pan viewMouse Wheel
- Zoom. Numpad
- View selectedBefore you paint the texture you need to set up the material so that you get a preview of how it's gonna look in the game.
Right Click
on the skeleton (one of the spheres) and press H to hide it.Use Nodes
.RMB
- Select NodeX
- Delete NodeShift
+ A
- Add NodeG
- MovePrincipled BSDF
node.Mix Shader
node, connect the Shader output to the Surface input on Material Output
.Diffuse BSDF
node, connect the BSDF output to the bottom Shader input on Mix Shader
.Transparent BSDF
node, connect the BSDF output to the top Shader input on Mix Shader
.Image Texture
node, connect the Color output to the Color input on Diffuse BSDF
and the Alpha output to the Fac input on Mix Shader
, then click Open
and select your texture.Switch to the Texture Paint workspace (at the top). The left panel shows your texture, the right one shows the model, you can paint on any of them. That's it, now you can paint on your texture. There isn't much to say about it, just remember:
Shift
+ Alt
+ S
.Save As Image
.If you don't know how to use it in PAC follow Replacing materials/textures.
If you have any questions ask in the #help channel of the Official PAC Discord