# Intermediate Guide: Material2 & Custom Normals

## **<span data-contrast="auto">Editing .decl Files</span>**

**<span data-contrast="auto">Required Tools:</span>**<span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

- <span data-contrast="auto">**Notepad++** - [Download](https://notepad-plus-plus.org/downloads/ "Download Notepad++")  
    You will need this in order to edit decl files properly.</span><span data-ccp-props="{"134233279":true,"201341983":0,"335559739":160,"335559740":259}"> </span>
- **EternalResourceExtractor by PowerBall253 - [Download](https://github.com/PowerBall253/EternalResourceExtractor/releases/latest)**   
    If you haven't already done so, it is essential that you use EternalResourceExtractor to extract all the game resources. This will give you access to *all* decl files of all kinds, and allow you to see any and every file path to get a greater understanding of where everything is located, which will save you hours of time down the road.

Continuing on from the previous guide, we’re now going to talk about editing decl files, why you would do it, what to modify, and what not to modify. We’re going to go through each set of files you can edit for your texture mods one by one, starting off with the most basic and ending with the most specialized. So here we go!

**<span data-contrast="auto">What are .decl files and what do they do?</span>**<span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

<span data-contrast="auto">Decl files </span>**<span data-contrast="auto">declare</span>**<span data-contrast="auto"> definitions for the game to utilize in establishing functionality on boot. They do everything from telling the game how to make the Slayer animate properly down to simply what things are named in menus. They control particle colors and appearance, what models are assigned to what entities; basically how everything in the game functions is dictated by these files. They’re extremely important, and, as a result, in addition to purely cosmetic purposes, can also be used to cheat.</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}">   
  
</span>

**<span data-contrast="auto">.decl files and the new Mod Injector</span>**<span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

<span data-contrast="auto">As of Mod Injector 6.0, modifying certain .decl files that can be used to cheat in the game will disable Battlemode. It is up to you whether to use mods that alter those files or not and the Eternal Mod Manager will let you know if your mods are safe for multiplayer or not. Now, let us get to the most important .decl files you can use to improve and enhance your projects.</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}">   
  
</span>

**<span data-contrast="auto">Material2 .decl files</span>**<span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

<span data-contrast="auto">Material2 files, at base, declare what textures are assigned to a given part of a model. They exist for all skins of all kinds (Slayer, guns, and demons). These can be modified to assign \*any texture\* to \*any model\* and will match the names of the textures being assigned to that part of the model by default. However, assigning textures to a model not created for that model will result in stretching and wrapping in a way that doesn’t match the shape at all, so instead, we’re going to discuss proper usage for positive results.</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}">   
  
</span>

**<span data-contrast="auto">Slayer files</span>**<span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

<span data-contrast="auto">As we discussed in the previous guide, Slayer skins have textures for every part of the model that they are assigned to. For the sake of simplicity, we’re going to use the Maykr skin as an example. The parts of the models for texture assignment are:</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

```
doomslayer_arm_left 
doomslayer_arm_right 
doomslayer_helmet 
doomslayer_knife 
doomslayer_launcher 
doomslayer_legs 
doomslayer_torso 
```

<span data-contrast="auto">So where do you find these decl files? Regardless of what resource library you’re looking in, all material2 decl files will be located in:</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

`<span data-contrast="auto">generated/decls/material2</span>`

<span data-contrast="auto">Now, it’s very clear what each of these model parts are and the only difference between the HQ and Photo Mode textures is the \_hq suffix in the file name. If you were to replace the Fallen Angel (set41), your textures would be located in:</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

`<span data-contrast="auto">warehouse/customization/characters/doomslayer/set41</span>`  
`<span data-contrast="auto">warehouse/customization/characters/doomslayer_1p/set41</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>`

<span data-contrast="auto">Since this is set41, the textures will be named doomslayer\_arm\_left\_set41\_hq and so on. These are the same names as the material2 decl files and the file path for the textures will also be the same inside the material2 folder:</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

`<span data-contrast="auto">warehouse/generated/decls/material2/models/customization/characters/doomslayer/set41</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"><br></br></span>``<span data-contrast="auto">warehouse/generated/decls/material2/models/customization/characters/doomslayer_1p/set41</span>`

<span data-contrast="auto">If you’d like, you can take some time to locate these files, open them up, take a look at them so you can follow the next sections, and then continue on.  
  
</span>

**<span data-contrast="auto">gameresources or warehouse?</span>**<span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

