Nodes/ComfyUI-QFX-PBRGenerator/PBR Generator (Advanced)
ComfyUI Node

PBR Generator (Advanced)

The PBR node that strips baked-in lighting — and what it actually needs from Marigold

By qornflex·Created 6 months ago·Updated 6 months ago· 6
PBR Generator (Advanced)
  • image
  • marigold_appearance
  • marigold_lighting
  • Original
  • BaseColor
  • Normal
  • Roughness
  • Displacement
  • AO
  • Metallic
  • ORM
texture_nameMyTexture
seamless_modeseamless
albedo_sourcelighting
gamma_albedo0.45
gamma_metal_rough2.20
gamma_lighting_ao0.45
roughness_min0.00
roughness_max1.00
metallic_min0.00
metallic_max1.00
normal_strength1.00
normal_invert_ytrue
ao_blur2
ao_strength1.00
save_texturestrue

Here's the dirty secret of the standard PBR Generator: it copies your input image straight through as the BaseColor. Great for flat AI textures, bad for anything with baked-in shadows - a renderer lights those shadows a second time, and the material looks lit twice. This Advanced variant exists to fix exactly that, by "delighting" the albedo before it ever reaches the map stack. It's the same pack, same install, and it earns its name by demanding two extra inputs that confuse everyone the first time.

How it works

The delighting comes from a Marigold appearance and lighting decomposition model - the Marigold team's intrinsic-image tool, not the depth-estimation Marigold you might already know from ControlNet. It splits a photo into an appearance estimate (the flat, unlit albedo) and a lighting estimate. You feed those into this node as two IMAGE inputs:

  • marigold_appearance - the delighted albedo stream, where batch index 0 is the clean appearance and index 1 carries material info.
  • marigold_lighting - the lighting stream; index 0 is the base and index 1 drives the AO.

From the code, here's the mapping: albedo_source picks whether BaseColor comes from appearance or lighting (index 0 of either). Roughness comes from appearance index 1's red channel, metallic from its green channel, and AO from lighting index 1. Then three separate gamma controls shape each group: gamma_albedo (0.45 default - brightens), gamma_metal_rough (2.2, the standard encoding correction), and gamma_lighting_ao (0.45).

Here's the part people miss: the node still needs the plain image input and still runs the two bundled GAN models. Normal, roughness, and displacement are generated from your source image exactly like the standard node. Marigold only drives BaseColor, AO, and Metallic. (Fun bit: the code computes a Marigold-derived roughness and then quietly discards it - the GAN's roughness wins.) So it's a Marigold-plus-GAN hybrid, not pure Marigold. If you were expecting to skip the AI models, no dice.

The outputs mirror the standard node - Original, BaseColor, Normal, Roughness, Displacement, AO, Metallic, ORM - with ORM packed the usual R=AO, G=Roughness, B=Metallic way for game engines.

The input that bites

marigold_appearance and marigold_lighting are required. The node won't run without them, and the recurring community question - asked about the near-identical PBR Extractor in Texture Alchemy too - is "where do I get these images?" You don't hand-make them: you run a ComfyUI wrapper around the Marigold appearance/lighting model and feed its stacked outputs in. The wrapper has to output the appearance and lighting as batches with at least two frames, because the node reads index 0 and index 1. If you feed it a single flat image, it prints WARNING: Appearance doesn't have index 1, using zeros to the console and your maps come out flat and wrong. Check the pack's example workflows for the wiring.

Installing it

Same as its sibling - ComfyUI Manager, search ComfyUI-QFX-PBRGenerator, or:

cd ComfyUI/custom_nodes
git clone https://github.com/qornflex/ComfyUI-QFX-PBRGenerator
pip install -r ComfyUI-QFX-PBRGenerator/requirements.txt

Restart, and look under the QFX category. Dependencies are just pillow, opencv-python, scipy, numpy; the models ship in the repo, so there's no extra download. What you will need is a working Marigold appearance/lighting model in your ComfyUI, which means tracking down its wrapper - that's the fiddly dependency nobody warns you about up front.

Should you reach for it?

If your source is a generated texture with soft, even lighting, the standard node is faster and fine. If you're feeding it a photograph with visible shadows, highlights, and a sky or environment baked in, this is the one - a flat BaseColor is the difference between a material that looks right and one that fights your lighting rig. Just budget a session for setting up the Marigold side. It's the single most annoying part of this pack, and it's worth it exactly once.

CategoryQFX

Inputs (18)

NameTypeDefaultDescription
imageIMAGE
texture_nameSTRINGMyTexture
seamless_modeCOMBOseamless4 options: off, seamless, mirror, replicate
marigold_appearanceIMAGE
marigold_lightingIMAGE
albedo_sourceCOMBOlightingWhich Marigold output to use for albedo
gamma_albedoFLOAT0.450.1–3Gamma correction for albedo (applied to both appearance and lighting sources)
gamma_metal_roughFLOAT2.200.1–3Gamma correction for metallic and roughness maps
gamma_lighting_aoFLOAT0.450.1–3Gamma correction for lighting and AO maps
roughness_minFLOAT0.000–1
roughness_maxFLOAT1.000–1
metallic_minFLOAT0.000–1
metallic_maxFLOAT1.000–1
normal_strengthFLOAT1.000–5
normal_invert_yBOOLEANtrue
ao_blurINT20–10
ao_strengthFLOAT1.000–2
save_texturesBOOLEANtrue

Outputs (8)

NameTypeDescription
OriginalIMAGE
BaseColorIMAGE
NormalIMAGE
RoughnessIMAGE
DisplacementIMAGE
AOIMAGE
MetallicIMAGE
ORMIMAGE