{{tag>tutorial texture material alpha vtf png paint.net}} {{htmlmetatags>metatag-media-og:image=(:wiki:wiki.png) metatag-keywords=(pac3,wiki,gmod,vtf,png,alpha,colourable,texture) metatag-description=(Tutorial on how to create colourable textures for PAC3.) metatag-og:title=(Colourable textures in PAC3.) metatag-og:description=(Tutorial on how to create colourable textures for PAC3.) }} ===== 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. {{https://i.imgur.com/1Uv6Itv.png}} Original texture {{https://i.imgur.com/Nmd2MHT.png}} Alpha mask {{https://i.imgur.com/JT1oX7Y.png}} End result, texture coloured in PAC ---- 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. [[https://www.getpaint.net/|Paint.NET]] - free image editing software [[http://nemesis.thewavelength.net/files/files/pdnvtfplugin111.zip|Paint.NET VTF Plug-in]] - VTF file support for Paint.NET [[https://forums.getpaint.net/applications/core/interface/file/attachment.php?id=13208|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 select **''Open''**. ---- ==== 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''**, **uncheck** **''Paste from Clipboard''** and press **''OK''**. 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''**, **check** **''Paste from Clipboard''** and press **''OK''**. 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 click **''OK''** 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 {{icon:bug.png?nolink}} **Experimental** > :entity: **Entity** * Set it to your model (**''models/player/alyx.mdl''** in my case) * Under that add {{icon:bug.png?nolink}} **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: {{asset:example:colourable_texture.txt}} {{https://i.imgur.com/8C25bg6.png}} End result as seen in PAC ===== Known limitations ===== Textures can't be colourable and transparent at the same time.