Scratches Generator
Procedural wear without touching a sampler
- scratches
- height
Scratches are the fastest way to make a material stop looking like plastic, but generating them with a diffusion model is overkill and a lot of VRAM. Scratches Generator just draws them. It's a pure procedural node: give it a canvas size, a density, and a seed, and it paints a field of scratch lines on a black background. No model, no weights, no sampling - it's the kind of utility you reach for when you want a wear plate to multiply into a roughness or metallic map.
How it works
The generator picks a random start point for each scratch, a random length between length_min and length_max, and a random angle. angle_variation controls the angular spread - 0 makes every scratch vertical, 180 means all directions. Each line is rasterized with a soft-edged falloff at intensity brightness and a pixel width set by width_scratch. The number of scratches is width × height × density / 10000, so it scales with pixel area - quadruple the pixels and you get four times the scratches.
It outputs two things:
scratches- white lines on black, ready to multiply into roughness or use as a wear mask.height- the same scratches as a height field (1 - scratches * 0.3), so grooves read as darker indentations. Wire it into a height input or a height-to-normal converter if you want actual geometry.
The seed input makes the pattern reproducible, which matters when you're iterating on a material set and want the same scratches on the albedo and the roughness map.
What to set first
Density is the one that shapes the result most - 0.3 is a light scuff, 0.8 is a heavily beat-up surface. intensity is brightness, not opacity of the effect; 0.8 reads as proper bright scratches, and dropping it to ~0.3 gives faint micro-scratches that sit nicely under a roughness detail pass. Keep width_scratch near 1 for believable hairline marks.
Installing and running it
It's part of the amtarr/ComfyUI-TextureAlchemy pack. Install via ComfyUI Manager (search "Texture Alchemy") or:
cd ComfyUI/custom_nodes
git clone https://github.com/amtarr/ComfyUI-TextureAlchemy
Then restart and find it under right-click → Add Node → Texture Alchemist → Procedural. The pack has no extra dependencies and no model files - everything runs on the PyTorch/PIL/NumPy that ComfyUI ships.
The honest gotchas
This one is CPU-bound in a way that hurts. Each line is drawn in a Python loop with a hand-rolled line rasterizer, and the scratch count scales with pixel area. At 2048×2048 with high density it turns into a wait, and 8192 (the max) with density near 1.0 is genuinely slow. Build and preview at 512 or 1024, then bump up for the final pass. Also worth knowing: the pack prints a banner to the console on every run - normal behavior, not an error. If your scratches come out looking like a scribble pad, lower density and raise length_min; dense short scratches read as noise, sparse long ones read as wear.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 51264–8192 | — |
| height | INT | 51264–8192 | — |
| density | FLOAT | 0.300–1 | Number of scratches |
| length_min | FLOAT | 505–500 | — |
| length_max | FLOAT | 2005–1000 | — |
| width_scratch | FLOAT | 1.00.5–10 | Scratch width in pixels |
| angle_variation | FLOAT | 1800–180 | Angular spread (0=vertical, 180=all directions) |
| intensity | FLOAT | 0.800–1 | Scratch brightness |
| seed | INT | 00–18446744073709550000 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| scratches | IMAGE | — |
| height | IMAGE | — |