<span data-contrast="auto">Depending on the skin you have chosen to replace, those textures may be in gameresources, gameresources\_patch1, gameresources\_patch2, or warehouse. If the texture files are in any of the gameresources libraries, it is very likely that the corresponding material2 decl files will be in more than one of them. If this is the case, only the copies in the **highest priority .resources file** will be loaded by the game and actually affect the given skin. [Check this spreadsheet for current resource loading priority](https://docs.google.com/spreadsheets/d/10R5fWKGyqPuCPdueqKeCYycHETSHg0QeFOCbWIQZUCY "DOOM Eternal v6.66 r-1 resource priority").  
  
For example, the material2 decl files for the default skins of every gun are in gameresources, gameresources\_patch1, \*and\* gameresources\_patch2. The only ones you want to modify and replace are the copies in **gameresoures\_patch1**, because it is the highest on the resource priority list. </span><span data-contrast="auto">If you have chosen a skin in warehouse, the corresponding material2 files will be there or in warehouse\_patch1. </span>

<span data-contrast="auto">We will now discuss both what you can modify and what you \*should\* modify to get the job done.</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}">   
  
</span>

**<span data-contrast="auto">material2 modification</span>**<span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

<span data-contrast="auto">The text of these decl will look similar to this:</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

```
{ 
inherit = "template/pbr_gun"; 
edit = { 
	RenderLayers = { 
		item[0] = { 
			parms = { 
				heightmap = { 
					filePath = "textures/system/constant_color/grey_md.tga"; 
					options = { 
						type = "TT_2D"; 
						filter = "TF_DEFAULT"; 
						repeat = "TR_REPEAT"; 
						format = "FMT_BC1"; 
						atlasPadding = 0; 
						minMip = 0; 
						fullScaleBias = false; 
						noMips = false; 
						fftBloom = false; 
					} 
				} 
				smoothness = { 
					filePath = "art/weapons/combatshotgun/skins/hotrod/combatshotgun_barrel_g.tga"; 
				} 
				normal = { 
					filePath = "art/weapons/combatshotgun/skins/hotrod/combatshotgun_barrel_n.tga"; 
				} 
				specular = { 
					filePath = "art/weapons/combatshotgun/skins/hotrod/combatshotgun_barrel_s.tga"; 
				} 
				albedo = { 
					filePath = "art/weapons/combatshotgun/skins/hotrod/combatshotgun_barrel.tga"; 
				} 
			} 
		} 
	} 
	Parms = { 
		wetnessdroptiling = 4; 
	} 
	SurfaceType = "SURFTYPE_METAL"; 
} 
} 
```

<span data-contrast="auto">This is the combatshotgun\_barrel material2 file for the Hot Rod Shotgun skin. The primary section to focus on first is the “parms” at the top, specifically the fields titled heightmap</span><span data-contrast="auto">, </span><span data-contrast="auto">smoothness, normal, specular, and albedo. You will notice that the primary purpose of this file is to assign the textures of this skin by </span>*<span data-contrast="auto">declaring</span>*<span data-contrast="auto"> the file paths for each of them. These are, typically, what you will modify and what we will cover first.</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}">   
  
</span>

## Modifying File Paths 

<span data-contrast="auto">It is always recommended that you replace weapon skins in warehouse.resources. There are two reasons for this:</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

1. <span data-contrast="auto">If you are declaring different file paths, it is pointless to do so for textures replaced in the gameresources libraries.</span><span data-ccp-props="{"134233279":true,"201341983":0,"335559739":160,"335559740":259}"> </span>
2. <span data-contrast="auto">The combined file size of mods injected into warehouse.resources is far greater than that of the gameresources libraries. This is because all three libraries are actually all part of the same ‘mapresources’ library, common.mapresources. This means that common.mapresources has a far greater initial load and is far less tolerant of increased size. In contrast, warehouse.resources is the only resources library in the warehouse.mapresources library and will tolerate significantly more.</span><span data-ccp-props="{"134233279":true,"201341983":0,"335559739":160,"335559740":259}"> </span>


<span data-contrast="auto">So why would you want to modify file paths? Well, the majority of skins located in warehouse are from event series and, thus, many players who recently purchased the game could very easily not have access to the skin you are replacing. As a result, you will want to change the file paths for a base campaign skin such as Crimson, Midnight, or even Default so that it will use the textures for said event skin and all players who have not unlocked that skin will be able to use your mod. (NOTE: If you are editing the Skullface skin, one of the Maykr skins, or any other skin that has a completely different model, you cannot reassign it to a campaign skin using this method. The method for doing so will be covered in the advanced guide if you want to skip this method and continue there. For all default-style skins, however, that method will typically not be necessary and you may use either based on your personal preference).</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

