Nodes/ComfyUI-Texture-Simple/Analyze PBR Texture
ComfyUI Node

Analyze PBR Texture

A PBR texture that won't behave? This node tells you why.

By gokayfem·Created 2 years ago·Updated about a month ago· 58
Analyze PBR Texture
  • image
  • report_json
  • diagnostic
role

Your material renders too dark. Or the roughness map looks like static. Or the normal map does nothing. In a real 3D pipeline you'd open the maps in Photoshop and stare at histograms; in ComfyUI you have no histogram tool - you have TexturePBRAnalyze. Give it a texture, tell it what role that texture plays, and it hands back a JSON report of what's actually in the pixels plus a diagnostic image that paints problem pixels magenta.

It's the quality-control node in ComfyUI-Texture-Simple, Gökay Aydoğan's offline PBR toolkit - the "analyze" step that sits between generating maps and shipping them. Pure NumPy/Pillow, CPU-only, no models. Nothing fancy, and that's the point: it answers boring, essential questions.

Why the role matters

The role dropdown (albedo, roughness, metalness, normal, height, ao) changes how you should read the same numbers. A roughness map with lots of clipped black and white pixels is fine - those maps are supposed to use the full range. The same clipping in an albedo map means blown highlights or crushed shadows that will wreck your material. Height should span a wide range too; AO should be mostly white with dark creases. Telling the node the role just frames the report for you - the diagnostic and stats are the same regardless, except for one role-specific check:

  • normal - it additionally decodes the image back into vectors (×2−1), measures their length, and reports normal_length_mean plus normal_invalid_fraction. If the mean length is far from 1 or the invalid fraction is high, that's not a normal map you loaded - it's an albedo in the normal slot. This is how you catch the single most common material mistake.

What the report contains

report_json is a STRING with: resolution and batch size, per-channel min/max/mean, clipped_pixel_fraction (pixels pinned at 0 or 255), and edge_mae_horizontal/edge_mae_vertical - the same seam measurement the pack's tiling node produces, so you can confirm a map stays seamless after processing. The diagnostic IMAGE output is your input with any clipped pixels tinted magenta, so the burned-out or crushed areas pop visually instead of hiding in a number.

Install

ComfyUI Manager (search "ComfyUI Texture Simple"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/gokayfem/ComfyUI-Texture-Simple.git
python -m pip install -r ComfyUI-Texture-Simple/requirements.txt

Restart ComfyUI; find it under texture/PBR. Dependencies are just numpy and Pillow.

How to actually use it

Run it on every map in your set with the correct role, and read the numbers in context - albedo mean around 0.5 with low clipping is healthy; a roughness map with a mean of 0.02 means your material will be mirror-smooth almost everywhere. And if a normal map comes back with a large normal_invalid_fraction, don't fight the renderer - the map is wrong, not the shader. Wire the diagnostic to a preview node alongside your texture, and you'll stop guessing which map is guilty the moment something renders wrong.

Categorytexture/PBR toolkit

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
roleCOMBO6 options: albedo, roughness, metalness, normal, height, ao

Outputs (2)

NameTypeDescription
report_jsonSTRING
diagnosticIMAGE