Edge Detection
Edge detection with texture work in mind, not ControlNet prep
- image
- edges
You probably know edge detection from ControlNet preprocessors - Canny, Sobel, the stuff that feeds structural guides into a diffusion model. This node is the same family of math pointed at a different job: instead of prepping an image for a ControlNet, it's generating edge/curvature-style masks for your material pipeline. In PBR terms, edges are where wear happens - paint chips off corners, metal scuffs at creases - so an edge mask is the fuel for weathering, not just a filter that makes your texture look like a sketch.
The node gives you five classic operators via the method dropdown, all implemented with plain PyTorch convolutions:
sobel- the balanced default; good all-round edge responsescharr- a stronger approximation of the same gradient, tighter and more sensitive; the one the pack's docs point you to when you want sharper detail for wear masksprewitt- a slightly smoother, more forgiving variantlaplacian- second-derivative edge detection, which catches edges from all directions at once and tends to produce double-edged outlines; good for finding intensity transitions rather than oriented edgescanny_approx- a simplified Canny (Gaussian blur then Sobel), the most "clean line" output of the bunch
Every method operates on the grayscale luminance, then you shape the result with the knobs: strength scales the response, threshold keeps only edges above a cutoff (0 = everything, 1 = only the strongest - this is the knob that turns noise into clean lines), and invert flips the mask so white becomes background and edges go black. Output is a single edges IMAGE.
Where this fits the pack: the README's own recipe is Curvature generator → Wear generator for edge wear, and Edge Detection is effectively the same ingredient in loose form. Run it on a height or normal-derived map, threshold it to isolate just the sharp boundaries, and you've got a mask that says "wear happens here." Multiply it into your albedo as a darkening edge, add it to roughness as scuffing, or feed it into the Detail Map Blender's mask input to restrict detail to edges.
If you do want to use it as a ControlNet prep you can, but that's not the strength here - the preprocessors in packs like ControlNet Auxiliary are tuned for that and come with more options. This node is for generating masks that make materials look used.
Install is pack-standard: Manager → search "Texture Alchemy", or:
cd ComfyUI/custom_nodes
git clone https://github.com/amtarr/ComfyUI-TextureAlchemy
Restart, then Texture Alchemist/Filters → Edge Detection. No dependencies, no model files - all of it is fixed convolution kernels. Watch the shared gotchas: the README's copy step uses the pack's old folder name, and a blocked Git-URL install means the security level is up - clone manually.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| method | COMBO | 5 options: sobel, scharr, prewitt, canny_approx, laplacian | |
| strength | FLOAT | 1.00–3 | — |
| threshold | FLOAT | 0.100–1 | Edge threshold (0=all, 1=strong only) |
| invert | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| edges | IMAGE | — |