Fafy 391 / 8,413 Report Post Posted June 9, 2022 Edited June 9, 2022 by Fafy Aurora pls don't move this post to the most obscure section nobody will ever fucking read k thx. This post will explain how to turn a non colorable playermodel into a colorable one. As an example for this guide I'll be using this model for HNS: https://steamcommunity.com/sharedfiles/filedetails/?id=421639490 Requirements - Photoshop (because we need to edit alpha channels of .tga files) - VTFEdit (to export vtf to tga) - Notepad++ (or any text editor that isn't Window's notepad) - Crowbar (to decompile and recompile models) Downloading model I heavily recommend that you use gmpublisher to download and upload addons: https://github.com/WilliamVenner/gmpublisher Otherwise addons that you subscribed to will be on the addons folder or you'll have to hunt down the .gma file on the steam's workshop location Once you have the .gma simply drag and drop it on garrysmod/bin/gmad.exe and you'll get a folder After decompiling the addon put it on your addon's folders. Recompiling model Use Crowbar to decompile the .mdl of the addon. Afterwards open the .qc file and change $ModelName and $CDMaterials to something unique, examples below This is how the example model ends up looking: - $ModelName "captainbigbutt\vocaloid\neru_classic.mdl" -> $ModelName "neru_classic_colorable\neru_classic.mdl" - $CDMaterials "models\captainbigbutt\vocaloid\neru_classic\" -> $CDMaterials "models\neru_classic_colorable\" Afterwards simply recompile the model and move it to the model's addon folder. If Crowbar refuses to compile the model simply grab the error it spews and google it. If Crowbar still refuses to compile the model, you can use Notepad++ and download the HEX-Editor plugin and use that to change the paths of the .mdl file manually, afterwards just move the files where they should be according to the paths you changed If the model uses custom viewmodel hands you'll have to do the same steps above but with the hands. This is how the viewmodel of the example ends up looking: - $ModelName "captainbigbutt/vocaloid/c_arms/neru_classic.mdl" -> "$ModelName "neru_classic_colorable\neru_classic_arms.mdl" - $CDMaterials "models\captainbigbutt\vocaloid\neru_classic\" -> $CDMaterials "models\neru_classic_colorable\" Creating Lua file This is easy, simply go to addon_folder/lua/autorun and delete the lua file that's there. Then create a new file names model_name_colorable.lua (replacing model_name with your model's name). Use the following lines of text and replace the values with your model (don't use the hands line if your model doesn't have custom hands) player_manager.AddValidModel("Tda Akita Neru (v2) Colorable", "models/neru_classic_colorable/neru_classic.mdl") player_manager.AddValidHands("Tda Akita Neru (v2) Colorable", "models/neru_classic_colorable/neru_classic_arms.mdl", 0, "00000000") Editing VMT files First find the materials for the model and move them to where you specified $CDMaterials to be. Afterwards modify every single .vmt file to use the new CDMaterials, I recommend using Notepad++ and using the Replace in Files. Some paths use "\" and others "/" so watch out for that. This is necessary because otherwise the model will have missing textures or use the old textures. I recommend unsubscribing to the old model while you edit the new one, so that you notice if there's a missing texture (because it's using the old addon's texture path) Editing VTF files Here's the fun part, you'll have to identify which texture is what on the model, so open every single VTF file until you find something that you want to be colorable. Depending on the texture you'll want the entire texture to be colorable or only some parts: Entire texture should be colorable For this part I will be using the example's hair.vtf because it's all hair Open the VTF and go to File > Export > save as a .tga file Open the TGA with Photoshop and make the texture be white/gray (I use Layer > New Adjustment Layer > Black and White) Finally save the texture as a TGA and use VTFEdit to import the texture, when importing, keep in mind that some textures don't need alpha, like this one, and should be imported as DXT1 to save on file size. Here's a before and after (the model has two hair textures so the behind is not gray) Finally, add this to the .vmt file "$blendtintbybasealpha" "0" "$blendtintcoloroverbase" "1" Proxies { PlayerColor { resultVar $color2 default 1 0 0 } } Like so: And you should be done with that texture. If you want the rainbow effect for testing type in console lua_run hook.Add("Think", "HELL", function() local color = HSVToColor(RealTime() * 70 % 360, 1, 1) Entity(1):SetPlayerColor(Vector(color.r / 255, color.g / 255, color.b / 255)) end) Only some parts of the texture should be colorable For this part I will be using the example's face.vtf because only the eyes need coloring (sometimes the eyes may be on different files, but for this model it's on the face) Open the VTF and go to File > Export > save as a .tga file Open the TGA with Photoshop and use the Quick Selection Tool to select what you want colorable, in my case it's the iris and the eyebrows. Afterwards go to Channels and click on Alpha 1 and you're gonna use the Brush Tool to make everything white while making everything that should NOT be colorable black (for example, the skin shouldn't be colorable) Afterwards WITHOUT DESELECTING use Layer > New Adjustment Layer > Black and White, finish editing and save the TGA file and import it with VTFEdit (when importing, make sure to use DXT5 for alpha, since the texture requires alpha for the colorable) , then save it replacing the old file. Finally open the VMT file and add the following (this is different than when the entire texture is colorable, since this uses the alph a while the other doesn't) "$blendtintbybasealpha" "1" "$blendtintcoloroverbase" "0" Proxies { PlayerColor { resultVar $color2 default 1 0 0 } } End result, notice that we edited the face texture but only the eye ends up being colorable VMT Tweaks Some textures use a property called $phong that makes everything very light, you can just remove this, here's an example of with phong and without (notice the tie and end of the skirt and sleeves). I'll add more stuff here if I can recall later. The End Finally the only thing that's left to do is to upload to the workshop, I recommend using gmpublisher to do it, if you don't want to use it then google how to upload an addon to the workshop. Edited June 9, 2022 by Fafy Share this post Link to post Share on other sites More sharing options...
AlphaOwl 286 / 6,433 Report Post Posted June 9, 2022 Wow. Surprisingly just what I was hoping to look for in adding stuff like this to Rotation. Thanks! The Personal Relations Server Manager of GFL TTT Rotation. Don't worry, there'll be plenty of fanservice! Share this post Link to post Share on other sites More sharing options...
Imaginebeinweird 0 / 413 Report Post Posted December 1, 2022 please make a youtube video on how to do this Share this post Link to post Share on other sites More sharing options...