# 3. Decal Materials and Atlases
Part of [[Decals and Environment Detail]]. Previous: [[2. Environment Detail and Set Dressing]]. Next: [[4. Runtime Bullet Holes and Scorch Marks]].
> [!note] Sources
> Toggle names and the Draw Order range come from `UniversalDecalSubTarget.cs` in the URP 17.5.0 package source. The batching and atlas guidance is from the 6000.5 URP decal manual page. No material here was built.
## 3.1 The decal material type
A Decal Projector needs a material whose shader is a **Shader Graph with the Decal material type**. `Shader Graphs/Decal` is the built-in one. To make your own, use **Create → Shader Graph → URP → Decal Shader Graph**, or the projector's **New → ShaderGraph Decal** button.
In the Graph Inspector's target settings:
| Toggle | What it writes | Notes |
|---|---|---|
| **Affect BaseColor** | Colour, with alpha as blend | Almost always on |
| **Affect Normal** | Normal | Bullet holes, cracks and scratches read through lighting, not colour. Turn this on for them |
| **Blend** (Affect Normal Blend) | Blends the decal normal with the surface normal instead of replacing it | Keeps the wall's own bumps visible under the decal |
| **Affect MAOS** | Metallic, AO and smoothness from a mask map | Wet puddles (high smoothness), rusty patches. **DBuffer only** |
| **Affect Emission** | Self-lit colour | Glowing runes, hot scorch marks |
With the **Screen Space** technique (Quest), decals can't blend each surface property separately (part 1). Design those decals as colour plus, optionally, normal. Make puddles read by colour and a reflection probe rather than by MAOS smoothness.
**Draw Order** (−50 to 50) shows on the material and resolves overlaps.
## 3.2 Why atlases
From the URP manual: decals **don't use the SRP Batcher**, by design, because each projector feeds its values through a material property block. They batch through **GPU instancing**:
- every decal that uses **the same material** with **Enable GPU Instancing** ticked can be drawn in one instanced call.
- so put many decal images into **one texture (an atlas)** and pick a cell per projector with **Tiling/Offset** (`uvScale`/`uvBias`).
One atlas material for all runtime impacts means bullets, blood and scorches cost one instanced batch (per technique pass) instead of one draw each.
## 3.3 Build the atlas
1. In your image editor, make a square texture (for example 2048²) as a **4 × 4 grid**. Number the cells **left to right, top to bottom**, starting at 0, which is how `DecalAtlas` (part 4) numbers them:
- 0–3: bullet holes (four variants)
- 4–7: blood splats
- 8–9: scorch marks
- 10–15: spare
2. Leave a **transparent border** of at least 8 px inside each cell. Mip-mapping blurs neighbouring cells together at a distance, and the border keeps them apart.
3. Paint the colour with alpha. If you want **Affect Normal**, make a matching normal-map atlas with the same layout.
4. Import settings: **Wrap Mode = Clamp**, mipmaps **on**, sRGB on for colour and **off** for the normal map (Texture Type: Normal map).
## 3.4 The material
1. **Create → Material**, shader `Shader Graphs/Decal`. Name it `M_ImpactDecalAtlas`.
2. Assign the colour atlas (and the normal atlas).
3. Tick **Enable GPU Instancing**. This is the step most projects forget.
4. Keep this one material for every runtime impact decal. Authored environment decals can use a second atlas material, also instanced.