Add files via upload

This commit is contained in:
Lorenzo Mercugliano
2025-11-18 16:55:58 +01:00
committed by GitHub
parent b98c0f8ca5
commit 9f48b30cc7
3 changed files with 244 additions and 101 deletions
+134 -81
View File
@@ -1,81 +1,134 @@
# Camera Control Prompt Node
Advanced camera control prompt generator for ComfyUI, optimized for **dx8152's MultiAngle LoRA**.
## 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.
## 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)
- **Bilingual output** (Chinese + English prompts)
- **Optimized interface** with sliders and toggle controls
- **No redundancy** - smart parameter organization
## Installation
1. Clone or download this folder to: `ComfyUI/custom_nodes/`
2. The folder structure should be: `ComfyUI/custom_nodes/camera_control_prompt/`
3. Restart ComfyUI
## Node Inputs
### Sliders (0-1 or Range Values)
- **move_horizontal** (-1 to 1): Left/Right camera movement
- -1 = Move left
- 0 = No movement
- 1 = Move right
- **move_vertical** (-1 to 1): Up/Down camera movement
- -1 = Move down
- 0 = No movement
- 1 = Move up
- **move_forward** (0 to 1): Forward camera movement (toggle)
- 0 = No movement
- 1 = Move forward
- **rotate** (-90 to 90, step 45): Camera rotation
- -90 = Rotate 90° left
- -45 = Rotate 45° left
- 0 = No rotation
- 45 = Rotate 45° right
- 90 = Rotate 90° right
### Buttons (Boolean)
- **view_top_down**: Enable top-down view
- **view_wide_angle**: Enable wide-angle lens
- **view_close_up**: Enable close-up view
## Output
Single STRING output containing the complete bilingual camera control prompt, ready to use with dx8152's MultiAngle LoRA.
## Example Usage
**Inputs:**
- move_horizontal: 1 (right)
- move_vertical: 0
- move_forward: 1
- rotate: 45 (right rotation)
- view_top_down: False
- view_wide_angle: True
- view_close_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.
```
## Compatibility
- **ComfyUI**: Latest versions
- **LoRA**: Optimized for dx8152's MultiAngle LoRA
- **Language**: Python 3.8+
## License
MIT
## Credits
- **Node Author**: Lorenzo Mercu
- **Optimized for**: dx8152's MultiAngle LoRA
# Camera Control & Relighting Prompt Nodes
Advanced prompt generators for ComfyUI, optimized for **dx8152's MultiAngle LoRA** and relighting workflows.
## Author
**Lorenzo Mercugliano**
## Description
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, toggles, and dropdowns
- **No redundancy** - smart parameter organization
## Installation
1. Clone or download this folder to: `ComfyUI/custom_nodes/`
2. The folder structure should be: `ComfyUI/custom_nodes/camera_control_prompt/`
3. Restart ComfyUI
## Nodes
### 1. Camera Control Prompt Generator
#### Node Inputs
**Dropdowns:**
- **move_horizontal**: Left/Right camera movement
- none = No movement
- left = Move left
- right = Move right
- **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
- 0 = No rotation
- 45 = Rotate 45° right
- 90 = Rotate 90° right
**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
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: 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
- **Language**: Python 3.8+
## License
MIT
## Credits
- **Node Author**: Lorenzo Mercu
- **Optimized for**: dx8152's MultiAngle LoRA
+19 -20
View File
@@ -1,20 +1,19 @@
"""
Camera Control Prompt Node - ComfyUI Custom Node
Optimized for dx8152's MultiAngle LoRA
Author: Lorenzo Mercu
Optimized for: dx8152's MultiAngle LoRA
License: MIT
"""
from .camera_control_prompt_node import CameraControlPromptNode
NODE_CLASS_MAPPINGS = {
"CameraControlPromptNode": CameraControlPromptNode
}
NODE_DISPLAY_NAME_MAPPINGS = {
"CameraControlPromptNode": "Camera Control Prompt Generator"
}
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
"""
Camera Control Prompt Node - ComfyUI Custom Node
Optimized for dx8152's MultiAngle LoRA
Author: Lorenzo Mercu
Optimized for: dx8152's MultiAngle LoRA
License: MIT
"""
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
# 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']
+91
View File
@@ -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"
}