Texture modding: Difference between revisions

From OuroDev
pc>Log
No edit summary
m 16 revisions imported: Importing Portal Corps Wiki pages and history - Feb 6, 2020
 
(No difference)

Latest revision as of 11:02, 6 February 2020

A collection of information about textures; and how to edit and replace them/client side modding.

General information

The size of existing textures is hard coded and can currently not be changed (9/6/2019). Meaning, a texture cannot simply be replaced by one of a bigger resolution.

Updated and new textures should not be considerably bigger than original game ones due to the age of the game and its memory handling. This might changed once the game runs on 64bit

And 3rd, purely practical: The way to get the existing assets is by exporting the existing texture files, which are compressed DDS. The quality is often horrible. I tried upscaling and going through bouts of blurs and smart sharpens, but you just don't get a decent quality. So it's a lot of repainting by hand and that's a pain. Happy to be proven wrong on this


Understanding CoH textures

File:Textures.jpg

The Saturation mask, as I call it (I'm sure there's a pro term) controls how much skin color applies to the diffuse map. Black is 100% color, white is none.

File:Textures2.jpg

Diffuse map with white, 50% black and black alpha layer

File:Textures3.jpg

Normal map with white, 50% black and black alpha layer

Texture Naming

Naming Conventions

CoH player costume files have a multitude of naming conventions, depending on the artist at work. Player costume parts without name additions are assumed to be for a male (and usually huge) body type. Female costume parts are specified by the _fem suffix. This separation is usually only necessary for chest and hips due to different UV maps, and any other costumes using unique body parts (eg. high heels).

Suffix Alternatives Meaning
_fem Female costume part
_huge Huge costume part
_skin This tells the game that the second color of this texture should be the skin color of the character.
_B _D Diffuse Map
_N _NM; _Normal; _BM Normal Map/Bump Map
_DC Dual Color (Costume part specific pattern)
_MK _Reflection Reflection Map, used for shaders (chrome, etc)
_G _Glow; _AG Tintable glow mask
_MU ?
_M Multiply base
_AO Ambient occlusion? (used in Gunslinger)


Naming Rules

Going forward, it'll be essential to name new costume pieces well to make them easy to understand for all users.

It breaks down as an easy formula:

Individual costume parts

[Costume part location](_fem/huge)(_skin)_[Costume part name](_version)_[Texture type].texture

For example, the normal map of the 2nd variation of Hippie gloves would be called Gloves_Hippie_02_NM.texture


Costume Sets

Complete costume sets should be kept together to be easily identified.

(Unique identifier_)[Set Name]_[Body Part](_fem/huge)(_skin)(_version number)_[Texture type].texture

Artist Bobo has created a Caveman set and wants to tag it as his. The boots show skin and are different for female heroes. The diffuse map would be called: Bob_Caveman_boots_fem_skin_B.texture


Editing textures

This is assuming you're using Adobe Photoshop.

  1. Download and install Photoshop DDS plugin
  2. Start Pigg Viewer Pro and browse to your [CoH main folder]\piggs folder
  3. Find the texture you want to work with
  4. Right-click desired texture, choose Extract, choose DDS format
  5. Open DDS file in Photoshop
  6. Edit texture as desired
  7. Save as DDS. If your texture has an alpha layer, make it DXT5 interpolated alpha. Files without alpha layer, like patterns or masks are DXT1.
  8. Open Pigg Viewer 1.61. Find the texture you want to replace, right-click, Create .texture from DDS. Select folder [CoH main folder]\data. Create if necessary.
  9. Start up game, find changed item

CoH does not always like it when you change textures while the game is running, especially normal maps. You might have to restart for each change.


Detailed Guide by Flashtoo

