Nodes/Refocus - Generative Refocusing/Genfocus Defocus Map Condition
ComfyUI Node

Genfocus Defocus Map Condition

The defocus map's passport into the bokeh generation

By EricRollei·Created 8 months ago·Updated 4 months ago· 19
Genfocus Defocus Map Condition
  • defocus_map
  • condition
max_coc100.00

When you run bokeh generation through the advanced Genfocus Generate node, the defocus map doesn't go in as a raw image - it goes in as a GENFOCUS_CONDITION, just like any other condition, but with one important difference: it must skip VAE preprocessing. A defocus map is already a normalized tensor of blur values; if you run it through the image processor as if it were a photograph, you destroy exactly the information it's supposed to carry. GenfocusDefocusMapCondition handles that correctly for you.

What it does

It takes your grayscale defocus map (the defocus_map output from Compute Defocus Map, which is already normalized 0–1) and packages it into a GENFOCUS_CONDITION tagged with the bokeh adapter, built with no_preprocess=True so it goes straight into the pipeline as a tensor. The max_coc input is kept for backwards compatibility - the tooltip and the code both note the map is already normalized, so it doesn't actually re-divide. In practice: connect defocus_map, leave max_coc alone unless you're feeding it an unnormalized raw map, wire the condition output into condition_1 (or any slot) on Genfocus Generate.

One input, one input that matters:

  • defocus_map (required) - normalized 0–1 defocus map IMAGE.
  • max_coc (100) - legacy normalization knob; the map from Compute Defocus Map is already normalized.

Output: condition (GENFOCUS_CONDITION).

When you need it

Only when you're bypassing the convenience nodes. Genfocus Bokeh (Native) builds this exact condition internally - it takes the plain defocus-map IMAGE and does the same no-preprocess wrapping for you. So this node is for people driving Genfocus Generate directly with multiple conditions, e.g. pairing an image condition (via Genfocus Condition) with a defocus-map condition for a custom multi-branch bokeh run. It's the difference between "bokeh condition" and "photo condition" in the same graph.

Gotchas

  • Feed it the normalized map, not the preview. Compute Defocus Map gives you three outputs: defocus_preview (contrast-stretched for eyeballing), defocus_map (what Genfocus uses, clamped at max_coc), and defocus_raw. This node wants defocus_map.
  • The condition gets clamped to 0–1 as a safety net, and the node logs the input range to the console - a map that shows up near-zero there is the classic "dark defocus map" case from the README, which is normal for subtle bokeh. If you want a stronger effect, raise blur_strength/max_coc in Compute Defocus Map or flip its normalize_for_genfocus on, rather than fighting it here.

Install: the Refocus pack (ComfyUI Manager → "Refocus - Generative Refocusing", or clone into custom_nodes/), plus the diffusers stack and a loaded Genfocus pipeline. It's a pure packaging node - no models, no weights of its own.

CategoryGenfocus

Inputs (2)

NameTypeDefaultDescription
defocus_mapIMAGE
max_cocoptFLOAT100.001–500Maximum circle of confusion for normalization

Outputs (1)

NameTypeDescription
conditionGENFOCUS_CONDITION