<span data-contrast="auto">So, how is this done? Well, let’s return to the Hot Rod Shotgun skin and use it here as well. If you return to the example, you will notice that the file paths declared always start with the names of folders within the resources libraries and do not begin with the name of the resource library itself. This is because if a folder path is not located in the resource library, it will search the others to locate it in order of load priority. [Check this spreadsheet for current resource loading priority](https://docs.google.com/spreadsheets/d/10R5fWKGyqPuCPdueqKeCYycHETSHg0QeFOCbWIQZUCY "DOOM Eternal v6.66 r-1 resource priority").</span>

<span data-contrast="auto">This load priority will be relevant in the advanced guide, but for now, you can ignore it. However, each given resource library will always search </span>*<span data-contrast="auto">itself </span>*<span data-contrast="auto">first, as you would expect. The Hot Rod skin is located in warehouse and, thus, the corresponding decl files will search warehouse, find the textures in the declared file paths, and assign them to the model. However, if you were to modify a decl file in gameresources\_patch2 for a Shotgun skin located in common.mapresources to the file path for the Hot Rod skin, it would fail to find it in gameresources\_patch2, eventually search warehouse, and load those textures. For the purposes of this guide, we will use the default Shotgun skin. The declared file paths of the default combatshotgun\_barrel file (combatshotgun\_barrel.decl located in gameresources\_patch2/generated/decls/material2/art/weapons/combatshotgun) will look like this:</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

```
smoothness = { 
	filePath = "art/weapons/combatshotgun/combatshotgun_barrel_g.tga"; 
} 
normal = { 
	filePath = "art/weapons/combatshotgun/combatshotgun_barrel_n.tga"; 
} 
specular = { 
	filePath = "art/weapons/combatshotgun/combatshotgun_barrel_s.tga"; 
} 
albedo = { 
	filePath = "art/weapons/combatshotgun/combatshotgun_barrel.tga"; 
} 
```

<span data-contrast="auto">“Smoothness” will correspond to your “glossiness” layer in Substance Painter if you are using it for your textures (\_g). Normal and Specular are self-explanatory, but “albedo” refers to your Diffuse layer. So, we will now modify the parms to use the Hot Rod textures instead, which will make them identical to the parms of the Hot Rod decl file:</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

```
smoothness = { 
	filePath = "art/weapons/combatshotgun/skins/hotrod/combatshotgun_barrel_g.tga"; 
} 
normal = { 
	filePath = "art/weapons/combatshotgun/skins/hotrod/combatshotgun_barrel_n.tga"; 
} 
specular = { 
	filePath = "art/weapons/combatshotgun/skins/hotrod/combatshotgun_barrel_s.tga"; 
} 
albedo = { 
	filePath = "art/weapons/combatshotgun/skins/hotrod/combatshotgun_barrel.tga"; 
}  
```

<span data-contrast="auto">The main drawback to this method is that your textures will replace </span>*<span data-contrast="auto">both</span>*<span data-contrast="auto"> the textures for Hot Rod </span>*<span data-contrast="auto">and</span>*<span data-contrast="auto"> Default. However, since you are doing this for the benefit of those that do not have the Hot Rod skin, it can be entirely forgiven. To inject these decl files, you will create the file path gameresources\_patch2/generated/decls/material2/art/weapons/combatshotgun, place the files in this new combatshotgun folder, add the gameresources\_patch2 and inject! Your skin will now replace the default skin and be usable for everyone! For most skins, this is all that will be required. For this method, there is no need whatsoever to ever inject custom normal maps. The vanilla normals will work just fine for your purposes. However, if you are using Substance Painter and you have added additional detail from the skin you have created, you may want to use your own custom normal maps. For those of you to whom this applies, continue on to the second half of this guide.</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}">   
  
</span>

## Custom Normal Maps<span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

**Required Tools:**