What you can do:

  • Change some aspects of existing graphics that you find undesirable (e.g. if you don't like the built-in lipstick on the female Steampunk and Sci-Fi faces you can remove it).
  • Remove effects that you dislike from the game by replacing them with "blank" images.
  • Replace a graphic with a completely different one, if you don't mind it being replaced across the board - I remember that back on Live there were some people who replaced the female "Leather" top-with-skin with the Carnie corset this way, before players were given access to it as its own costume piece.

What you cannot do:

  • Increase texture resolution. Altered textures will not render unless they have the same pixel dimensions as the original.
  • Add new effects, such as glowing or mirror-shine, to items that did not have them before.
  • Add new costume parts or base items. Without access to the game's code, we can only overwrite what is already there.


You will need:

  • Pigg Viewer Pro for finding the textures you want to replace in the archives. Technically this isn't strictly necessary but it does make things much, much easier, as Pro will show you the contents of all .pigg archives at once while the other Pigg Viewer will not. I also find that its preview function actually works, which I can't say about the other Pigg Viewer.
  • Pigg Viewer v1.61 for extracting the textures in .dds format and converting back to .texture after modifying. This is the ONLY program out there that can do this for you without hex editing. Pigg Viewer Pro can only extract a texture out of a .pigg in .texture form, which is not something that can be edited in a typical graphics program.
  • A graphics program capable of opening and saving .dds (I use Photoshop with NVidia's texture tools).
  • Some means of generating a bump map (NVidia's texture tools include a normal map plugin for Photoshop that does this, but there are other means. Use what you like best.)


For learning and practice, let's modify the Valkyrie cape.

1. Finding Your Textures

Start up Pigg Viewer Pro and choose File->Open Directory from the menu bar. Navigate to the "Piggs" folder in your CoH install directory and hit OK. A file tree should appear in the left-hand section of Pigg Viewer's GUI showing the contents of all the CoH .pigg archives. What we want to poke around in is the folder called texture_library.

Coming in blind, you probably don't know exactly which folder your desired textures are in - there are a lot of subfolders in texture_library and not everything is right where you might expect it to be. Graphics used for powers and other effects (missiles, goo, fire, etc) tend to be in the FX folder; icons for powers/inspirations/enhancements/etc are in GUI, most base items and world objects (paintings, doors, traffic lights, etc) are in WORLD, weapons and shields are in ITEMS, and costume parts other than most weapons and shields are spread across several folders mostly (but not completely!) grouped by age and whether they are shared by players and NPCs. As a rule of thumb when you're looking for costume part textures:

"PLAYERS" contains a lot of the older/simpler parts. "V_PLAYERS" and "N_CHARACTERS" has a lot of the newer stuff, including most of the parts taht were in super packs and given as veteran rewards. "ENEMIES," "NPCS," and "V_ENEMIES," as well as the "N_NPC" subfolder of "N_CHARACTERS" are mostly used by NPCs, but there are a few parts that are shared by players in there such as Black Knight and Talons parts so it's worth a look if you can't find a piece in the other folders (or if you're looking for NPC parts in the first place).

If you have the time and inclination it's worth it to have a look in pretty much every folder inside texture_library! However, to save you the time of searching for it, the Valkyrie cape is located in V_PLAYERS/AVATAR/Super_Shared/Capes.

There are four textures: Cape_Valkyrie_01, Cape_Valkyrie_01_Bump, Cape_Valkyrie_01_Mask, and Cape_Valkyrie_01_Reflect. Clicking on each of them will show you a preview on the right side of the Pigg Viewer Pro window and a list of properties at the bottom of the window. The properties tell you which .pigg archive contains the textures: these are in stage1d.pigg. You can close Pigg Viewer Pro now as you don't need it anymore.

2. Extracting Your Textures

This is where we start up the other Pigg Viewer. Once you get the program to run (it doesn't play nice with modern operating systems and needs some coaxing), choose File->Open, navigate to the piggs folder in your CoH install directory, and select the .pigg that contains your textures (stage1d.pigg this time). A file structure should appear at the left side of your Pigg Viewer window, like before, but containing only what's in that particular .pigg archive.

Find your textures (Cape_Valkyrie_01, Cape_Valkyrie_01_Bump, Cape_Valkyrie_01_Mask, and Cape_Valkyrie_01_Reflect) in the file structure. One at a time, right-click them and choose "Extract As DDS." You may get error messages here - click Continue on them; they don't affect the extraction. After clearing the error message if you got one and clicking Extract As DDS, you should have a Save As window - navigate to a folder, or create a new one, where you will keep your working documents and save your textures there.

3. Understanding Textures

This is where it helps to have some working knowledge of how 3D models display textures, to know what you're looking at. In these four files, we have a diffuse texture, a grayscale map, a bump map, a gloss map, a specular map, a color mask, and a transparency channel. A quick and dirty breakdown of what's what:

Cape_Valkyrie_01.dds is the diffuse texture. The diffuse texture is the 'basic' texture of the object - what shows up as light or dark, or tinted in a particular way, regardless of what colors we choose in the costume creator.

Cape_Valkyrie_01.dds has an alpha channel that contains the grayscale map. This is used to "block out" parts of the object when we choose custom colors - the brighter an area is, the more of the diffuse texture will retain its original appearance regardless of what colors we pick in the CC. The Valkyrie cape is very dark all over, meaning all of it can be custom-colored - if an item's grayscale map has parts blocked out in very light shades, those parts will not take a custom color, such as the gold trim on the male Steampunk coat. Cape_Valkyrie_01_Bump.dds is the bump map. This blue texture instructs the game's rendering engine on how light should reflect off an object, creating the illusion of a more detailed model while still keeping things low-poly.

Cape_Valkyrie_01_Bump.dds has an alpha channel that contains the specular map. The specular map dictates how much light should reflect from a surface - brighter equals more light reflected. It works in tandem with the bump map to help create a realistic surface, especially where multiple materials are involved. You can see on the Valkyrie cape that the fabric part at the top is a dark color, because it is relatively matte fabric, whereas the metallic eagle pattern is very bright wherever the light would hit it the hardest. Crevices and shadows between the layers are also dark, because the light would hit there less and therefore reflect less.

Cape_Valkyrie_01_Mask.dds is the color mask. This tells the CC what parts of the object should be the "primary" color in white and what parts should be the "secondary" color in black. Gray indicates a mixture of the two colors. When dealing with 'with skin' costume parts such as the Bioluminescence chest pattern, white is the skin color and black is the primary color. Cape_Valkyrie_01_Mask.dds has an alpha channel that contains the object's transparency. White indicates fully opaque, black indicates fully invisible, and shades of gray indicate translucent areas. The darker it is, the more transparent it is.

Cape_Valkyrie_01_Reflect is the gloss map. This is a texture that shows what parts of a metallic or otherwise very shiny object should be most mirror-like. The darker an area of this texture is, the more glossy it will look - this is the opposite of what most guides will tell you; apparently CoH does this one backwards! Not every item has a gloss map, but the Valkyrie cape does, and you can see the darkest part is the eagle design - the glossiest part of the cape - while the 'scales' or 'feathers' of the cape's tail are gray, indicating moderate gloss. The top, where the fabric of the cape is, is solid white, indicating a matte surface. Brighter=more scatter, darker=less scatter.

There another type of texture that is frequently used in CoH as well which the Valkyrie cape does not have: the emissive map or "glow map." This is found on objects that have natural luminosity, such as the Organic Armor and Elemental Order parts. These textures show which parts of an object seem to glow with their own light, and how brightly.

4. Modifying and Saving The Textures

Open the textures in your graphics program of choice. Remember, if you alter one texture on an object, you will probably have to alter all of them - otherwise you will end up with shadows in the wrong place or shiny parts that should be matte, things like that. NVidia's Normal Map Filter will help you generate new bump map textures.

For this exercise, I will be changing the eagle design on the Valkyrie cape to have only one head. The more artistically inclined of you can go ahead and experiment with some other changes, but for those who are just here to learn how to use the tools (see also: the point!) I've included a .zip with my altered textures in .tga format. You can open them up and look at them, compare them to the originals, etc - then save them as .dds.

The important part of this step is how to save - you must save as DDS with DXT5 compression in order for them to work properly on conversion. The exception is textures without alpha channels, which may be saved as DXT1 if DXT5 doesn't work, but it usually will. When you save as .dds with NVidia's plugin you will get a dialogue box that allows you to select this. It is also a good idea to save an extra copy in .tga, .bmp, .png or some other lossless form, as .dds introduces artefacts like .jpg which you won't want in your source files if you want to go back and make further changes later, to avoid accumulating visual corruption.

5. Putting Your Changes Into Action

Back to Pigg Viewer 1.61.

The process here is similar to how you extracted the original textures: Open the .pigg that contains the textures and navigate to them and right-click your first texture. Begin with the diffuse texture (Cape_Valkyrie_01; the diffuse texture and grayscale map). This time, after clearing the error message, choose "Create texture from .dds." You will receive a window similar to an Open dialogue - choose your altered version of Cape_Valkyrie_01 and click Open.

You should now see a window titled "Browse For Folder" containing a file tree, to choose a location to save the converted textures. It is always safest to make a new folder to save your modded textures into at first; this makes sharing easier as well. Repeat this for each of your modded textures (you can put them all in the same folder). Pigg Viewer will save the texture into that folder and will generate the entire path for you, beginning with texture_library - copy this texture_library into your CoH install's Data folder to put your new textures into the game.

6. Testing

Fire up your game. Find the thing you just replaced. See if it works the way you expected it to.

Right away we can see that something is amiss: while the eagle was facing to the right in our texture files, you can see it has been flipped horizontally on the character and is facing to the left! Now that we know it will render the texture as a mirror image, we can fix our texture files to make it appear the way we meant it to.

Open each of the .tga files again, fix your issues (in this case, flip them horizontally), and save. If you have left Pigg Viewer running, you will receive an error message telling you the file is still open and it will not save, so you must either close Pigg Viewer or save with a new file name.

Repeat step 5 with your fixed textures. Do they work as intended now? Yes? Awesome! No? Keep polishing and fine-tuning by repeating steps 5 and 6 until you are happy!


Resources

Pigg Viewer v1.61

Use this to export and import DDS files. Might have to be run in WinXP compability mode.

https://mega.nz/#!JHRRFKzL!9LgzUNVWln2SRvjjkyl3uz9lfr4EQJiym0723v3HX7I


Pigg Viewer Pro

Easier tool for browsing. Use this to find the textures you want, use 1.61 to export/import. Alternatively, use the Perl script Texture Converter to import if alterations require new header information.

https://mega.nz/#!dXJ1AYKb!fXb-omyssE2KJLhp4z618TeRtRpOdANsbY9D5tSMEnY


Photoshop Nvidia DDS plugin

https://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop


Female Chest UV map

File:CoH Female Chest layout.png

by arthurh3535