Genfocus Bokeh (Native)
The bokeh that actually learned to look like a lens
- pipeline
- image
- defocus_map
- bokeh_result
GenfocusBokeh is the payoff node of the whole pack. Give it a sharp image plus a defocus map - the grayscale "how much to blur each pixel" map - and it generates realistic depth-of-field using the trained BokehNet LoRA. This is the "shallow DOF portrait" and "tilt-shift miniature" effect, done by a model that learned what lens bokeh actually looks like rather than by blurring with a filter.
Why does that matter? Because fake bokeh is one of the biggest tells in AI images. The KB's photorealism doc flags it directly: "Background blur: doesn't match real lens optics. AI bokeh is often too uniform or has wrong falloff patterns." A Gaussian blur of a depth map is exactly that kind of tell. Genfocus is generative - FLUX re-renders the scene with the defocus map steering where blur accumulates, so you get the characteristic falloff, edge behavior, and structure of real lens blur instead of a smudge. That's the whole point of spending 23GB on FLUX for this.
How it works
This is the "Native" (diffusers) sibling of the BokehNetApply utility node - and the one that actually applies the LoRA. Internally it mirrors the paper's demo: your sharp image becomes one condition, the defocus map becomes another (with no_preprocess=True, since it's already a normalized tensor), both tagged with the bokeh adapter, and only the bokeh LoRA is activated. The stock prompt "an excellent photo with a large aperture" runs at guidance 1.0. It even auto-resizes the defocus map if it doesn't match the image dimensions - so wiring mismatches won't crash it, though you should still aim to match sizes upstream.
Inputs
- pipeline - GENFOCUS_PIPELINE from either Genfocus loader.
- image - a sharp image. The README is blunt: feed it blur and the results are soft and unpredictable. Deblur first.
- defocus_map - a plain IMAGE. This is the
defocus_mapoutput from Compute Defocus Map (the normalized one, not the preview). - steps (28) - recommended; more if you want refinement.
- seed (42).
- use_custom_prompt / custom_prompt - off by default. The stock prompt is calibrated for the LoRA.
Output: bokeh_result.
Getting the effect you want
The blur intensity lives upstream in Compute Defocus Map, not here. Two knobs there do the real work:
- blur_strength (K) - how fast blur grows with depth distance. Subtle portrait: 10–20. Standard bokeh: 20–30. Dramatic tilt-shift: 40–60.
- max_coc - the cap on blur radius. 64 for gentle softening, 100+ for obvious separation.
One thing to set expectations about: even if your focus point matches the original photo's focus, the result won't be byte-identical - FLUX re-generates the image, so already-sharp areas get slightly softer. If you want no change in already-sharp regions, the defocus map needs to be genuinely zero there; check the preview output from Compute Defocus Map to confirm.
Install
Part of the Refocus pack - ComfyUI Manager ("Refocus - Generative Refocusing") or git clone https://github.com/EricRollei/comfyui-refocus - with the full diffusers stack (pip install diffusers transformers accelerate peft), the Genfocus LoRAs in models/genfocus/, and a FLUX-dev model via one of the two Genfocus loaders. Remember the constraint that applies to every native node: FLUX-dev architecture only, never Schnell.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| pipeline | GENFOCUS_PIPELINE | — | |
| image | IMAGE | — | |
| defocus_map | IMAGE | — | |
| steps | INT | 281–100 | Denoising steps (28 recommended) |
| seed | INT | 420–4294967295 | — |
| use_custom_promptopt | BOOLEAN | false | Use custom prompt instead of standard bokeh prompt |
| custom_promptopt | STRING | Custom prompt (only used if use_custom_prompt is True) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| bokeh_result | IMAGE | — |