Roughness To Smoothness
One line of math that saves you a renderer headache
- roughness
- smoothness
The FairLab Roughness To Smoothness node converts a roughness map into a smoothness (glossiness) map by inverting it. It's part of the pack's small PBR-material toolkit, and if you've never touched a PBR pipeline it looks pointless. If you have, you've hit the exact wall this node removes.
Here's the wall. Game engines and renderers disagree on which map they want. Some want roughness (0 = mirror, 1 = matte). Others want smoothness or glossiness, which is the same information inverted (1 = mirror, 0 = matte). When your workflow produces a roughness map and the renderer downstream asks for smoothness, you either flip it in a shader graph, or you flip it here, as a first-class image you can inspect, save, and reuse.
How it works
The mechanism is one line: smoothness = 1.0 - roughness. It's a per-pixel, channel-wise inversion of the input image tensor. That's the entire node - no curves, no gamma correction, no detail analysis. It's deliberately dumb, which is exactly what a straight rough-to-gloss conversion is supposed to be when both maps live in linear space.
- roughness - the input image, an
IMAGEtensor. - smoothness - the output, the inverted image.
The math is honest and worth remembering: if your source map is properly linear (which PBR maps should be), 1 − x is the correct invert. If your map is sitting in sRGB or has baked-in gamma, this node won't fix that - you'd want a proper color-space conversion first, and this is not that tool.
Where it belongs in a workflow
Pair it with the pack's other PBR nodes. Mask Map normalizes a grayscale image into a mask tensor, Detail Map generates a detail map from an input - and this one sits at the end, converting a roughness output into whatever dialect your material viewer or renderer wants. It's also handy for flipping in the other direction if you get handed smoothness and need roughness, since the inversion is its own inverse: run a smoothness map through it and you're back to roughness.
The gotcha: alpha
Because it's a channel-wise 1 − x, an RGBA image gets every channel inverted - including alpha. A roughness map with a valid alpha channel will come out with an inverted (and almost certainly wrong) alpha. If your material input is RGBA, strip the alpha first - the pack's Image Remove Alpha node is right there in the same category. Feed it a clean RGB roughness map and you're fine.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/yanhuifair/ComfyUI-FairLab.git
cd ComfyUI-FairLab
pip install -r requirements.txt
Restart, or search "ComfyUI-FairLab" in ComfyUI Manager. The node itself is pure tensor arithmetic - no extra dependency. The pack pulls opencv-python and friends for its video and image-IO nodes, but this one runs on the tensor ops ComfyUI already has.
The honest take
This is a niche utility, and it knows it - one input, one output, one line of math. If you're not doing material maps, skip it. If you are, it's the difference between a manual invert somewhere in your pipeline and a node that documents the conversion right where the material graph reads it.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| roughness | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| smoothness | IMAGE | — |