User:Gabrielwoj/Creating New HLMV-Rotations Files
| A todo list has been written for this article. The specific instructions are: Try out the newest version of VTFEdit Reloaded and compare the texture quality |
| My Userpage | My Contributions | Sandbox |
Contents
Pre-Requisites
- _materials template
- GIMP
- gimp-vtf plugin
- (Optional) Paint.NET
- VTFEdit or VTFEdit Reloaded (only used for copying the original textures)
How does this work
_materials files work by having an alpha mask being applied to areas where it should only be visible on the player model. Parts painted in white on the alpha mask means it will be visible, while areas painted black means they will be invisible. Each player model's material file includes "$nocull" and "$alphatest" strings already applied for that. "$alphatest" is responsible for doing the removal process work, while "$nocull" is utilized so certain inside-areas of the model doesn't look off (mostly due the lack of the merc's head).
We have relied on working on textures as opposed to model editing, as it's very common for player models to break in some sort of way. For instance, re-compiling Sniper's model causes his vest to have a different light reflection. Re-compiling Heavy's model causes some issues on some of his bones (where it can affect position of cosmetics), as well some corrupted textures behind his vest. The same applies to recompiling animations, as it can cause minor differences between the original files.
When these were originally made, there was no VTFEdit Reloaded available, and we relied on either GIMP (free software) with the gimp-vtf plugin, or the vtf plugin for Photoshop (paid software). Due to the vast majority of these _material files being made years ago, I have still relied on gimp-vtf's method even though the fabled green tint appearance. It's worth noting that, even if I import the files via VTFEdit Reloaded, they aren't still 1:1 with the original. Unless there's a way to make certain parts of the texture hidden without affecting the texture quality, we will be still relying on gimp-vtf.
.zip Contents
The .zip file contains the following folders:
1- Starter Files
These files already include the class player models with an alpha mask applied, as well each material with the appropriate syntaxes. It's worth mentioning that these starter files all have the class head hidden, as the vast majority of _materials do not include them. To make the heads appear again, get rid of the "hwm" folder inside of each class, as well the eyeball_l.vmt, eyeball_r.vmt and sniper_lens.vmt (for Sniper).
- Pyro is the only class where there's no separate hwm texture for the head, and the head is from the class texture itself.
- For Heavy, hvyweapon_red_sheen.vmt and hvyweapon_blue_sheen.vmt refers to his gloves. If you wish to enable them, you'll need to obtain these .vmt files from the game's .vpk, replace with the ones on the Starter folder and add the following lines somewhere (preferably below "$one" and above "$phong"):
"$alphatest" "1" "$nocull" "1"
- For Medic, his Medi Gun backpack is a separate texture, so it's hidden. Get rid of medic_backpack_red.vmt and medic_backpack_blue.vmt if you want them visible. His glasses is also part of his class texture, and not on his hwm head textures.
- For Sniper, his glasses (and lenses) are part of his class texture, and not on his hwm head texture. Likewise, his white shirt is part of his head texture, meaning it's the only class where his head materials aren't set to "$no_draw".
- Spy's cigar is located on his class texture and not his head texture.
2- Original Textures
These are the vanilla textures from the game's .vpk, which will be required in the process of creating new _materials files. They should not be replaced.
3- UV Mapping Reference
Includes the UV Mapping of each class:
- The "Full" folder includes all the sections of the texture that is mapped to the model;
- While the "Separated" folder includes each part separated, taken from how the Gray Mannequin Bodygroups models are separated (special thanks for NeoDement for working on the original Gray Mannequin Bodygroups).
- Each class is separated on a folder, and each part of the model is separated on a separate .png. There are also .xcf files to be open on GIMP, or .pdn files to be open on Paint.NET.
- The .xcf and .pdn files have each part of the model separated by layers, with the section colored completely white. These files are meant to be a straightforward way in hiding/showing certain parts of the model once we get to making the textures on GIMP.
- Each class is separated on a folder, and each part of the model is separated on a separate .png. There are also .xcf files to be open on GIMP, or .pdn files to be open on Paint.NET.
Making a new _materials pack
If you are working on a new painted variants (or item-skins) for a new item that doesn't have an appropriate _materials pack for it, you need to know what kinds of elements it should be visible. Open one of the UV Mapping references on the Separated folder related to that class, and open the associated .pdn or .xcf file for it. Each layer is separated by parts of the model (arms, legs, default hat, etc.).
Open the Starter Files folder, and copy the file contents for the class you'd like to make the new _materials pack with. We will be using the copied files soon enough, but first:
- If you are working on Paint.NET, open the .pdn file, and make sure to delete layers for parts you do not want. Once you've done that, merge all layers with the one with the black background (bottom layer). Keep Paint.NET open, and open GIMP for the next step.
- Open GIMP, and drag-and-drop the .vtf file associated to the class you've copied from the Starter Files folder (demoman_red.vtf, for example).
- The first thing you are going to do is going to the Original Textures folder, open the original demoman_red.vtf (or appropriate texture), and copy the original texture by right-clicking and pressing copy. Then, go back to GIMP, and paste the texture after you click the texture from the Layers tab. This is an important step to not cause further texture compression loss.
- Once that's done, copy the black and white alpha mask you've made on Paint.NET, go back to GIMP, click on the alpha mask from the Layers tab, and paste it. Click anywhere outside the boundaries of the image to confirm selection.
- Now, right-click on the first layer, and make sure that "Show Layer Mask", "Edit Layer Mask" and "Disable Layer Mask" are all unchecked.
- Go to File, and press "Overwrite demoman_red.vtf" (or the appropriate texture filename).
- Do the same thing for the BLU Team variant, utilizing the _blue.vtf texture instead. Make sure to do the same steps by copying the original texture to paste it over on GIMP, and utilizing the same alpha mask.
- Close everything, and now test the new _materials pack by copying the appropriate folders to tf/custom, making sure to respect the folder tree so HLMV can read the new files.
- If you are working on GIMP, open the .xcf file, hide any layer that includes parts you don't want to be visible on the model (by clicking on the eye icon), and merge all visible layers by right-clicking anywhere on the layers list and clicking "Merge Visible Layers..." and pressing Merge.
- Right-click the .vtf file associated to the class you've copied from the Starter Files folder (demoman_red.vtf, for example) from the File Explorer, go to Open With, and select GIMP. If it's not visible from the list, go to Choose Another App -> Choose an app from your PC -> Select GIMP from where you installed it. Press Ok and press Just Once;
- The first thing you are going to do is going to the Original Textures folder, open the original demoman_red.vtf (or appropriate texture), and copy the original texture by right-clicking and pressing copy. Then, go back to GIMP, and paste the texture after you click the texture from the Layers tab. This is an important step to not cause further texture compression loss.
- Once that's done, copy the black and white alpha mask you've made, by going to the first tab open on GIMP, then return to the texture file on the second tab, click on the alpha mask from the Layers tab, and paste it. Click anywhere outside the boundaries of the image to confirm selection.
- Now, right-click on the first layer, and make sure that "Show Layer Mask", "Edit Layer Mask" and "Disable Layer Mask" are all unchecked.
- Go to File, and press "Overwrite demoman_red.vtf" (or the appropriate texture filename).
- Do the same thing for the BLU Team variant, utilizing the _blue.vtf texture instead. Make sure to do the same steps by copying the original texture to paste it over on GIMP, and utilizing the same alpha mask.
- Close everything, and now test the new _materials pack by copying the appropriate folders to tf/custom, making sure to respect the folder tree so HLMV can read the new files.
A couple things to keep in mind:
- Some class textures have the elements very close to each other. If you are seeing floating polygons around the model, you might need to do slight adjustments on the alpha mask by painting some areas pure black (RGB 0 0 0), so they are not visible on the model. Likewise, if a part of the model is not showing, then you need to paint it pure white (RGB 255 255 255). The templates I've created were 1:1 with how they are mapped on the model, but I added a slight outline to make sure no elements have any missing polygons. Due to that, some elements MAY conflict with one or another.
- If you still have the texture open on GIMP, then all you need to do is adjust the alpha mask, you don't need to re-do all the things related to copying the original texture, as long as you don't close and open it again.
- If you require to make class heads appear again, every class (except Pyro) has the heads disabled on the hwm folder. Remove that folder and you'll have the head back. Note that some head-elements for certain classes are not in their head texture and instead are on their general texture, which includes:
- Scout: His Hat, Headset and Dogtags are all on the class texture, while his actual head can be made visible by deleting the hwm folder;
- Soldier: His Helmet and helmet straps are in the class texture, while his actual head can be made visible by deleting the hwm folder;
- Pyro: Pyro's mask are on the class texture, there's no hwm texture;
- Heavy: Heavy's gloves are hidden due to the inclusion of hvyweapon_blue_sheen.vmt and hvyweapon_red_sheen.vmt, delete those files if you wish to make the gloves visible again;
- Engineer: His hardhat are in the class texture, while his actual head can be made visible by deleting the hwm folder;
- Medic: His glasses are in the class texture, while his actual head can be made visible by deleting the hwm folder;
- Sniper: His hat and glasses are in the class texture, while his actual head can be made visible by deleting sniper_head.vtf. To make his entire head (and white shirt) invisible, you will have to replace the contents of the two .vmts inside the hwm folder to:
"VertexLitGeneric"
{
"$no_draw" "1"
}
- Remember, Sniper's white shirt is part of his head texture, so that's why it's not hidden by default. The default texture has his head invisible, however, so if you wish to have both the head and white shirt visible, simply delete the .vtf folder. Sniper has the most complex set of textures and may be a challenge in some cases
- Sniper's lenses are part of another texture. You can restore it by getting rid of sniper_lens.vmt.
- Spy: His cigar is in the class texture, while his actual head can be made visible by deleting the hwm folder.
Some _materials pack I have created are very complex and were done by trial-and-error. Some include the Sniper's shirt files that get rid of the quiver clipping, and the Medic's coat files that leaves only a tiny portion of his lower coat. You may utilize them from my GitHub repository if you need to make any sort of element visible (for instance, including Medic's gloves alongside the lower coat files). In that case, you'll need to be wary of the already existing alpha mask.
Some cosmetic items require to include the $nocull string on their .VMTs (commonly utilized for pants items, such as Blizzard Britches). If you need to change the .vmt from a cosmetic, make sure to also include that modified .vmt from your pack, respecting the folder tree for the cosmetic. If you are doing paints on TFMV, you can add the $nocull files for the RED team by opening the .vmts that TFMV are reading from (tf/custom/TFMV/materials/models...). Add the $nocull string to all the available .vmts, even the _skin0.vmt ones.
After everything is neatly organized in a folder, respecting the folder tree, pack the entire folder to a .zip, and rename it according (HLMV Rotations Page - Medic Lower Coat Files + Gloves (!).zip, for example).
Uploading the Pack
I recommend the following websites to upload your .zip to:
- Your own GitHub repository;
- Dropbox.
Note that Mediafire includes maldvertising and I cannot recommend utilizing Mediafire for that reason.
Linking the Pack
After you have uploaded your pack, you'll have to link it on the Rotations page that you used with for the painted variants or item-skins. On GitHub, make sure you copy the Raw link, by going to your repository, going to the file, and right-clicking on "Raw".