2023-09-26 17:45:32 +08:00
fix
2023-09-26 15:54:14 +08:00
2023-09-26 17:45:32 +08:00
2023-09-26 17:35:02 +08:00
2023-09-26 17:45:32 +08:00
2023-09-01 19:32:49 +08:00
2023-09-18 17:08:25 +08:00
2023-09-18 17:08:25 +08:00
2023-09-26 17:45:32 +08:00
2023-09-26 17:45:32 +08:00
2023-09-01 19:32:49 +08:00
2023-09-18 17:08:25 +08:00

avatar-graph-comfyui

image

A custom_nodes module for creating real-time interactive avatars powered by blender bpy mesh api + Avatech Shape Flow runtime.

Demo

https://github.com/avatechai/avatar-graph-comfyui/assets/18395202/b229a4b3-88ba-4755-a8e0-9149260eef12

Custom Nodes

Preview Node Name Description
CleanShot 2023-09-26 at 15 42 46 Segmentation (SAM) Integrative SAM node allowing you to directly select and create multiple image segment output.
CleanShot 2023-09-26 at 15 44 01 Create Mesh Layer Create a mesh object from the input images (usually a segmented part of the entire image)
CleanShot 2023-09-26 at 15 44 29 Join Meshes Combine multiple meshes into a single mesh object
CleanShot 2023-09-26 at 15 48 26 Mesh Modify Shape Key Given shape key name & target vertex_group, modify the vertex / all vertex’s transform
CleanShot 2023-09-26 at 16 38 51 Create Shape Flow Create runtime shape flow graph, allowing interactive inputs affecting shape keys value in runtime
CleanShot 2023-09-26 at 17 01 51 Match Texture Aspect Ratio Since the mesh is created in 1:1 aspect ratio, a re-scale is needed at the end of the operation
CleanShot 2023-09-26 at 17 11 44 Plane Texture Unwrap Will perform mesh face fill and UV Cube project on the target plane mesh, scaled to bounds.
CleanShot 2023-09-26 at 16 37 54 Avatar Main Output The primary output of the .ava file. The embeded Avatar View will auto update with this node's output

Workflow

Workflow01
Character Gen Prompting Guide

Notice:

  • We need a character image with an open mouth and enable the tool to easily recognize facial features, so please add to the prompt: looking at viewer, detailed face, open mouth, [smile], solo,eye-level angle

Workflow Download:

➡️Simple CharacterGen Workflow

  • Feel free to change any checkpoint model that suits your needs.

image

Mouth Open(Inpaint) Guide

Notice:

  • To maintain consistency with the base image, it is recommended to utilize a checkpoint model that aligns with its style.

Workflow Download:

➡️MouthOpen Workflow

inpaint_workflow

Inpaint Demonstration

https://github.com/avatechai/avatar-graph-comfyui/assets/48451938/ff48c3d9-7292-4505-8993-8f117cee34ff

Recommend Checkpoint Model List:

Anime Style SD1.5
Realistic Style SD1.5

Shape Flow

image

Installation

  1. cd custom_nodes

  2. git clone https://github.com/avatechgg/avatar-graph-comfyui.git

  3. Install deps cd avatar-graph-comfyui && python -m pip install -r requirements.txt

  4. Navigate to in your comfyui installation folder, open comfyui/main.py and add the following lines:

def prompt_worker(q, server):
    e = execution.PromptExecutor(server)

    # This is a workaround since using blender as a python module, the bpy module has to be imported after in the custom thread, otherwise it will cause a segfault if imported in the custom nodes.

    # Add next line
    import global_bpy

    while True:
        item, item_id = q.get()
        # Add next line
        global_bpy.reset_bpy()
  1. Restart comfyui

  2. Run comfyui with enable-cors-header python main.py --enable-cors-header or (mac)python main.py --force-fp16 --enable-cors-header

Development

For comfyui frontend extension, frontend js located at avatar-graph-comfyui/js

Web stack used: vanjs tailwindcss

Install deps

pnpm i

Run the dev command to start the tailwindcss watcher

pnpm dev

For each changes, simply refresh the comfyui page to see the changes.

p.s. For tailwind autocomplete, add the following to your vscode settings.json.

{
    "tailwindCSS.experimental.classRegex": [
        ["class\\s?:\\s?([\\s\\S]*)", "(?:\"|')([^\"']*)(?:\"|')"]
    ]
}
S
Description
No description provided
Readme
824 KiB
Languages
Python 39.9%
JavaScript 34.1%
CSS 26%