Nodes/ComfyUI_PBR_Maker/MatForger_Sampler
ComfyUI Node

MatForger_Sampler

Five PBR maps from a one-line prompt — and they actually tile

By smthemex·Created 2 years ago·Updated about a year ago· 15
MatForger_Sampler
  • pipe
  • image
  • image
  • image_l
promptterracotta brick wall
cfg6.0
height512
width512
step25
tileabletrue
patchedfalse
Save_with_prefixfalse

Type "terracotta brick wall" and get back a full PBR material set - basecolor, normal, height, roughness, metallic - in one run. That's the entire point of MatForger_Sampler, and if you've ever hand-tuned a normal map or spent an hour trying to make a texture tile seamlessly, you already know why that's the part worth reading about.

What it is

This is the sampler node for the MatForger material model, from the same StableMaterials research line as the rest of this pack (Vecchio, arXiv:2406.09293). It takes the pipe output of Load_MatForger, a plain-English material description, and produces a complete PBR set instead of a single flat image. The whole workflow is literally those two nodes: Load_MatForger → MatForger_Sampler → Save Image.

How it works

Under the hood it calls the diffusers pipeline with your prompt, guidance_scale=cfg, the resolution, num_inference_steps=step, and the two MatForger-specific flags tileable and patched. Then it splits the result: basecolor and normal are RGB, so they go out the image output; height, roughness and metallic are single-channel maps, bundled together on image_l.

Two things about the prompt input that people miss:

  • It's multiline, and each line is a separate material. Drop in "oak wood planks" then "weathered concrete" then "rusty corrugated metal" and you get three full material sets in one run.
  • The optional image input flips it to image conditioning. Wire in a reference photo and the model generates a matching material instead of reading text. Handy when you need to match an existing texture.

The inputs that actually matter

  • tileable (default true) - the one you care about for PBR. It makes the output seamlessly repeatable, so you can tile it across a surface without visible seams. Leave it on; it's the whole reason this model exists.
  • prompt (default "terracotta brick wall") - this is the whole game. Get specific: "weathered red brick, mossy, rough" beats "brick".
  • cfg (default 6) - guidance strength. The default is a good starting point; nudge up if results come out loose.
  • height / width (default 512, multiples of 64) - higher gives finer detail and eats more VRAM. Start at 512.
  • step (default 25) - diffusion steps. Rarely worth going far past 30 for this.
  • patched (default false) - a MatForger-specific sampling flag that ships off by default. Leave it.
  • Save_with_prefix (default false) - skip it. It's supposed to dump the five maps to disk, but it writes into ComfyUI's input folder under random hex filenames, not your output folder. Wire the outputs to normal Save Image nodes instead.

Wiring up the outputs

  • image (IMAGE) - two RGB images in one batch: basecolor, then normal. This behaves like a standard ComfyUI image, so it drops straight into Save Image, preview, upscalers, anything.
  • image_l (IMAGE) - the three single-channel maps (height, roughness, metallic) as one tensor. This one's the fiddly part of an otherwise clean pack: it's not shaped like a normal ComfyUI image (single-channel, no batch dimension), so standard image nodes can choke on it or misread it. Preview it, split it into its channels however you like - the pack gives you no helper for that.

Common issues

  • Nothing comes out of Load_MatForger? That's normal; the sampler is where output appears. Just make sure the loader finished its first-run model download before you judge anything.
  • Shape error when you wire image_l somewhere - expected, see above. Only image is a safe citizen in the rest of the graph.
  • VRAM. This is a full diffusion UNet plus VAE, so 512×512 is a sensible first try. Push to 1024+ and the tiling is doing real work; keep an eye on memory.

Install is identical to its sibling - ComfyUI Manager, search "ComfyUI_PBR_Maker", or git clone https://github.com/smthemex/ComfyUI_PBR_Maker into custom_nodes and restart. The model downloads automatically on the loader's first run.

CategoryMatForger

Inputs (10)

NameTypeDefaultDescription
pipeMatForgerMODEL
promptSTRINGterracotta brick wall
cfgFLOAT6.01–100
heightINT51264–4096
widthINT51264–4096
stepINT251–4096
tileableBOOLEANtrue
patchedBOOLEANfalse
Save_with_prefixBOOLEANfalse
imageoptIMAGE

Outputs (2)

NameTypeDescription
imageIMAGE
image_lIMAGE