ComfyUI Node

PBR Generator

The fast lane from flat texture to PBR material

By qornflex·Created 6 months ago·Updated 6 months ago· 6
PBR Generator
  • image
  • BaseColor
  • Normal
  • Roughness
  • Displacement
  • AO
  • Metallic
  • ORM
texture_nameMyTexture
seamless_modeseamless
normal_strength1.00
normal_invert_ytrue
roughness_min0.00
roughness_max1.00
metallic_min0.00
metallic_max1.00
metallic_threshold0.15
ao_blur2
ao_strength1.00
save_texturestrue

You generated a killer brick texture in ComfyUI, and now you want it as an actual material - normal map, roughness, metallic, AO, displacement, the works. That's the whole job of this node. Drop one image in, get seven maps out, all without leaving the graph. It's a port of Joey Ballentine's Material-Map-Generator, a GAN-based material tool that's been kicking around the Stable Diffusion community since 2022, and honestly it still beats hand-rolling maps in a photo editor for speed.

How it works

The node bundles two small RRDB models (the same architecture family as ESRGAN) right inside the pack: NormalMapGenerator-CX-Lite handles the normal map, FrankenMapGenerator-CX-Lite produces the raw displacement and roughness data. Both run a single pass over your image. Then the deterministic part takes over:

  • Roughness comes from one channel of the FrankenMap output, remapped to your roughness_min/roughness_max.
  • Displacement is a straight copy of another channel - it's your height field.
  • AO is derived from the displacement map: inverted, blurred, and scaled by ao_strength. It's a fake but a serviceable one.
  • Metallic is a heuristic, not AI: pixels that are low-saturation and bright get flagged as metal (that's metallic_threshold), with some edge detail added in. Good enough for a rusty pipe, mediocre on a shiny robot.
  • ORM packs AO into the red channel, Roughness into green, Metallic into blue - the standard glTF/real-time renderer convention, so you can feed it straight to a game engine.

seamless_mode is where the "seamless texture" magic lives: the node pads your image with a 16px border (seamless wraps it, mirror reflects it, replicate copies the edge), runs the models, then crops the border back off. That's why output textures tile.

The inputs that matter

Most of these you can leave alone. The few you'll actually touch:

  • image - wired from Load Image (it's forced as a graph input, you can't type a value).
  • texture_name - prefix for saved filenames, like Stone_Wall.
  • seamless_mode - off / seamless / mirror / replicate. seamless is the default and usually what you want for tiling materials.
  • normal_strength and normal_invert_y - the strength multiplier, and the Y-channel flip. Default normal_invert_y is on, which is the Unreal-style convention; if your normals look indented or "sunken" in your renderer, toggle it for the DirectX/OpenGL flip.
  • roughness_min/roughness_max - remaps the grayscale range. Want a wetter look? Push roughness_max down.

The outputs

BaseColor, Normal, Roughness, Displacement, AO, Metallic, and ORM - seven IMAGE outputs. They preview right in the UI and, if save_textures is on (default), get written as {texture_name}_{Map}.png into your ComfyUI output folder. ORM is the one you wire into engines like Unreal or Blender's EEVEE; the individual maps are for compositing or further editing.

Installing it

Via ComfyUI Manager, search for ComfyUI-QFX-PBRGenerator and hit install. Or the manual way:

cd ComfyUI/custom_nodes
git clone https://github.com/qornflex/ComfyUI-QFX-PBRGenerator
cd ../.. && source venv/bin/activate   # or however you activate your venv
pip install -r custom_nodes/ComfyUI-QFX-PBRGenerator/requirements.txt

Then restart ComfyUI. The two models (~20MB each) ship inside the repo - there's no separate HuggingFace download to chase. Dependencies are light: pillow, opencv-python, scipy, numpy. On a bare install, opencv-python and scipy are the ones that tend to be missing, so if it errors on import, start there.

Where people get burned

  • It's heuristic, not PBR-perfect. The AI part is real, but metallic/AO are approximations. Don't expect Substance-quality metal detection on a busy scene - this is the fast lane, and it shows if you zoom in.
  • CPU-only works but crawls. It falls back to CPU gracefully, yet you're running two GAN passes per image. Expect it to be slow.
  • Files appear but no preview. If PNGs show up in your output folder but the canvas shows nothing, check whether save_textures is on - that toggle controls the writes, and the image previews are separate.
  • It copies your input straight to BaseColor. Baked-in lighting and shadows come along for the ride. That's the whole reason the pack's other node, the Advanced PBR Generator, exists - it's the delighting version that needs a Marigold appearance/lighting model. For flat AI textures without heavy shadows, this one's all you need.
CategoryQFX

Inputs (13)

NameTypeDefaultDescription
imageIMAGE
texture_nameSTRINGMyTexture
seamless_modeCOMBOseamless4 options: off, seamless, mirror, replicate
normal_strengthFLOAT1.000–5
normal_invert_yBOOLEANtrue
roughness_minFLOAT0.000–1
roughness_maxFLOAT1.000–1
metallic_minFLOAT0.000–1
metallic_maxFLOAT1.000–1
metallic_thresholdFLOAT0.150–1
ao_blurINT20–10
ao_strengthFLOAT1.000–2
save_texturesBOOLEANtrue

Outputs (7)

NameTypeDescription
BaseColorIMAGE
NormalIMAGE
RoughnessIMAGE
DisplacementIMAGE
AOIMAGE
MetallicIMAGE
ORMIMAGE