- <span data-contrast="auto">**SAMUEL by SamPT - [Download](https://github.com/brongo/SAMUEL/releases/latest "Download SAMUEL")** To ensure the best possible results, you will want to use SAMUEL to specifically extract Normal Maps. This is due to encoding that will be explained briefly. For all other textures, VEGA will do the trick, but you may elect to use SAMUEL for all your textures and simplify the process.</span><span data-ccp-props="{"134233279":true,"201341983":0,"335559739":160,"335559740":259}"> </span>
- <span data-contrast="auto">**VEGA by DTZxPorter (optional) - [Download](https://wiki.modme.co/wiki/apps/Vega.html "Download VEGA")** See above.</span><span data-ccp-props="{"134233279":true,"201341983":0,"335559739":160,"335559740":259}"> </span>
- <span data-contrast="auto">**GameImageUtil by Scobalula - [Download](https://github.com/Scobalula/GameImageUtil/releases/latest "Download GameImageUtil")** You will use this program on normal maps extracted by SAMUEL to make them usable in Substance Painter.</span><span data-ccp-props="{"134233279":true,"201341983":0,"335559739":160,"335559740":259}"> </span>
- <span data-contrast="auto">**Substance Painter/Photoshop** You will use either one of these programs or both to create the modified Normal maps.</span><span data-ccp-props="{"134233279":true,"201341983":0,"335559739":160,"335559740":259}"> </span>
- <span data-contrast="auto">**Auto Heckin’ Texture Converter by PowerBall253 - [Download](https://github.com/PowerBall253/AutoHeckinTextureConverter/releases/latest "Download Auto Heckin' Texture Converter")** You will use this to convert your Normal maps from Substance Painter to work properly in game.</span><span data-ccp-props="{"134233279":true,"201341983":0,"335559739":160,"335559740":259}"> </span>




<span data-contrast="auto">Before we get started, I will give a brief history of modifying normal maps for Doom Eternal, as it will help you better understand file formats, which is helpful information for best understanding the whole process. At the beginning of texture modding, we found that textures (aside from Normal Maps), need to be encoded as "BC1a" DDS files before using Divinity Machine (now a part of the Texture Converter) to make the TGA files for injection. As a result, VEGA extracted all image files (including Normal Maps) as BC1a and Divinity Machine encoded them as BC1a for injection as well. Normal Maps produced by this process looked visually identical to the Normal Maps from the game in terms of the dark red and green hues, but they would break in game, resulting in terrible, inconsistent lighting.</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

<span data-contrast="auto">To compensate for this undesired outcome, a time-consuming, complicated process was devised involving Blender and Photoshop to brighten the hues of red and green, which actually caused them to work in game. So why was this the case?</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

<span data-contrast="auto">The red and green in Normal Maps are not processed as colors. Instead, a complex algorithm converts them to information that is used by the game to simulate lighting and reflections. This is why the encoding format and hues of the Normal Map are critical. The process we used for the majority of a year, however, created a problem of its own: Compressed Normal Maps that produced pixelation and loss of information, making shiny surfaces look choppy and wavy; a complete mess. We spent months trying to fix this issue to no avail. However, a solution was eventually discovered and, as it turned out, that solution was impossible for us to find where we were looking because it happened at the beginning before our process of extraction even began.</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

<span data-contrast="auto">As mentioned at the beginning, VEGA was extracting Normal Maps as BC1a because it was deduced that they must be BC1a because all other textures required BC1a encoding. This was, however, completely wrong. The normal maps, in fact, required BC5 encoding to work properly and, as of now, SAMUEL is the only app that will give this proper encoding. With it, there is no more damage to the Normals or loss of information at the outset and, using the process which I will now outline, will not be lost in the end product you see after injection.</span><span data-ccp-props="{"201341983":0,"335559739":160,"335559740":259}"> </span>

**Creating Your Custom Normal Maps**

1. <span data-contrast="auto">Use SAMUEL to extract your desired Normal Maps. You will notice that these normal maps are in only red and green, which is what Doom Eternal uses. However, they will also require blue in order for Substance Painter to use them properly and, later, export them in a usable state (to understand how to properly utilize and export normal maps in Substance Painter, make sure to watch the tutorial video also posted on this wiki).</span><span data-ccp-props="{"134233279":true,"201341983":0,"335559739":160,"335559740":259}"> </span>
2. <span data-contrast="auto">Run GameImageUtil. In the drop down at the top, select the last option: “XY.” Drag and drop your DDS BC5 Normal Map onto the app window and it will export a BC5 PNG with blue added in the same folder as your DDS image.</span><span data-ccp-props="{"134233279":true,"201341983":0,"335559739":160,"335559740":259}"> </span>
3. <span data-contrast="auto">Run Substance Painter. Import your Normal Maps, create your skin, and then export your customized Normal Maps (PNG).</span><span data-ccp-props="{"134233279":true,"201341983":0,"335559739":160,"335559740":259}"> </span>
4. <span data-contrast="auto">Open your PNG file in Photoshop and save it with DDS encoding. Whether you are using a simple Intel plugin or the NVIDIA encoder, select “8 bit BC5” from your list of options and save the file with the appropriate name (e.g., combatshotgun\_barrel\_n.dds for the example in the previous section).</span><span data-ccp-props="{"134233279":true,"201341983":0,"335559739":160,"335559740":259}"> </span>
5. <span data-contrast="auto">Drag and drop your DDS file onto the Auto Heckin’ Texture Conerter .bat file and it will convert it to a BC5 .tga file ready for injection. Congratulations! You’ve just created your own custom Normal Map and, when paired with the material2 replacement method, it’s now available for everyone to use!</span><span data-ccp-props="{"134233279":true,"201341983":0,"335559739":160,"335559740":259}"> </span>





<span data-contrast="auto">Coming up in the Advanced Guide, we will discuss a more complex method for assigning event textures to campaign skins and taken on the most complicated process of all: Adding new custom assets. See you there!</span>