Nodes/ComfyUI Web Viewer/Gamepad Loader @ vrch.ai
ComfyUI Node

Gamepad Loader @ vrch.ai

Plug in a gamepad, drive a live portrait — the pack's showstopper

By VrchStudio·Created 2 years ago·Updated 18 days ago· 356
Gamepad Loader @ vrch.ai
    • RAW_DATA
    • LEFT_STICK
    • RIGHT_STICK
    • BOOLEAN_BUTTONS
    • INT_BUTTONS
    • FLOAT_BUTTONS
    index0
    name
    refresh_interval50
    debugfalse
    raw_data

    This is the node that got the pack noticed. VrchStudio's realtime-avatar showcase - a gamepad steering a live portrait via Advanced Live Portrait - pulled hundreds of upvotes on r/comfyui, and the Gamepad Loader is the thing sitting in the middle of it. It reads your controller through the browser's Gamepad API and hands the sticks and buttons to your workflow as live numbers. No drivers, no extra apps, no middleware. Your Xbox pad just becomes a ComfyUI input device.

    What it is

    Mechanically it's a poller. The node asks the browser what the gamepad is doing every refresh_interval ms (50 by default, and 50 is a good balance between responsiveness and load). index picks which of up to eight connected controllers you're reading - set it to the right number if you have more than one pad. name shows the gamepad's identifier so you can confirm you've got the right one. raw_data dumps the full controller state as text, which doubles as a debugging view.

    The outputs are where the fun lives, and they're all lists because a gamepad is a bag of channels. RAW_DATA is the whole state as JSON - the everything dump. LEFT_STICK and RIGHT_STICK are float lists (the X/Y axes, essentially) - those are what drive head-tilt and position in the live-portrait workflow. Then there are three flavors of buttons: BOOLEAN_BUTTONS for on/off presses, INT_BUTTONS for digital pad states, and FLOAT_BUTTONS for analog triggers. Each list is indexed by button number, so you're mapping "button 0, stick axis 1" to whatever parameter you want. Pair the stick outputs with the pack's FLOAT Remap node and you can steer anything, not just a portrait.

    Common issues

    The setup gotchas are real but short. Your browser has to recognize the gamepad first - most modern Chrome and Edge builds have solid Gamepad API support - and you usually have to press a button on the pad to wake it up and grant access, so if nothing moves, mash a few buttons first. If two pads are connected, check index. And note the keyboard caveat doesn't apply here: the Gamepad API doesn't need window focus the way the keyboard control nodes do, which is a big part of why this is the better tool for live performance.

    How to install

    Install is the standard pack story:

    cd ComfyUI/custom_nodes
    git clone https://github.com/VrchStudio/comfyui-web-viewer
    cd comfyui-web-viewer
    pip install -r requirements.txt
    

    restart ComfyUI, done. Manager users just search "ComfyUI Web Viewer". Windows portable: python_embeded\python.exe -m pip install -r ComfyUI\custom_nodes\comfyui-web-viewer\requirements.txt. No models to download - the node is a thin bridge between the browser and the graph.

    If you want the full effect, grab the pack's example workflow example_gamepad_nodes_002_live_portrait.json and an Advanced Live Portrait install - the README walks you through it, and the cheat code in the author's tutorial (left stick for head movement, trigger for the rest) gets you a playable avatar in a few minutes. This is the node you show people when they ask what ComfyUI can do.

    Categoryvrch.ai/control/gamepad

    Inputs (5)

    NameTypeDefaultDescription
    indexCOMBO08 options: 0, 1, 2, 3, 4, 5, +2
    nameSTRING
    refresh_intervalINT5010–10000
    debugBOOLEANfalse
    raw_dataSTRING

    Outputs (6)

    NameTypeDescription
    RAW_DATAJSON
    LEFT_STICKFLOAT
    RIGHT_STICKFLOAT
    BOOLEAN_BUTTONSBOOLEAN
    INT_BUTTONSINT
    FLOAT_BUTTONSFLOAT