Colourable Textures
The idea behind colourable textures is pretty simple, it's just an alpha mask where visible parts (white) can be coloured and invisible parts (black) keep their original colour. Both .VTF and .PNG (up to 1K) textures support alpha masks.
Below you'll find a tutorial on how to make such texture using Paint.NET
Paint.NET
Requirements
Before you start you'll have to download some tools.
Paint.NET - free image editing software
Paint.NET VTF Plug-in - VTF file support for Paint.NET
Paint.NET Alpha Mask Import Plug-in - lets you use any image as an alpha mask.
Preparation
First, download Paint.NET and install it following the instructions on screen. Once done, you will have to install downloaded plug-ins. Head over to your installation folder, by default C:\Program Files\Paint.NET
, then:
VTF Plug-in
- Open downloaded .ZIP archive
- Copy all files info
..\Paint.NET\FileTypes\
Alpha Mask Plug-in
- Open downloaded .ZIP archive
- Copy all files info
..\Paint.NET\Effects\
Once that's done you can start working on your texture.
Importing textures
For this tutorial I'll be using in-game .VTF textures but you can follow the same steps for .PNG files.
- Go to
File
>Open
and select your file or drag & drop your file onto the program window and selectOpen
.
Creating an alpha mask
Since there is no way to edit existing alpha channel data (or I don't know about it) we'll have to reset all alpha information.
- Go to
Effects
>Alpha Mask
, uncheckPaste from Clipboard
and pressOK
.
That should leave you with the original non-transparent image. At this point you're free to paint your own alpha mask. Because an alpha mask is fully white by default we only need to add the black (non-colourable) data.
Press F7
to open the layers panel and add a new layer, then press F5
to open the tools panel and F4
to open the colour palette.
Pick the Paintbrush tool and set the colour to black.
Now your goal is to cover everything that you do NOT want to be colourable in black (on the new layer). Once you're done:
- Press
Ctrl
+A
to select the entire black layer. - Press
Ctrl
+C
to copy it to clipboard. - Hide or delete the black layer and go back to the original one.
- Go to
Effects
>Alpha Mask
, checkPaste from Clipboard
and pressOK
.
Now all the black parts should become transparent. That's it, your alpha mask is done.
Exporting
As .PNG
- Go to
File
>Save as
- Change file type to PNG
- Type the file name, select a location and click
Save
- In the next window leave everything at default and click
OK
As .VTF
- Go to
File
>Save as
- Change file type to VTF
- Type the file name, select a location and click
Save
- In the next window change Image Format to
DXT5
and clickOK
Upload your texture and be happy. :)
How to use it in PAC
A quick example on how to use an colourable texture in PAC. I decided to make colourable pants for Alyx.
- Add
Experimental > :entity: Entity
- Set it to your model (
models/player/alyx.mdl
in my case) - Under that add
Experimental > :material: Material3D
- Set
material override
to the material that you want to replace (plyr_sheet
in my case) - Clear
envmap
field - Paste your texture link into
basetexture
field - Check
tint by base alpha
- Change
color2
to whatever colour you want
Download this example: colourable_texture.txt
Known limitations
Textures can't be colourable and transparent at the same time.