diff --git a/README.md b/README.md index c1c1126..45afc58 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,20 @@ -# Camera Control Prompt Node +# Camera Control & Relighting Prompt Nodes -Advanced camera control prompt generator for ComfyUI, optimized for **dx8152's MultiAngle LoRA**. +Advanced prompt generators for ComfyUI, optimized for **dx8152's MultiAngle LoRA** and relighting workflows. ## Author **Lorenzo Mercugliano** ## Description -A powerful ComfyUI custom node that converts camera control parameters into bilingual prompts (Chinese + English). Designed to work seamlessly with dx8152's MultiAngle LoRA for precise camera control in image generation workflows. +A collection of powerful ComfyUI custom nodes that convert camera control and lighting parameters into bilingual prompts (Chinese + English). Designed to work seamlessly with dx8152's MultiAngle LoRA for precise camera control and relighting in image generation workflows. ## Features - **Multi-directional camera movements** (horizontal, vertical, forward) - **Camera rotation** with precise angle control (-90° to 90°) - **Special view modes** (top-down, wide-angle, close-up) +- **Relighting control** with 10 directional light sources - **Bilingual output** (Chinese + English prompts) -- **Optimized interface** with sliders and toggle controls +- **Optimized interface** with sliders, toggles, and dropdowns - **No redundancy** - smart parameter organization ## Installation @@ -21,23 +22,27 @@ A powerful ComfyUI custom node that converts camera control parameters into bili 2. The folder structure should be: `ComfyUI/custom_nodes/camera_control_prompt/` 3. Restart ComfyUI -## Node Inputs +## Nodes -### Sliders (0-1 or Range Values) -- **move_horizontal** (-1 to 1): Left/Right camera movement - - -1 = Move left - - 0 = No movement - - 1 = Move right +### 1. Camera Control Prompt Generator -- **move_vertical** (-1 to 1): Up/Down camera movement - - -1 = Move down - - 0 = No movement - - 1 = Move up +#### Node Inputs +**Dropdowns:** +- **move_horizontal**: Left/Right camera movement + - none = No movement + - left = Move left + - right = Move right -- **move_forward** (0 to 1): Forward camera movement (toggle) - - 0 = No movement - - 1 = Move forward +- **move_vertical**: Up/Down camera movement + - none = No movement + - up = Move up + - down = Move down +- **move_forward**: Forward camera movement + - no = No movement + - yes = Move forward + +**Sliders:** - **rotate** (-90 to 90, step 45): Camera rotation - -90 = Rotate 90° left - -45 = Rotate 45° left @@ -45,29 +50,77 @@ A powerful ComfyUI custom node that converts camera control parameters into bili - 45 = Rotate 45° right - 90 = Rotate 90° right -### Buttons (Boolean) +**Buttons (Boolean):** - **view_top_down**: Enable top-down view - **view_wide_angle**: Enable wide-angle lens - **view_close_up**: Enable close-up view +- **view_bottom_up**: Enable bottom-up view + +--- + +### 2. Relighting Prompt Generator + +#### Node Inputs +**Dropdown:** +- **light_direction**: Select the light source direction + - front = 前方 (Front) + - front_left = 左前方 (Front Left) + - left = 左方 (Left) + - back_left = 左后方 (Back Left) + - back = 后方 (Back) + - back_right = 右后方 (Back Right) + - right = 右方 (Right) + - front_right = 右前方 (Front Right) + - above = 上方 (Above) + - below = 下方 (Below) + +**Buttons (Boolean):** +- **use_chinese**: Toggle between Chinese (True) and English (False) output + - True = Chinese prompt (default) + - False = English prompt ## Output -Single STRING output containing the complete bilingual camera control prompt, ready to use with dx8152's MultiAngle LoRA. +Both nodes output a single STRING containing the complete prompt, ready to use with dx8152's MultiAngle LoRA and relighting workflows. ## Example Usage + +### Camera Control Prompt Generator **Inputs:** -- move_horizontal: 1 (right) -- move_vertical: 0 -- move_forward: 1 -- rotate: 45 (right rotation) +- move_horizontal: right +- move_vertical: none +- move_forward: yes +- rotate: 45 - view_top_down: False - view_wide_angle: True - view_close_up: False +- view_bottom_up: False **Output:** ``` 将镜头向右移动 Move the camera right. 将镜头向前移动 Move the camera forward. 将镜头向右旋转45度 Rotate the camera 45 degrees to the right. 将镜头转为广角镜头 Turn the camera to a wide-angle lens. ``` +--- + +### Relighting Prompt Generator +**Inputs (Chinese):** +- light_direction: front_left +- use_chinese: True + +**Output:** +``` +使用图2的亮度贴图对图1重新照明(光源来自左前方) +``` + +**Inputs (English):** +- light_direction: back_right +- use_chinese: False + +**Output:** +``` +Relight Figure 1 using the luminance map from Figure 2 (light source from the back right) +``` + ## Compatibility - **ComfyUI**: Latest versions - **LoRA**: Optimized for dx8152's MultiAngle LoRA diff --git a/__init__.py b/__init__.py index 883d80e..64f3695 100644 --- a/__init__.py +++ b/__init__.py @@ -7,14 +7,13 @@ Optimized for: dx8152's MultiAngle LoRA License: MIT """ -from .camera_control_prompt_node import CameraControlPromptNode +from .camera_control_prompt_node import NODE_CLASS_MAPPINGS as CAMERA_MAPPINGS +from .camera_control_prompt_node import NODE_DISPLAY_NAME_MAPPINGS as CAMERA_DISPLAY_MAPPINGS +from .light_control_prompt_node import NODE_CLASS_MAPPINGS as LIGHT_MAPPINGS +from .light_control_prompt_node import NODE_DISPLAY_NAME_MAPPINGS as LIGHT_DISPLAY_MAPPINGS -NODE_CLASS_MAPPINGS = { - "CameraControlPromptNode": CameraControlPromptNode -} - -NODE_DISPLAY_NAME_MAPPINGS = { - "CameraControlPromptNode": "Camera Control Prompt Generator" -} +# Merge dei mappings da entrambi i nodi +NODE_CLASS_MAPPINGS = {**CAMERA_MAPPINGS, **LIGHT_MAPPINGS} +NODE_DISPLAY_NAME_MAPPINGS = {**CAMERA_DISPLAY_MAPPINGS, **LIGHT_DISPLAY_MAPPINGS} __all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS'] diff --git a/light_control_prompt_node.py b/light_control_prompt_node.py new file mode 100644 index 0000000..ba75773 --- /dev/null +++ b/light_control_prompt_node.py @@ -0,0 +1,91 @@ +""" +Light Control Prompt Node for ComfyUI +Generates lighting direction prompts for image relighting + +Author: Lorenzo Mercu +Description: Light control prompt generator for relighting workflows +Features: Multi-directional light source control, bilingual prompts +""" + + +class RelightingPromptNode: + """ + Nodo che genera il prompt ottimizzato per il relighting + basandosi sulla direzione della luce selezionata + """ + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "light_direction": ([ + "front", # 前方 + "front_left", # 左前方 + "left", # 左方 + "back_left", # 左后方 + "back", # 后方 + "back_right", # 右后方 + "right", # 右方 + "front_right", # 右前方 + "above", # 上方 + "below" # 下方 + ], {"default": "front"}), + "use_chinese": ("BOOLEAN", {"default": True}), + } + } + + RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("prompt",) + FUNCTION = "generate_prompt" + CATEGORY = "relighting" + + def generate_prompt(self, light_direction, use_chinese): + """Genera il prompt basato sulla direzione della luce""" + + # Mappatura direzioni luce - Cinese + light_directions_cn = { + "front": "光源来自前方", + "front_left": "光源来自左前方", + "left": "光源来自左方", + "back_left": "光源来自左后方", + "back": "光源来自后方", + "back_right": "光源来自右后方", + "right": "光源来自右方", + "front_right": "光源来自右前方", + "above": "光源来自上方", + "below": "光源来自下方" + } + + # Mappatura direzioni luce - Inglese + light_directions_en = { + "front": "light source from the front", + "front_left": "light source from the front left", + "left": "light source from the left", + "back_left": "light source from the back left", + "back": "light source from the back", + "back_right": "light source from the back right", + "right": "light source from the right", + "front_right": "light source from the front right", + "above": "light source from above", + "below": "light source from below" + } + + # Genera il prompt nella lingua selezionata + if use_chinese: + direction_text = light_directions_cn.get(light_direction, "光源来自前方") + final_prompt = f"使用图2的亮度贴图对图1重新照明({direction_text})" + else: + direction_text = light_directions_en.get(light_direction, "light source from the front") + final_prompt = f"Relight Figure 1 using the luminance map from Figure 2 ({direction_text})" + + return (final_prompt,) + + +# Mappings per ComfyUI +NODE_CLASS_MAPPINGS = { + "RelightingPromptNode": RelightingPromptNode +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "RelightingPromptNode": "Relighting Prompt Generator" +} diff --git a/node.zip b/node.zip new file mode 100644 index 0000000..824597e Binary files /dev/null and b/node.zip differ diff --git a/pyproject.toml b/pyproject.toml index 66e5daa..2ab468e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "-multiple-angle-camera-control" +name = "multiple-angle-camera-control" description = "Advanced camera control prompt generator for ComfyUI, optimized for dx8152's MultiAngle LoRA. Simplifies multi-directional movements, rotations, and special views with bilingual output." version = "1.0.0" license = {file = "LICENSE"} @@ -27,7 +27,7 @@ Documentation = "https://github.com/mercu-lore/-Multiple-Angle-Camera-Control/wi [tool.comfy] PublisherId = "mercu-lore" -DisplayName = "-Multiple-Angle-Camera-Control" +DisplayName = "Multiple-Angle-Camera-Control" Icon = "" includes = [] # "requires-comfyui" = ">=1.0.0"