Nodes/ComfyUI-Zero2JSON/πŸ” Z2J Camera DoF
ComfyUI Node

πŸ” Z2J Camera DoF

Bokeh you can reproduce β€” Z2J Camera DoF writes the depth-of-field line

By MushroomFleetΒ·Created 7 months agoΒ·Updated 5 months agoΒ· 1
πŸ” Z2J Camera DoF
    • text
    β—„seed0β–Ί
    β—„prompt_index0β–Ί
    β—„profilecamera_dof_default.jsonβ–Ί
    β—„prefixβ–Ί
    β—„suffixβ–Ί
    β—„dof_styleanyβ–Ί

    Depth of field is a photography term most prompters ignore until they notice every image has the same default focus. Z2J Camera DoF is the ComfyUI-Zero2JSON node that writes the DoF line for you - deterministically, so a shallow-focus look you like is one you can get back. It's the "how much is sharp" member of the camera family, sitting alongside angle (how the camera looks), distance (how far) and focus (what the eye lands on).

    It feeds the depth-of-field field of the FLUX2-CameraRig in the FLUX2-JSON workflow. A generated line bundles a DoF type (shallow, deep, macro…), the bokeh character, how the focus transitions, and a plane description - so you get "shallow depth of field, creamy bokeh, smooth focus falloff, subject's face in sharp focus" instead of a bare "bokeh" tag.

    How it works

    Position-as-seed, standard for the pack: (seed, prompt_index, slot) hashed with xxhash32, hash selects a template and one option per pool. The camera_dof_default.json profile has 4 templates over four pools - dof_type (9), bokeh (9), transition (6), plane_description (8) - about 15,500 combinations. The bokeh pool is the fun one: creamy, swirly, busy, smooth - the character of the blur, not just its presence.

    The inputs that matter

    • seed - world seed.
    • prompt_index - position coordinate; farm it to walk DoF variants.
    • profile - dropdown of camera_dof_*.json files; custom profiles show up after restart.
    • prefix / suffix - anchors around the DoF phrase.
    • dof_style - a filter dropdown (shallow / moderate / deep / bokeh_heavy / everything_sharp). Fine print: in v1.0.0 as shipped this is declared but ignored by the generator. It doesn't filter yet - check for a newer release.

    Output is a single text string.

    Install

    All seventeen nodes in one repo:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MushroomFleet/ComfyUI-Zero2JSON
    cd ComfyUI-Zero2JSON
    pip install -r requirements.txt
    

    Restart ComfyUI. Only dependency: xxhash>=3.0.0. No models, no API keys. Manager users: search "ComfyUI-Zero2JSON".

    Where people get burned

    DoF and focus are easy to over-specify together. "Shallow depth of field" plus a separate focus node saying "background in focus" is a contradiction the model resolves by picking the louder phrase - usually the bokeh, which is why you sometimes get a foreground subject blurring into mush. Let DoF own the blur and let the focus node own the target; don't have both negotiating sharpness. Also worth knowing: deep-focus and everything-sharp outputs are essentially a style choice, and on FLUX2 models they lean on the LLM encoder's understanding of photographic terms - which is exactly why these read so cleanly.

    CategoryZero2JSON/Camera

    Inputs (6)

    NameTypeDefaultDescription
    seedINT00–4294967295World seed for deterministic generation
    prompt_indexINT00–4294967295Position in infinite prompt space
    profileoptCOMBOcamera_dof_default.jsonSelect vocabulary profile
    prefixoptSTRINGText to prepend to generated prompt
    suffixoptSTRINGText to append to generated prompt
    dof_styleoptCOMBOanyDepth of field style hint

    Outputs (1)

    NameTypeDescription
    textSTRINGβ€”