Nodes/Refocus - Generative Refocusing/Apply BokehNet (Utility)
ComfyUI Node

Apply BokehNet (Utility)

The bokeh utility node — and the caveats you should read first

By EricRollei·Created 8 months ago·Updated 4 months ago· 19
Apply BokehNet (Utility)
  • model
  • clip
  • vae
  • genfocus_loras
  • image
  • defocus_map
  • latents
  • bokeh_image
  • latents
promptan excellent photo with a large aperture
steps28
guidance_scale1.0
seed1234
lora_strength1.00

BokehNetApply is the "utility" path to the depth-of-field effect: it takes your existing ComfyUI FLUX model (plain MODEL/CLIP/VAE - no diffusers, no 23GB folder), a sharp image, and a defocus map, and produces a bokeh version. If you want the trained Genfocus BokehNet result, you want Genfocus Bokeh (Native) instead. But if you're already running a ComfyUI FLUX checkpoint and want a lighter bokeh pass without spinning up the diffusers pipeline, this is the node.

What it actually does (read this part)

Two honest caveats before you build on this node, both straight from the source code.

First, it doesn't apply the BokehNet LoRA yet. The code is explicit - "custom LoRA application not yet implemented" - so the genfocus_loras input is accepted and then ignored. What you get instead is prompt-guided img2img: the image is VAE-encoded, run through ComfyUI's euler/normal sampler with the prompt "an excellent photo with a large aperture" against a negative of "sharp everywhere, deep focus, small aperture, everything in focus", with the denoise strength scaled by the average defocus in your map (more defocus → more denoise). The generated latent is then blended back with the original using the defocus map as the mask - sharp areas keep the original pixels, blur areas take the generated ones. It's a clever approximation, and it's a real effect, but it is not the trained network.

Second, the wiring is half-built. The node declares its defocus_map input as type DEFOCUS_MAP and reads a dict with "map" and "blur_strength" keys out of it - but as of v0.1.2, nothing in the pack actually emits that type. Compute Defocus Map outputs plain IMAGE tensors, not a DEFOCUS_MAP dict. So the happy path from the README's pipeline diagram (Compute Defocus Map → BokehNetApply) doesn't type-match yet. This is exactly the kind of thing that wastes an evening, so: if you want utility-path bokeh, expect to adapt; if you want it to just work, use the Native node, which takes a plain IMAGE defocus map and applies the real LoRA.

The inputs that matter

  • Required: model, clip, vae (any FLUX checkpoint), genfocus_loras (from Genfocus LoRALoader), image, defocus_map.
  • prompt - defaults to "an excellent photo with a large aperture"; change it if you're steering the look.
  • steps (28), guidance_scale (1.0), seed (1234), lora_strength (1.0, currently inert).
  • latents - optional, to reuse a previous run's latents for consistency across passes.

Outputs: bokeh_image (IMAGE) and latents (LATENT) - the latent is the reusable one for chained runs.

Install

Same pack install (ComfyUI Manager → "Refocus - Generative Refocusing", or git clone https://github.com/EricRollei/comfyui-refocus into custom_nodes/), plus the Genfocus LoRAs in models/loras/ for the loader. Base requirements only - no diffusers needed for this node. It runs on any FLUX checkpoint you already have, at whatever VRAM you already run FLUX at.

Verdict

Keep it in your back pocket as a fast, prompt-driven bokeh that reuses your existing FLUX, and know that the pack's real bokeh - trained weights, defocus-map steering, the works - lives one family over in Genfocus Bokeh (Native). The utility node is where the pack's roadmap is, not where its finished quality is.

CategoryRefocus/Bokeh

Inputs (12)

NameTypeDefaultDescription
modelMODEL
clipCLIP
vaeVAE
genfocus_lorasGENFOCUS_LORAS
imageIMAGE
defocus_mapDEFOCUS_MAP
promptoptSTRINGan excellent photo with a large apertureText prompt to guide bokeh generation
stepsoptINT281–100Number of denoising steps
guidance_scaleoptFLOAT1.01–20Classifier-free guidance scale
seedoptINT12340–18446744073709550000Random seed for reproducibility
lora_strengthoptFLOAT1.000–2LoRA adapter strength
latentsoptLATENTOptional: reuse latents from previous run for consistency

Outputs (2)

NameTypeDescription
bokeh_imageIMAGE
latentsLATENT