# Material Editor

A model is rarely one surface. A jacket can be leather, cloth and a metal zip, and each part has its own shader, texture maps and settings. The **Material Editor** lists every material in an item's model and lets you change its shader, its texture maps, when it is drawn, and its parameters. The **Normal & spec maps** window makes normal and spec maps from the garment's own diffuse texture and writes them into the model the way GTA V's own clothing has them.

:::hint{type="info" title="Premium"}
The Material Editor and the normal and spec map generator are **Premium** features. Both reading and writing materials need Premium.
:::

## Opening it

- In the item panel, click the **Materials** tool tile (*Shaders and maps*).
- Right-click an item and choose **Edit materials…**.
- In the [Model Studio](/cloth-tool/about-the-tool/model-studio), switch to **Materials** (key 6) and press **Open the Material Editor**. Apply or undo your mesh edits first, because the editor writes the model on disk.

## The window

On the left is one row per material, named by its shader and number. A material whose shader the tool cannot name shows as **Unnamed shader** with its hash. A row you have changed is marked **edited**. Pick a material to edit it on the right.

### Shader

There are two ways to change a material's shader. They do different things.

- **Rename** points the material at a different shader and changes nothing else. Type a name into **Shader name** (known names are suggested) and confirm it. Use this when the parameters are already right and only the shader variant is wrong. The common case is `normal_spec` against `cloth_normal_spec`. If you type a name the tool does not know, it is still written, with a warning to check it in game.
- **Replace with template** rebuilds the material from a known-good set. Textures whose slot still exists are kept. The templates are: **Default** (diffuse only), **Normal** (diffuse + bump), **Spec** (diffuse + specular), **Normal Spec**, **Normal Detail**, **Normal Spec Detail**, **Normal Spec Reflect**, **Emissive**, **Cloth Default** and **Cloth Normal Spec**. **Keep current** leaves the shader alone.

:::hint{type="warning" title="Prefer Rename when the material is already correct"}
A template drops any parameter it does not know, such as wrinkle masks and palette selectors. **Normal Spec** is the usual choice for clothing when you do want a clean rebuild.
:::

### Render bucket

The **Render bucket** sets when the game draws the surface:

| Bucket | Use |
| --- | --- |
| 0 · Opaque | Solid fabric. The default. |
| 1 · Alpha blended | Soft transparency. |
| 2 · Alpha tested | Cut-outs such as lace or mesh. |
| 3 · Water | Not for clothing. |
| 4 · Displacement | Not for clothing. |

Anything with transparency needs bucket 1 or 2. Left on 0, it renders solid black where it should be see-through.

### Textures

The maps the shader uses are grouped as Diffuse, Normal, Specular, Detail, Tint, Environment and Other. For each one you can:

- **Choose…**: pick an image (.ytd, .dds, .png or .jpg) to embed into the model as that map.
- **✕**: remove the map from the material.
- **Rename** (pencil): change the texture name the shader looks the map up by. It must match what the .ytd contains.

Maps already packed in the model are marked **embedded**.

### Settings

The shader's single-value parameters (specular power, detail scale and so on) are sliders. Values with several components are shown read-only. The defaults are safe, so only change them if you know the shader.

### Applying

Changes are held until you press **Apply** (it reads **Apply to *n*** when several materials have changed). The model in your project is then rewritten in one go, and the result tells you how many materials were updated and how many textures were embedded. There is no undo inside the editor. To go back, make the opposite change.

:::hint{type="info"}
The 3D preview shows the diffuse only. Shader, normal and specular changes show in game.
:::

## Normal and spec maps

Many custom garments ship with a flat normal map and no real spec map, so they look like plastic in game. The generator makes both from the diffuse texture, calibrated on the game's own clothing maps.

:::steps
### Open it
In the item's **Textures** panel, click **Maps** in the header. The **Normal & spec maps** window opens.

### Pick the source
Under **From the texture**, choose the texture variant to work from. Four previews show the **Diffuse**, a **Lit preview** (move the pointer to move the light), the **Normal** map and the **Spec** map.

### Tune the normal map
Leave **Write the normal map** on. Adjust **Strength**, **Detail size**, **Soften** and **Dark is raised**. Detail size removes the shading painted into the picture so only the fabric's relief is left. Choose a size: 256², **512²** (what vanilla clothing uses) or 1024² (four times the memory).

### Tune the spec map
Leave **Write the spec map** on and pick the fabric: Cotton, Denim, Knit / wool, Nylon / sport, Leather, Satin / silk, Vinyl / latex, Metal or Skin. Then set **Shine** and **Follows the fabric**. Choose a size: 128², **256²** (the vanilla size) or 512².

### Write them
Press **Write into the model**.
:::

How the maps are written:

- They are embedded in the model the way freemode does it: the normal map as DXT1 (green down) and the spec map as DXT5 (R intensity, G gloss), with mips down to 4×4 and power-of-two sizes.
- They are bound to the bump and spec slots of every ped material in the model. The diffuse in the .ytd is not touched.
- Making them again **replaces** the earlier maps without asking.
- The generator never changes a shader. A material without normal or spec slots keeps its look. Switch it to a normal/spec shader above if you want it to use the maps.

### Generated maps or your own?

- **Use the generator** when the garment has no real maps, or has flat ones from an export. Woven and printed fabric gives the best results, because the relief the generator finds is really there.
- **Use your own maps** when you baked them from a high-poly sculpt or painted them in Substance 3D Painter. Assign them with **Choose…** in the Material Editor instead. Generated maps cannot add folds that the diffuse does not show.

## Related pages

- [Model Studio](/cloth-tool/about-the-tool/model-studio): mesh editing, where the Materials mode opens this editor.
- [Items and Textures](/cloth-tool/about-the-tool/items-and-textures): texture variants and the Textures panel.
- [Texture Optimization](/cloth-tool/about-the-tool/texture-optimization): shrinking textures, including those embedded in models.
