├── requirements.txt ├── Image ├── Video.gif ├── audio.gif ├── image.gif ├── AudiotoTD.png ├── Hy3DtoTD.png ├── ImagetoTD.png ├── Manager.png ├── VideotoTD.png ├── LoadTDImage.png ├── PointCloud.gif ├── Tripo3DtoTD.png ├── TripoSRtoTD.png ├── Comfy3DPacktoTD.png └── ImagetoTD(JPEG).png ├── ComfyUI2TD_JISEN_v5.2.8.tox ├── pyproject.toml ├── __init__.py ├── .github └── workflows │ └── publish.yml ├── Workflows ├── Live_Portrait_01.json ├── Tripo3D_PointCloud.json ├── 3DP_Trellis.json ├── 3DP_TripoSR.json ├── 3DP_StableFast3D.json ├── TripoSR_PointCloud.json ├── Text2Image_Base.json ├── 3DP_Hunyuan3D_V2.json ├── Image2Image_Base.json ├── Text2Image_LCM.json ├── Text2Image_Lora.json ├── Image2Image_Lora.json ├── SD_Turbo_img2img.json ├── SD_Turbo_img2img_JPEG.json ├── ConrtolNet_Base.json ├── ConrtolNet_Lora.json ├── Animatediff_Text2Video.json ├── Animatediff_Image2Video_Scribble.json └── Hunyuan3D_PointCloud.json ├── README.md ├── README_zh.md ├── LICENSE └── node.py /requirements.txt: -------------------------------------------------------------------------------- 1 | trimesh 2 | imageio_ffmpeg -------------------------------------------------------------------------------- /Image/Video.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiSenHua/ComfyUI-TD/HEAD/Image/Video.gif -------------------------------------------------------------------------------- /Image/audio.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiSenHua/ComfyUI-TD/HEAD/Image/audio.gif -------------------------------------------------------------------------------- /Image/image.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiSenHua/ComfyUI-TD/HEAD/Image/image.gif -------------------------------------------------------------------------------- /Image/AudiotoTD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiSenHua/ComfyUI-TD/HEAD/Image/AudiotoTD.png -------------------------------------------------------------------------------- /Image/Hy3DtoTD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiSenHua/ComfyUI-TD/HEAD/Image/Hy3DtoTD.png -------------------------------------------------------------------------------- /Image/ImagetoTD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiSenHua/ComfyUI-TD/HEAD/Image/ImagetoTD.png -------------------------------------------------------------------------------- /Image/Manager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiSenHua/ComfyUI-TD/HEAD/Image/Manager.png -------------------------------------------------------------------------------- /Image/VideotoTD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiSenHua/ComfyUI-TD/HEAD/Image/VideotoTD.png -------------------------------------------------------------------------------- /Image/LoadTDImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiSenHua/ComfyUI-TD/HEAD/Image/LoadTDImage.png -------------------------------------------------------------------------------- /Image/PointCloud.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiSenHua/ComfyUI-TD/HEAD/Image/PointCloud.gif -------------------------------------------------------------------------------- /Image/Tripo3DtoTD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiSenHua/ComfyUI-TD/HEAD/Image/Tripo3DtoTD.png -------------------------------------------------------------------------------- /Image/TripoSRtoTD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiSenHua/ComfyUI-TD/HEAD/Image/TripoSRtoTD.png -------------------------------------------------------------------------------- /Image/Comfy3DPacktoTD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiSenHua/ComfyUI-TD/HEAD/Image/Comfy3DPacktoTD.png -------------------------------------------------------------------------------- /Image/ImagetoTD(JPEG).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiSenHua/ComfyUI-TD/HEAD/Image/ImagetoTD(JPEG).png -------------------------------------------------------------------------------- /ComfyUI2TD_JISEN_v5.2.8.tox: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JiSenHua/ComfyUI-TD/HEAD/ComfyUI2TD_JISEN_v5.2.8.tox -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "ComfyUI-TD" 3 | description = "A custom node for ComfyUI designed to facilitate the real-time transmission of rendered images, videos, or 3D models to TouchDesigner." 4 | version = "1.1.2" 5 | license = {file = "LICENSE"} 6 | 7 | [project.urls] 8 | Repository = "https://github.com/JiSenHua/ComfyUI-TD" 9 | # Used by Comfy Registry https://comfyregistry.org 10 | 11 | [tool.comfy] 12 | PublisherId = "jisenhua" 13 | DisplayName = "ComfyUI-TD" 14 | Icon = "" 15 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | from .node import * 2 | 3 | NODE_CLASS_MAPPINGS = { 4 | "Comfy3DPacktoTD": Comfy3DPacktoTD, 5 | "Hy3DtoTD": Hy3DtoTD, 6 | "ImagetoTD": ImagetoTD, 7 | "ImagetoTD(JPEG)": ImagetoTD_JPEG, 8 | "Tripo3DtoTD": Tripo3DtoTD, 9 | "TripoSRtoTD": TripoSRtoTD, 10 | "LoadTDImage": LoadTDImage, 11 | "VideotoTD": VideotoTD, 12 | "AudiotoTD": AudiotoTD, 13 | } 14 | 15 | NODE_DISPLAY_NAME_MAPPINGS = { 16 | "Comfy3DPacktoTD": "Comfy3DPacktoTD", 17 | "Hy3DtoTD": "Hy3DtoTD", 18 | "ImagetoTD": "ImagetoTD", 19 | "ImagetoTD(JPEG)": "ImagetoTD(JPEG)", 20 | "Tripo3DtoTD": "Tripo3DtoTD", 21 | "TripoSRtoTD": "TripoSRtoTD", 22 | "LoadTDImage": "LoadTDImage", 23 | "VideotoTD": "VideotoTD", 24 | "AudiotoTD": "AudiotoTD", 25 | } 26 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish to Comfy registry 2 | on: 3 | workflow_dispatch: 4 | push: 5 | branches: 6 | - main 7 | - master 8 | paths: 9 | - "pyproject.toml" 10 | 11 | permissions: 12 | issues: write 13 | 14 | jobs: 15 | publish-node: 16 | name: Publish Custom Node to registry 17 | runs-on: ubuntu-latest 18 | if: ${{ github.repository_owner == 'JiSenHua' }} 19 | steps: 20 | - name: Check out code 21 | uses: actions/checkout@v4 22 | with: 23 | submodules: true 24 | - name: Publish Custom Node 25 | uses: Comfy-Org/publish-node-action@v1 26 | with: 27 | ## Add your own personal access token to your Github Repository secrets and reference it here. 28 | personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }} 29 | -------------------------------------------------------------------------------- /Workflows/Live_Portrait_01.json: -------------------------------------------------------------------------------- 1 | { 2 | "14": { 3 | "inputs": { 4 | "rotate_pitch": 0, 5 | "rotate_yaw": 0, 6 | "rotate_roll": 0, 7 | "blink": 0, 8 | "eyebrow": 0, 9 | "wink": 23.5, 10 | "pupil_x": 0, 11 | "pupil_y": 0, 12 | "aaa": 0, 13 | "eee": 0, 14 | "woo": 0, 15 | "smile": 0, 16 | "src_ratio": 1, 17 | "sample_ratio": 1, 18 | "sample_parts": "OnlyExpression", 19 | "crop_factor": 1.7000000000000002, 20 | "src_image": [ 21 | "36", 22 | 0 23 | ] 24 | }, 25 | "class_type": "ExpressionEditor", 26 | "_meta": { 27 | "title": "Expression Editor (PHM)" 28 | } 29 | }, 30 | "36": { 31 | "inputs": { 32 | "image": "" 33 | }, 34 | "class_type": "LoadTDImage", 35 | "_meta": { 36 | "title": "LoadTDImage" 37 | } 38 | }, 39 | "37": { 40 | "inputs": { 41 | "broadcast": false, 42 | "images": [ 43 | "14", 44 | 0 45 | ] 46 | }, 47 | "class_type": "ImagetoTD", 48 | "_meta": { 49 | "title": "ImagetoTD" 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Workflows/Tripo3D_PointCloud.json: -------------------------------------------------------------------------------- 1 | { 2 | "18": { 3 | "inputs": { 4 | "mode": "image_to_model", 5 | "apikey": "", 6 | "prompt": "a Pikachu model", 7 | "model_version": "v2.5-20250123", 8 | "style": "None", 9 | "texture": true, 10 | "pbr": true, 11 | "image_seed": 42, 12 | "model_seed": 42, 13 | "texture_seed": 42, 14 | "texture_quality": "standard", 15 | "texture_alignment": "original_image", 16 | "face_limit": -1, 17 | "quad": false, 18 | "image": [ 19 | "28", 20 | 0 21 | ] 22 | }, 23 | "class_type": "TripoAPIDraft", 24 | "_meta": { 25 | "title": "Tripo: Generate model" 26 | } 27 | }, 28 | "24": { 29 | "inputs": { 30 | "model_file": [ 31 | "18", 32 | 0 33 | ], 34 | "broadcast": false 35 | }, 36 | "class_type": "Tripo3DtoTD", 37 | "_meta": { 38 | "title": "Tripo3DtoTD" 39 | } 40 | }, 41 | "28": { 42 | "inputs": { 43 | "image": "" 44 | }, 45 | "class_type": "LoadTDImage", 46 | "_meta": { 47 | "title": "LoadTDImage" 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Workflows/3DP_Trellis.json: -------------------------------------------------------------------------------- 1 | { 2 | "4": { 3 | "inputs": { 4 | "mask": [ 5 | "21", 6 | 1 7 | ] 8 | }, 9 | "class_type": "InvertMask", 10 | "_meta": { 11 | "title": "反转遮罩" 12 | } 13 | }, 14 | "9": { 15 | "inputs": { 16 | "repo_id": "JeffreyXiang/TRELLIS-image-large" 17 | }, 18 | "class_type": "[Comfy3D] Load Trellis Structured 3D Latents Models", 19 | "_meta": { 20 | "title": "Load Trellis Structured 3D Latents Models" 21 | } 22 | }, 23 | "10": { 24 | "inputs": { 25 | "seed": 82615315223344, 26 | "sparse_structure_guidance_scale": 7.5, 27 | "sparse_structure_sample_steps": 12, 28 | "structured_latent_guidance_scale": 3, 29 | "structured_latent_sample_steps": 12, 30 | "trellis_pipe": [ 31 | "9", 32 | 0 33 | ], 34 | "reference_image": [ 35 | "21", 36 | 0 37 | ], 38 | "reference_mask": [ 39 | "4", 40 | 0 41 | ] 42 | }, 43 | "class_type": "[Comfy3D] Trellis Structured 3D Latents Models", 44 | "_meta": { 45 | "title": "Trellis Structured 3D Latents Models" 46 | } 47 | }, 48 | "21": { 49 | "inputs": { 50 | "image": "" 51 | }, 52 | "class_type": "LoadTDImage", 53 | "_meta": { 54 | "title": "LoadTDImage" 55 | } 56 | }, 57 | "22": { 58 | "inputs": { 59 | "broadcast": false, 60 | "mesh": [ 61 | "10", 62 | 0 63 | ] 64 | }, 65 | "class_type": "Comfy3DPacktoTD", 66 | "_meta": { 67 | "title": "Comfy3DPacktoTD" 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Workflows/3DP_TripoSR.json: -------------------------------------------------------------------------------- 1 | { 2 | "20": { 3 | "inputs": { 4 | "geometry_extract_resolution": 256, 5 | "marching_cude_threshold": 25, 6 | "tsr_model": [ 7 | "21", 8 | 0 9 | ], 10 | "reference_image": [ 11 | "27", 12 | 0 13 | ], 14 | "reference_mask": [ 15 | "22", 16 | 0 17 | ] 18 | }, 19 | "class_type": "[Comfy3D] TripoSR", 20 | "_meta": { 21 | "title": "TripoSR" 22 | } 23 | }, 24 | "21": { 25 | "inputs": { 26 | "model_name": "model.ckpt", 27 | "chunk_size": 8192 28 | }, 29 | "class_type": "[Comfy3D] Load TripoSR Model", 30 | "_meta": { 31 | "title": "Load TripoSR Model" 32 | } 33 | }, 34 | "22": { 35 | "inputs": { 36 | "mask": [ 37 | "27", 38 | 1 39 | ] 40 | }, 41 | "class_type": "InvertMask", 42 | "_meta": { 43 | "title": "反转遮罩" 44 | } 45 | }, 46 | "25": { 47 | "inputs": { 48 | "axis_x_to": "+y", 49 | "axis_y_to": "+z", 50 | "axis_z_to": "+x", 51 | "flip_normal": false, 52 | "scale": 1, 53 | "mesh": [ 54 | "20", 55 | 0 56 | ] 57 | }, 58 | "class_type": "[Comfy3D] Switch Mesh Axis", 59 | "_meta": { 60 | "title": "Switch Mesh Axis" 61 | } 62 | }, 63 | "26": { 64 | "inputs": { 65 | "broadcast": false, 66 | "mesh": [ 67 | "25", 68 | 0 69 | ] 70 | }, 71 | "class_type": "Comfy3DPacktoTD", 72 | "_meta": { 73 | "title": "Comfy3DPacktoTD" 74 | } 75 | }, 76 | "27": { 77 | "inputs": { 78 | "image": "" 79 | }, 80 | "class_type": "LoadTDImage", 81 | "_meta": { 82 | "title": "LoadTDImage" 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Workflows/3DP_StableFast3D.json: -------------------------------------------------------------------------------- 1 | { 2 | "20": { 3 | "inputs": { 4 | "mask": [ 5 | "44", 6 | 1 7 | ] 8 | }, 9 | "class_type": "InvertMask", 10 | "_meta": { 11 | "title": "反转遮罩" 12 | } 13 | }, 14 | "36": { 15 | "inputs": { 16 | "model_name": "model.safetensors" 17 | }, 18 | "class_type": "[Comfy3D] Load SF3D Model", 19 | "_meta": { 20 | "title": "Load SF3D Model" 21 | } 22 | }, 23 | "37": { 24 | "inputs": { 25 | "texture_resolution": 1024, 26 | "remesh_option": "None", 27 | "sf3d_model": [ 28 | "36", 29 | 0 30 | ], 31 | "reference_image": [ 32 | "40", 33 | 0 34 | ], 35 | "reference_mask": [ 36 | "40", 37 | 1 38 | ] 39 | }, 40 | "class_type": "[Comfy3D] StableFast3D", 41 | "_meta": { 42 | "title": "StableFast3D" 43 | } 44 | }, 45 | "40": { 46 | "inputs": { 47 | "foreground_ratio": 0.85, 48 | "images": [ 49 | "44", 50 | 0 51 | ], 52 | "masks": [ 53 | "20", 54 | 0 55 | ] 56 | }, 57 | "class_type": "[Comfy3D] Resize Image Foreground", 58 | "_meta": { 59 | "title": "Resize Image Foreground" 60 | } 61 | }, 62 | "43": { 63 | "inputs": { 64 | "axis_x_to": "-x", 65 | "axis_y_to": "+y", 66 | "axis_z_to": "-z", 67 | "flip_normal": false, 68 | "scale": 1, 69 | "mesh": [ 70 | "37", 71 | 0 72 | ] 73 | }, 74 | "class_type": "[Comfy3D] Switch Mesh Axis", 75 | "_meta": { 76 | "title": "Switch Mesh Axis" 77 | } 78 | }, 79 | "44": { 80 | "inputs": { 81 | "image": "" 82 | }, 83 | "class_type": "LoadTDImage", 84 | "_meta": { 85 | "title": "LoadTDImage" 86 | } 87 | }, 88 | "45": { 89 | "inputs": { 90 | "broadcast": false, 91 | "mesh": [ 92 | "43", 93 | 0 94 | ] 95 | }, 96 | "class_type": "Comfy3DPacktoTD", 97 | "_meta": { 98 | "title": "Comfy3DPacktoTD" 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /Workflows/TripoSR_PointCloud.json: -------------------------------------------------------------------------------- 1 | { 2 | "12": { 3 | "inputs": { 4 | "geometry_resolution": 256, 5 | "threshold": 25, 6 | "model": [ 7 | "14", 8 | 0 9 | ], 10 | "reference_image": [ 11 | "33", 12 | 0 13 | ], 14 | "reference_mask": [ 15 | "33", 16 | 1 17 | ] 18 | }, 19 | "class_type": "TripoSRSampler", 20 | "_meta": { 21 | "title": "TripoSR Sampler" 22 | } 23 | }, 24 | "14": { 25 | "inputs": { 26 | "model": "TripoSRmodel.ckpt", 27 | "chunk_size": 8192 28 | }, 29 | "class_type": "TripoSRModelLoader", 30 | "_meta": { 31 | "title": "TripoSR Model Loader" 32 | } 33 | }, 34 | "29": { 35 | "inputs": { 36 | "image": [ 37 | "34", 38 | 0 39 | ] 40 | }, 41 | "class_type": "SplitImageWithAlpha", 42 | "_meta": { 43 | "title": "分离图像Alpha" 44 | } 45 | }, 46 | "32": { 47 | "inputs": { 48 | "model": "u2net: general purpose", 49 | "providers": "CUDA" 50 | }, 51 | "class_type": "RemBGSession+", 52 | "_meta": { 53 | "title": "🔧 RemBG Session" 54 | } 55 | }, 56 | "33": { 57 | "inputs": { 58 | "rembg_session": [ 59 | "32", 60 | 0 61 | ], 62 | "image": [ 63 | "29", 64 | 0 65 | ] 66 | }, 67 | "class_type": "ImageRemoveBackground+", 68 | "_meta": { 69 | "title": "🔧 Image Remove Background" 70 | } 71 | }, 72 | "34": { 73 | "inputs": { 74 | "width": 512, 75 | "height": 512, 76 | "interpolation": "nearest", 77 | "method": "pad", 78 | "condition": "always", 79 | "multiple_of": 0, 80 | "image": [ 81 | "37", 82 | 0 83 | ] 84 | }, 85 | "class_type": "ImageResize+", 86 | "_meta": { 87 | "title": "🔧 Image Resize" 88 | } 89 | }, 90 | "37": { 91 | "inputs": { 92 | "image": "" 93 | }, 94 | "class_type": "LoadTDImage", 95 | "_meta": { 96 | "title": "LoadTDImage" 97 | } 98 | }, 99 | "38": { 100 | "inputs": { 101 | "broadcast": false, 102 | "mesh": [ 103 | "12", 104 | 0 105 | ] 106 | }, 107 | "class_type": "TripoSRtoTD", 108 | "_meta": { 109 | "title": "TripoSRtoTD" 110 | } 111 | } 112 | } -------------------------------------------------------------------------------- /Workflows/Text2Image_Base.json: -------------------------------------------------------------------------------- 1 | { 2 | "1": { 3 | "inputs": { 4 | "ckpt_name": "SD1.5_dreamshaper_8.safetensors" 5 | }, 6 | "class_type": "CheckpointLoaderSimple", 7 | "_meta": { 8 | "title": "Checkpoint 模型加载" 9 | } 10 | }, 11 | "3": { 12 | "inputs": { 13 | "width": 512, 14 | "height": 512, 15 | "batch_size": 1 16 | }, 17 | "class_type": "EmptyLatentImage", 18 | "_meta": { 19 | "title": "Latent 潜空间(图像)大小" 20 | } 21 | }, 22 | "4": { 23 | "inputs": { 24 | "text": "cat, bed, realistic, high quality", 25 | "clip": [ 26 | "1", 27 | 1 28 | ] 29 | }, 30 | "class_type": "CLIPTextEncode", 31 | "_meta": { 32 | "title": "CLIP文本编码器 正向提示词" 33 | } 34 | }, 35 | "5": { 36 | "inputs": { 37 | "text": "bad quality, bad anatomy, worst quality, low quality, low resolution, extra fingers, blur, blurry, ugly, wrong proportions, watermark, image artifacts, lowres, ugly, jpeg artifacts, deformed, noisy image, deformation, skin moles", 38 | "clip": [ 39 | "1", 40 | 1 41 | ] 42 | }, 43 | "class_type": "CLIPTextEncode", 44 | "_meta": { 45 | "title": "CLIP文本编码器 负向提示词" 46 | } 47 | }, 48 | "6": { 49 | "inputs": { 50 | "seed": 0, 51 | "steps": 20, 52 | "cfg": 8, 53 | "sampler_name": "euler", 54 | "scheduler": "normal", 55 | "denoise": 1, 56 | "model": [ 57 | "1", 58 | 0 59 | ], 60 | "positive": [ 61 | "4", 62 | 0 63 | ], 64 | "negative": [ 65 | "5", 66 | 0 67 | ], 68 | "latent_image": [ 69 | "3", 70 | 0 71 | ] 72 | }, 73 | "class_type": "KSampler", 74 | "_meta": { 75 | "title": "Ksampler 采样器" 76 | } 77 | }, 78 | "8": { 79 | "inputs": { 80 | "samples": [ 81 | "6", 82 | 0 83 | ], 84 | "vae": [ 85 | "1", 86 | 2 87 | ] 88 | }, 89 | "class_type": "VAEDecode", 90 | "_meta": { 91 | "title": "VAE解码" 92 | } 93 | }, 94 | "9": { 95 | "inputs": { 96 | "broadcast": false, 97 | "images": [ 98 | "8", 99 | 0 100 | ] 101 | }, 102 | "class_type": "ImagetoTD", 103 | "_meta": { 104 | "title": "ImagetoTD" 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /Workflows/3DP_Hunyuan3D_V2.json: -------------------------------------------------------------------------------- 1 | { 2 | "10": { 3 | "inputs": { 4 | "diffusers_pipeline_name": "Hunyuan3DDiTFlowMatchingPipeline", 5 | "repo_id": "tencent/Hunyuan3D-2", 6 | "custom_pipeline": "", 7 | "force_download": false, 8 | "checkpoint_sub_dir": "" 9 | }, 10 | "class_type": "[Comfy3D] Load Diffusers Pipeline", 11 | "_meta": { 12 | "title": "Load Diffusers Pipeline" 13 | } 14 | }, 15 | "11": { 16 | "inputs": { 17 | "diffusers_pipeline_name": "Hunyuan3DPaintPipeline", 18 | "repo_id": "tencent/Hunyuan3D-2", 19 | "custom_pipeline": "", 20 | "force_download": false, 21 | "checkpoint_sub_dir": "" 22 | }, 23 | "class_type": "[Comfy3D] Load Diffusers Pipeline", 24 | "_meta": { 25 | "title": "Load Diffusers Pipeline" 26 | } 27 | }, 28 | "12": { 29 | "inputs": { 30 | "seed": 1234, 31 | "guidance_scale": 5.5, 32 | "num_inference_steps": 30, 33 | "octree_resolution": 256, 34 | "hunyuan3d_v2_i23d_pipe": [ 35 | "10", 36 | 0 37 | ], 38 | "reference_image": [ 39 | "23", 40 | 0 41 | ], 42 | "reference_mask": [ 43 | "14", 44 | 0 45 | ] 46 | }, 47 | "class_type": "[Comfy3D] Hunyuan3D V2 DiT Flow Matching Model", 48 | "_meta": { 49 | "title": "Hunyuan3D V2 DiT Flow Matching Model" 50 | } 51 | }, 52 | "14": { 53 | "inputs": { 54 | "mask": [ 55 | "23", 56 | 1 57 | ] 58 | }, 59 | "class_type": "InvertMask", 60 | "_meta": { 61 | "title": "反转遮罩" 62 | } 63 | }, 64 | "17": { 65 | "inputs": { 66 | "hunyuan3d_v2_texgen_pipe": [ 67 | "11", 68 | 0 69 | ], 70 | "reference_image": [ 71 | "23", 72 | 0 73 | ], 74 | "reference_mask": [ 75 | "14", 76 | 0 77 | ], 78 | "mesh": [ 79 | "12", 80 | 0 81 | ] 82 | }, 83 | "class_type": "[Comfy3D] Hunyuan3D V2 Paint Model", 84 | "_meta": { 85 | "title": "Hunyuan3D V2 Paint Model" 86 | } 87 | }, 88 | "23": { 89 | "inputs": { 90 | "image": "" 91 | }, 92 | "class_type": "LoadTDImage", 93 | "_meta": { 94 | "title": "LoadTDImage" 95 | } 96 | }, 97 | "24": { 98 | "inputs": { 99 | "broadcast": false, 100 | "mesh": [ 101 | "17", 102 | 0 103 | ] 104 | }, 105 | "class_type": "Comfy3DPacktoTD", 106 | "_meta": { 107 | "title": "Comfy3DPacktoTD" 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /Workflows/Image2Image_Base.json: -------------------------------------------------------------------------------- 1 | { 2 | "1": { 3 | "inputs": { 4 | "ckpt_name": "SD1.5_dreamshaper_8.safetensors" 5 | }, 6 | "class_type": "CheckpointLoaderSimple", 7 | "_meta": { 8 | "title": "Checkpoint 模型加载" 9 | } 10 | }, 11 | "4": { 12 | "inputs": { 13 | "text": "man, Comic style, hight quality", 14 | "clip": [ 15 | "1", 16 | 1 17 | ] 18 | }, 19 | "class_type": "CLIPTextEncode", 20 | "_meta": { 21 | "title": "CLIP文本编码器 正向提示词" 22 | } 23 | }, 24 | "5": { 25 | "inputs": { 26 | "text": "bad quality, bad anatomy, worst quality, low quality, low resolution, extra fingers, blur, blurry, ugly, wrong proportions, watermark, image artifacts, lowres, ugly, jpeg artifacts, deformed, noisy image, deformation, skin moles", 27 | "clip": [ 28 | "1", 29 | 1 30 | ] 31 | }, 32 | "class_type": "CLIPTextEncode", 33 | "_meta": { 34 | "title": "CLIP文本编码器 负向提示词" 35 | } 36 | }, 37 | "6": { 38 | "inputs": { 39 | "seed": 0, 40 | "steps": 20, 41 | "cfg": 8, 42 | "sampler_name": "euler", 43 | "scheduler": "normal", 44 | "denoise": 0.6, 45 | "model": [ 46 | "1", 47 | 0 48 | ], 49 | "positive": [ 50 | "4", 51 | 0 52 | ], 53 | "negative": [ 54 | "5", 55 | 0 56 | ], 57 | "latent_image": [ 58 | "8", 59 | 0 60 | ] 61 | }, 62 | "class_type": "KSampler", 63 | "_meta": { 64 | "title": "Ksampler 采样器" 65 | } 66 | }, 67 | "8": { 68 | "inputs": { 69 | "pixels": [ 70 | "10", 71 | 0 72 | ], 73 | "vae": [ 74 | "1", 75 | 2 76 | ] 77 | }, 78 | "class_type": "VAEEncode", 79 | "_meta": { 80 | "title": "VAE编码" 81 | } 82 | }, 83 | "9": { 84 | "inputs": { 85 | "samples": [ 86 | "6", 87 | 0 88 | ], 89 | "vae": [ 90 | "1", 91 | 2 92 | ] 93 | }, 94 | "class_type": "VAEDecode", 95 | "_meta": { 96 | "title": "VAE解码" 97 | } 98 | }, 99 | "10": { 100 | "inputs": { 101 | "image": "" 102 | }, 103 | "class_type": "LoadTDImage", 104 | "_meta": { 105 | "title": "LoadTDImage" 106 | } 107 | }, 108 | "11": { 109 | "inputs": { 110 | "broadcast": false, 111 | "images": [ 112 | "9", 113 | 0 114 | ] 115 | }, 116 | "class_type": "ImagetoTD", 117 | "_meta": { 118 | "title": "ImagetoTD" 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /Workflows/Text2Image_LCM.json: -------------------------------------------------------------------------------- 1 | { 2 | "1": { 3 | "inputs": { 4 | "ckpt_name": "SD1.5_dreamshaper_8.safetensors" 5 | }, 6 | "class_type": "CheckpointLoaderSimple", 7 | "_meta": { 8 | "title": "Checkpoint 模型加载" 9 | } 10 | }, 11 | "3": { 12 | "inputs": { 13 | "width": 512, 14 | "height": 512, 15 | "batch_size": 1 16 | }, 17 | "class_type": "EmptyLatentImage", 18 | "_meta": { 19 | "title": "Latent 潜空间(图像)大小" 20 | } 21 | }, 22 | "4": { 23 | "inputs": { 24 | "text": "cat, bed, realistic, high quality", 25 | "clip": [ 26 | "1", 27 | 1 28 | ] 29 | }, 30 | "class_type": "CLIPTextEncode", 31 | "_meta": { 32 | "title": "CLIP文本编码器 正向提示词" 33 | } 34 | }, 35 | "5": { 36 | "inputs": { 37 | "text": "bad quality, bad anatomy, worst quality, low quality, low resolution, extra fingers, blur, blurry, ugly, wrong proportions, watermark, image artifacts, lowres, ugly, jpeg artifacts, deformed, noisy image, deformation, skin moles", 38 | "clip": [ 39 | "1", 40 | 1 41 | ] 42 | }, 43 | "class_type": "CLIPTextEncode", 44 | "_meta": { 45 | "title": "CLIP文本编码器 负向提示词" 46 | } 47 | }, 48 | "6": { 49 | "inputs": { 50 | "seed": 0, 51 | "steps": 3, 52 | "cfg": 1.5, 53 | "sampler_name": "lcm", 54 | "scheduler": "sgm_uniform", 55 | "denoise": 1, 56 | "model": [ 57 | "9", 58 | 0 59 | ], 60 | "positive": [ 61 | "4", 62 | 0 63 | ], 64 | "negative": [ 65 | "5", 66 | 0 67 | ], 68 | "latent_image": [ 69 | "3", 70 | 0 71 | ] 72 | }, 73 | "class_type": "KSampler", 74 | "_meta": { 75 | "title": "Ksampler 采样器" 76 | } 77 | }, 78 | "8": { 79 | "inputs": { 80 | "samples": [ 81 | "6", 82 | 0 83 | ], 84 | "vae": [ 85 | "1", 86 | 2 87 | ] 88 | }, 89 | "class_type": "VAEDecode", 90 | "_meta": { 91 | "title": "VAE解码" 92 | } 93 | }, 94 | "9": { 95 | "inputs": { 96 | "lora_name": "lcm_lora_sd15.safetensors", 97 | "strength_model": 1, 98 | "model": [ 99 | "1", 100 | 0 101 | ] 102 | }, 103 | "class_type": "LoraLoaderModelOnly", 104 | "_meta": { 105 | "title": "LoraLoaderModelOnly" 106 | } 107 | }, 108 | "10": { 109 | "inputs": { 110 | "broadcast": false, 111 | "images": [ 112 | "8", 113 | 0 114 | ] 115 | }, 116 | "class_type": "ImagetoTD", 117 | "_meta": { 118 | "title": "ImagetoTD" 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /Workflows/Text2Image_Lora.json: -------------------------------------------------------------------------------- 1 | { 2 | "1": { 3 | "inputs": { 4 | "ckpt_name": "SD1.5_dreamshaper_8.safetensors" 5 | }, 6 | "class_type": "CheckpointLoaderSimple", 7 | "_meta": { 8 | "title": "Checkpoint 模型加载" 9 | } 10 | }, 11 | "2": { 12 | "inputs": { 13 | "lora_name": "SD1.5_(增加细节)add_detail.safetensors", 14 | "strength_model": 1, 15 | "strength_clip": 1, 16 | "model": [ 17 | "1", 18 | 0 19 | ], 20 | "clip": [ 21 | "1", 22 | 1 23 | ] 24 | }, 25 | "class_type": "LoraLoader", 26 | "_meta": { 27 | "title": "LoRA 模型加载" 28 | } 29 | }, 30 | "3": { 31 | "inputs": { 32 | "width": 512, 33 | "height": 512, 34 | "batch_size": 1 35 | }, 36 | "class_type": "EmptyLatentImage", 37 | "_meta": { 38 | "title": "Latent 潜空间(图像)大小" 39 | } 40 | }, 41 | "4": { 42 | "inputs": { 43 | "text": "cat, bed, realistic, high quality", 44 | "clip": [ 45 | "2", 46 | 1 47 | ] 48 | }, 49 | "class_type": "CLIPTextEncode", 50 | "_meta": { 51 | "title": "CLIP文本编码器 正向提示词" 52 | } 53 | }, 54 | "5": { 55 | "inputs": { 56 | "text": "bad quality, bad anatomy, worst quality, low quality, low resolution, extra fingers, blur, blurry, ugly, wrong proportions, watermark, image artifacts, lowres, ugly, jpeg artifacts, deformed, noisy image, deformation, skin moles", 57 | "clip": [ 58 | "2", 59 | 1 60 | ] 61 | }, 62 | "class_type": "CLIPTextEncode", 63 | "_meta": { 64 | "title": "CLIP文本编码器 负向提示词" 65 | } 66 | }, 67 | "6": { 68 | "inputs": { 69 | "seed": 0, 70 | "steps": 20, 71 | "cfg": 8, 72 | "sampler_name": "euler", 73 | "scheduler": "normal", 74 | "denoise": 1, 75 | "model": [ 76 | "2", 77 | 0 78 | ], 79 | "positive": [ 80 | "4", 81 | 0 82 | ], 83 | "negative": [ 84 | "5", 85 | 0 86 | ], 87 | "latent_image": [ 88 | "3", 89 | 0 90 | ] 91 | }, 92 | "class_type": "KSampler", 93 | "_meta": { 94 | "title": "Ksampler 采样器" 95 | } 96 | }, 97 | "8": { 98 | "inputs": { 99 | "samples": [ 100 | "6", 101 | 0 102 | ], 103 | "vae": [ 104 | "1", 105 | 2 106 | ] 107 | }, 108 | "class_type": "VAEDecode", 109 | "_meta": { 110 | "title": "VAE解码" 111 | } 112 | }, 113 | "9": { 114 | "inputs": { 115 | "broadcast": false, 116 | "images": [ 117 | "8", 118 | 0 119 | ] 120 | }, 121 | "class_type": "ImagetoTD", 122 | "_meta": { 123 | "title": "ImagetoTD" 124 | } 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /Workflows/Image2Image_Lora.json: -------------------------------------------------------------------------------- 1 | { 2 | "1": { 3 | "inputs": { 4 | "ckpt_name": "SD1.5_dreamshaper_8.safetensors" 5 | }, 6 | "class_type": "CheckpointLoaderSimple", 7 | "_meta": { 8 | "title": "Checkpoint 模型加载" 9 | } 10 | }, 11 | "2": { 12 | "inputs": { 13 | "lora_name": "SD1.5_(增加细节)add_detail.safetensors", 14 | "strength_model": 1, 15 | "strength_clip": 1, 16 | "model": [ 17 | "1", 18 | 0 19 | ], 20 | "clip": [ 21 | "1", 22 | 1 23 | ] 24 | }, 25 | "class_type": "LoraLoader", 26 | "_meta": { 27 | "title": "LoRA 模型加载" 28 | } 29 | }, 30 | "4": { 31 | "inputs": { 32 | "text": "man, Comic style, hight quality", 33 | "clip": [ 34 | "2", 35 | 1 36 | ] 37 | }, 38 | "class_type": "CLIPTextEncode", 39 | "_meta": { 40 | "title": "CLIP文本编码器 正向提示词" 41 | } 42 | }, 43 | "5": { 44 | "inputs": { 45 | "text": "bad quality, bad anatomy, worst quality, low quality, low resolution, extra fingers, blur, blurry, ugly, wrong proportions, watermark, image artifacts, lowres, ugly, jpeg artifacts, deformed, noisy image, deformation, skin moles", 46 | "clip": [ 47 | "2", 48 | 1 49 | ] 50 | }, 51 | "class_type": "CLIPTextEncode", 52 | "_meta": { 53 | "title": "CLIP文本编码器 负向提示词" 54 | } 55 | }, 56 | "6": { 57 | "inputs": { 58 | "seed": 0, 59 | "steps": 20, 60 | "cfg": 8, 61 | "sampler_name": "euler", 62 | "scheduler": "normal", 63 | "denoise": 0.6, 64 | "model": [ 65 | "2", 66 | 0 67 | ], 68 | "positive": [ 69 | "4", 70 | 0 71 | ], 72 | "negative": [ 73 | "5", 74 | 0 75 | ], 76 | "latent_image": [ 77 | "8", 78 | 0 79 | ] 80 | }, 81 | "class_type": "KSampler", 82 | "_meta": { 83 | "title": "Ksampler 采样器" 84 | } 85 | }, 86 | "8": { 87 | "inputs": { 88 | "pixels": [ 89 | "11", 90 | 0 91 | ], 92 | "vae": [ 93 | "1", 94 | 2 95 | ] 96 | }, 97 | "class_type": "VAEEncode", 98 | "_meta": { 99 | "title": "VAE编码" 100 | } 101 | }, 102 | "9": { 103 | "inputs": { 104 | "samples": [ 105 | "6", 106 | 0 107 | ], 108 | "vae": [ 109 | "1", 110 | 2 111 | ] 112 | }, 113 | "class_type": "VAEDecode", 114 | "_meta": { 115 | "title": "VAE解码" 116 | } 117 | }, 118 | "10": { 119 | "inputs": { 120 | "broadcast": false, 121 | "images": [ 122 | "9", 123 | 0 124 | ] 125 | }, 126 | "class_type": "ImagetoTD", 127 | "_meta": { 128 | "title": "ImagetoTD" 129 | } 130 | }, 131 | "11": { 132 | "inputs": { 133 | "image": "" 134 | }, 135 | "class_type": "LoadTDImage", 136 | "_meta": { 137 | "title": "LoadTDImage" 138 | } 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /Workflows/SD_Turbo_img2img.json: -------------------------------------------------------------------------------- 1 | { 2 | "6": { 3 | "inputs": { 4 | "text": "1girl, adult woman, teal eyes, natural blonde wavy hair, detailed background, detailed face, aloha shirt, tropical forest in background, palm leaves", 5 | "clip": [ 6 | "20", 7 | 1 8 | ] 9 | }, 10 | "class_type": "CLIPTextEncode", 11 | "_meta": { 12 | "title": "CLIP文本编码" 13 | } 14 | }, 15 | "7": { 16 | "inputs": { 17 | "text": "text, watermark", 18 | "clip": [ 19 | "20", 20 | 1 21 | ] 22 | }, 23 | "class_type": "CLIPTextEncode", 24 | "_meta": { 25 | "title": "CLIP文本编码" 26 | } 27 | }, 28 | "8": { 29 | "inputs": { 30 | "samples": [ 31 | "13", 32 | 0 33 | ], 34 | "vae": [ 35 | "20", 36 | 2 37 | ] 38 | }, 39 | "class_type": "VAEDecode", 40 | "_meta": { 41 | "title": "VAE解码" 42 | } 43 | }, 44 | "13": { 45 | "inputs": { 46 | "add_noise": true, 47 | "noise_seed": 773454489337963, 48 | "cfg": 1, 49 | "model": [ 50 | "20", 51 | 0 52 | ], 53 | "positive": [ 54 | "6", 55 | 0 56 | ], 57 | "negative": [ 58 | "7", 59 | 0 60 | ], 61 | "sampler": [ 62 | "14", 63 | 0 64 | ], 65 | "sigmas": [ 66 | "22", 67 | 0 68 | ], 69 | "latent_image": [ 70 | "30", 71 | 0 72 | ] 73 | }, 74 | "class_type": "SamplerCustom", 75 | "_meta": { 76 | "title": "自定义采样器" 77 | } 78 | }, 79 | "14": { 80 | "inputs": { 81 | "sampler_name": "euler_ancestral" 82 | }, 83 | "class_type": "KSamplerSelect", 84 | "_meta": { 85 | "title": "K采样器选择" 86 | } 87 | }, 88 | "20": { 89 | "inputs": { 90 | "ckpt_name": "sd_turbo.safetensors" 91 | }, 92 | "class_type": "CheckpointLoaderSimple", 93 | "_meta": { 94 | "title": "Checkpoint加载器(简易)" 95 | } 96 | }, 97 | "22": { 98 | "inputs": { 99 | "steps": 1, 100 | "denoise": 1, 101 | "model": [ 102 | "20", 103 | 0 104 | ] 105 | }, 106 | "class_type": "SDTurboScheduler", 107 | "_meta": { 108 | "title": "SDTurbo调度器" 109 | } 110 | }, 111 | "29": { 112 | "inputs": { 113 | "image": "" 114 | }, 115 | "class_type": "LoadTDImage", 116 | "_meta": { 117 | "title": "LoadTDImage" 118 | } 119 | }, 120 | "30": { 121 | "inputs": { 122 | "pixels": [ 123 | "29", 124 | 0 125 | ], 126 | "vae": [ 127 | "20", 128 | 2 129 | ] 130 | }, 131 | "class_type": "VAEEncode", 132 | "_meta": { 133 | "title": "VAE编码" 134 | } 135 | }, 136 | "31": { 137 | "inputs": { 138 | "broadcast": false, 139 | "images": [ 140 | "8", 141 | 0 142 | ] 143 | }, 144 | "class_type": "ImagetoTD", 145 | "_meta": { 146 | "title": "ImagetoTD" 147 | } 148 | } 149 | } -------------------------------------------------------------------------------- /Workflows/SD_Turbo_img2img_JPEG.json: -------------------------------------------------------------------------------- 1 | { 2 | "6": { 3 | "inputs": { 4 | "text": "1girl, adult woman, teal eyes, natural blonde wavy hair, detailed background, detailed face, aloha shirt, tropical forest in background, palm leaves", 5 | "clip": [ 6 | "20", 7 | 1 8 | ] 9 | }, 10 | "class_type": "CLIPTextEncode", 11 | "_meta": { 12 | "title": "CLIP文本编码" 13 | } 14 | }, 15 | "7": { 16 | "inputs": { 17 | "text": "text, watermark", 18 | "clip": [ 19 | "20", 20 | 1 21 | ] 22 | }, 23 | "class_type": "CLIPTextEncode", 24 | "_meta": { 25 | "title": "CLIP文本编码" 26 | } 27 | }, 28 | "8": { 29 | "inputs": { 30 | "samples": [ 31 | "13", 32 | 0 33 | ], 34 | "vae": [ 35 | "20", 36 | 2 37 | ] 38 | }, 39 | "class_type": "VAEDecode", 40 | "_meta": { 41 | "title": "VAE解码" 42 | } 43 | }, 44 | "13": { 45 | "inputs": { 46 | "add_noise": true, 47 | "noise_seed": 773454489337963, 48 | "cfg": 1, 49 | "model": [ 50 | "20", 51 | 0 52 | ], 53 | "positive": [ 54 | "6", 55 | 0 56 | ], 57 | "negative": [ 58 | "7", 59 | 0 60 | ], 61 | "sampler": [ 62 | "14", 63 | 0 64 | ], 65 | "sigmas": [ 66 | "22", 67 | 0 68 | ], 69 | "latent_image": [ 70 | "30", 71 | 0 72 | ] 73 | }, 74 | "class_type": "SamplerCustom", 75 | "_meta": { 76 | "title": "自定义采样器" 77 | } 78 | }, 79 | "14": { 80 | "inputs": { 81 | "sampler_name": "euler_ancestral" 82 | }, 83 | "class_type": "KSamplerSelect", 84 | "_meta": { 85 | "title": "K采样器选择" 86 | } 87 | }, 88 | "20": { 89 | "inputs": { 90 | "ckpt_name": "sd_turbo.safetensors" 91 | }, 92 | "class_type": "CheckpointLoaderSimple", 93 | "_meta": { 94 | "title": "Checkpoint加载器(简易)" 95 | } 96 | }, 97 | "22": { 98 | "inputs": { 99 | "steps": 1, 100 | "denoise": 1, 101 | "model": [ 102 | "20", 103 | 0 104 | ] 105 | }, 106 | "class_type": "SDTurboScheduler", 107 | "_meta": { 108 | "title": "SDTurbo调度器" 109 | } 110 | }, 111 | "29": { 112 | "inputs": { 113 | "image": "" 114 | }, 115 | "class_type": "LoadTDImage", 116 | "_meta": { 117 | "title": "LoadTDImage" 118 | } 119 | }, 120 | "30": { 121 | "inputs": { 122 | "pixels": [ 123 | "29", 124 | 0 125 | ], 126 | "vae": [ 127 | "20", 128 | 2 129 | ] 130 | }, 131 | "class_type": "VAEEncode", 132 | "_meta": { 133 | "title": "VAE编码" 134 | } 135 | }, 136 | "32": { 137 | "inputs": { 138 | "broadcast": false, 139 | "quality": 95, 140 | "images": [ 141 | "8", 142 | 0 143 | ] 144 | }, 145 | "class_type": "ImagetoTD(JPEG)", 146 | "_meta": { 147 | "title": "ImagetoTD(JPEG)" 148 | } 149 | } 150 | } -------------------------------------------------------------------------------- /Workflows/ConrtolNet_Base.json: -------------------------------------------------------------------------------- 1 | { 2 | "1": { 3 | "inputs": { 4 | "ckpt_name": "SD1.5_dreamshaper_8.safetensors" 5 | }, 6 | "class_type": "CheckpointLoaderSimple", 7 | "_meta": { 8 | "title": "Checkpoint 模型加载" 9 | } 10 | }, 11 | "3": { 12 | "inputs": { 13 | "control_net_name": "control_v11p_sd15_canny_fp16.safetensors" 14 | }, 15 | "class_type": "ControlNetLoader", 16 | "_meta": { 17 | "title": "ControlNet 模型加载" 18 | } 19 | }, 20 | "4": { 21 | "inputs": { 22 | "preprocessor": "CannyEdgePreprocessor", 23 | "resolution": 512, 24 | "image": [ 25 | "16", 26 | 0 27 | ] 28 | }, 29 | "class_type": "AIO_Preprocessor", 30 | "_meta": { 31 | "title": "ControlNet Aux预处理器" 32 | } 33 | }, 34 | "5": { 35 | "inputs": { 36 | "strength": 1, 37 | "start_percent": 0, 38 | "end_percent": 1, 39 | "positive": [ 40 | "7", 41 | 0 42 | ], 43 | "negative": [ 44 | "8", 45 | 0 46 | ], 47 | "control_net": [ 48 | "3", 49 | 0 50 | ], 51 | "image": [ 52 | "4", 53 | 0 54 | ] 55 | }, 56 | "class_type": "ControlNetApplyAdvanced", 57 | "_meta": { 58 | "title": "ControlNet应用(高级)" 59 | } 60 | }, 61 | "7": { 62 | "inputs": { 63 | "text": "man, Comic style, hight quality", 64 | "clip": [ 65 | "1", 66 | 1 67 | ] 68 | }, 69 | "class_type": "CLIPTextEncode", 70 | "_meta": { 71 | "title": "CLIP文本编码器 正向提示词" 72 | } 73 | }, 74 | "8": { 75 | "inputs": { 76 | "text": "bad quality, bad anatomy, worst quality, low quality, low resolution, extra fingers, blur, blurry, ugly, wrong proportions, watermark, image artifacts, lowres, ugly, jpeg artifacts, deformed, noisy image, deformation, skin moles", 77 | "clip": [ 78 | "1", 79 | 1 80 | ] 81 | }, 82 | "class_type": "CLIPTextEncode", 83 | "_meta": { 84 | "title": "CLIP文本编码器 负向提示词" 85 | } 86 | }, 87 | "9": { 88 | "inputs": { 89 | "seed": 0, 90 | "steps": 20, 91 | "cfg": 8, 92 | "sampler_name": "euler", 93 | "scheduler": "normal", 94 | "denoise": 0.8, 95 | "model": [ 96 | "1", 97 | 0 98 | ], 99 | "positive": [ 100 | "5", 101 | 0 102 | ], 103 | "negative": [ 104 | "5", 105 | 1 106 | ], 107 | "latent_image": [ 108 | "13", 109 | 0 110 | ] 111 | }, 112 | "class_type": "KSampler", 113 | "_meta": { 114 | "title": "Ksampler 采样器" 115 | } 116 | }, 117 | "13": { 118 | "inputs": { 119 | "pixels": [ 120 | "16", 121 | 0 122 | ], 123 | "vae": [ 124 | "1", 125 | 2 126 | ] 127 | }, 128 | "class_type": "VAEEncode", 129 | "_meta": { 130 | "title": "VAE编码" 131 | } 132 | }, 133 | "14": { 134 | "inputs": { 135 | "samples": [ 136 | "9", 137 | 0 138 | ], 139 | "vae": [ 140 | "1", 141 | 2 142 | ] 143 | }, 144 | "class_type": "VAEDecode", 145 | "_meta": { 146 | "title": "VAE解码" 147 | } 148 | }, 149 | "15": { 150 | "inputs": { 151 | "broadcast": false, 152 | "images": [ 153 | "14", 154 | 0 155 | ] 156 | }, 157 | "class_type": "ImagetoTD", 158 | "_meta": { 159 | "title": "ImagetoTD" 160 | } 161 | }, 162 | "16": { 163 | "inputs": { 164 | "image": "" 165 | }, 166 | "class_type": "LoadTDImage", 167 | "_meta": { 168 | "title": "LoadTDImage" 169 | } 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /Workflows/ConrtolNet_Lora.json: -------------------------------------------------------------------------------- 1 | { 2 | "1": { 3 | "inputs": { 4 | "ckpt_name": "SD1.5_dreamshaper_8.safetensors" 5 | }, 6 | "class_type": "CheckpointLoaderSimple", 7 | "_meta": { 8 | "title": "Checkpoint 模型加载" 9 | } 10 | }, 11 | "2": { 12 | "inputs": { 13 | "lora_name": "SD1.5_(增加细节)add_detail.safetensors", 14 | "strength_model": 1, 15 | "strength_clip": 1, 16 | "model": [ 17 | "1", 18 | 0 19 | ], 20 | "clip": [ 21 | "1", 22 | 1 23 | ] 24 | }, 25 | "class_type": "LoraLoader", 26 | "_meta": { 27 | "title": "LoRA 模型加载" 28 | } 29 | }, 30 | "3": { 31 | "inputs": { 32 | "control_net_name": "control_v11p_sd15_canny_fp16.safetensors" 33 | }, 34 | "class_type": "ControlNetLoader", 35 | "_meta": { 36 | "title": "ControlNet 模型加载" 37 | } 38 | }, 39 | "4": { 40 | "inputs": { 41 | "preprocessor": "CannyEdgePreprocessor", 42 | "resolution": 512, 43 | "image": [ 44 | "15", 45 | 0 46 | ] 47 | }, 48 | "class_type": "AIO_Preprocessor", 49 | "_meta": { 50 | "title": "ControlNet Aux预处理器" 51 | } 52 | }, 53 | "5": { 54 | "inputs": { 55 | "strength": 1, 56 | "start_percent": 0, 57 | "end_percent": 1, 58 | "positive": [ 59 | "7", 60 | 0 61 | ], 62 | "negative": [ 63 | "8", 64 | 0 65 | ], 66 | "control_net": [ 67 | "3", 68 | 0 69 | ], 70 | "image": [ 71 | "4", 72 | 0 73 | ] 74 | }, 75 | "class_type": "ControlNetApplyAdvanced", 76 | "_meta": { 77 | "title": "ControlNet应用(高级)" 78 | } 79 | }, 80 | "7": { 81 | "inputs": { 82 | "text": "man, Comic style, hight quality", 83 | "clip": [ 84 | "2", 85 | 1 86 | ] 87 | }, 88 | "class_type": "CLIPTextEncode", 89 | "_meta": { 90 | "title": "CLIP文本编码器 正向提示词" 91 | } 92 | }, 93 | "8": { 94 | "inputs": { 95 | "text": "bad quality, bad anatomy, worst quality, low quality, low resolution, extra fingers, blur, blurry, ugly, wrong proportions, watermark, image artifacts, lowres, ugly, jpeg artifacts, deformed, noisy image, deformation, skin moles", 96 | "clip": [ 97 | "2", 98 | 1 99 | ] 100 | }, 101 | "class_type": "CLIPTextEncode", 102 | "_meta": { 103 | "title": "CLIP文本编码器 负向提示词" 104 | } 105 | }, 106 | "9": { 107 | "inputs": { 108 | "seed": 0, 109 | "steps": 20, 110 | "cfg": 8, 111 | "sampler_name": "euler", 112 | "scheduler": "normal", 113 | "denoise": 0.8, 114 | "model": [ 115 | "2", 116 | 0 117 | ], 118 | "positive": [ 119 | "5", 120 | 0 121 | ], 122 | "negative": [ 123 | "5", 124 | 1 125 | ], 126 | "latent_image": [ 127 | "13", 128 | 0 129 | ] 130 | }, 131 | "class_type": "KSampler", 132 | "_meta": { 133 | "title": "Ksampler 采样器" 134 | } 135 | }, 136 | "13": { 137 | "inputs": { 138 | "pixels": [ 139 | "15", 140 | 0 141 | ], 142 | "vae": [ 143 | "1", 144 | 2 145 | ] 146 | }, 147 | "class_type": "VAEEncode", 148 | "_meta": { 149 | "title": "VAE编码" 150 | } 151 | }, 152 | "14": { 153 | "inputs": { 154 | "samples": [ 155 | "9", 156 | 0 157 | ], 158 | "vae": [ 159 | "1", 160 | 2 161 | ] 162 | }, 163 | "class_type": "VAEDecode", 164 | "_meta": { 165 | "title": "VAE解码" 166 | } 167 | }, 168 | "15": { 169 | "inputs": { 170 | "image": "" 171 | }, 172 | "class_type": "LoadTDImage", 173 | "_meta": { 174 | "title": "LoadTDImage" 175 | } 176 | }, 177 | "16": { 178 | "inputs": { 179 | "broadcast": false, 180 | "images": [ 181 | "14", 182 | 0 183 | ] 184 | }, 185 | "class_type": "ImagetoTD", 186 | "_meta": { 187 | "title": "ImagetoTD" 188 | } 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /Workflows/Animatediff_Text2Video.json: -------------------------------------------------------------------------------- 1 | { 2 | "1": { 3 | "inputs": { 4 | "text": "low quality", 5 | "clip": [ 6 | "4", 7 | 1 8 | ] 9 | }, 10 | "class_type": "CLIPTextEncode", 11 | "_meta": { 12 | "title": "CLIP文本编码器 负向提示词" 13 | } 14 | }, 15 | "2": { 16 | "inputs": { 17 | "samples": [ 18 | "11", 19 | 0 20 | ], 21 | "vae": [ 22 | "4", 23 | 2 24 | ] 25 | }, 26 | "class_type": "VAEDecode", 27 | "_meta": { 28 | "title": "VAE解码" 29 | } 30 | }, 31 | "4": { 32 | "inputs": { 33 | "ckpt_name": "SD1.5_photon_v1.safetensors" 34 | }, 35 | "class_type": "CheckpointLoaderSimple", 36 | "_meta": { 37 | "title": "加载检查点" 38 | } 39 | }, 40 | "5": { 41 | "inputs": { 42 | "width": 512, 43 | "height": 512, 44 | "batch_size": 64 45 | }, 46 | "class_type": "EmptyLatentImage", 47 | "_meta": { 48 | "title": "空潜空间图像" 49 | } 50 | }, 51 | "6": { 52 | "inputs": { 53 | "lora_name": "AnimateLCM_sd15_t2v_lora.safetensors", 54 | "strength_model": 0.8, 55 | "model": [ 56 | "4", 57 | 0 58 | ] 59 | }, 60 | "class_type": "LoraLoaderModelOnly", 61 | "_meta": { 62 | "title": "仅加载LoRA模型" 63 | } 64 | }, 65 | "7": { 66 | "inputs": { 67 | "sampling": "lcm", 68 | "zsnr": false, 69 | "model": [ 70 | "6", 71 | 0 72 | ] 73 | }, 74 | "class_type": "ModelSamplingDiscrete", 75 | "_meta": { 76 | "title": "模型采样离散" 77 | } 78 | }, 79 | "8": { 80 | "inputs": { 81 | "start_percent": 0, 82 | "end_percent": 1, 83 | "motion_model": [ 84 | "9", 85 | 0 86 | ] 87 | }, 88 | "class_type": "ADE_ApplyAnimateDiffModel", 89 | "_meta": { 90 | "title": "Apply AnimateDiff Model (Adv.) 🎭🅐🅓②" 91 | } 92 | }, 93 | "9": { 94 | "inputs": { 95 | "model_name": "AnimateLCM_sd15_t2v.ckpt" 96 | }, 97 | "class_type": "ADE_LoadAnimateDiffModel", 98 | "_meta": { 99 | "title": "Load AnimateDiff Model 🎭🅐🅓②" 100 | } 101 | }, 102 | "10": { 103 | "inputs": { 104 | "beta_schedule": "lcm avg(sqrt_linear,linear)", 105 | "model": [ 106 | "7", 107 | 0 108 | ], 109 | "m_models": [ 110 | "8", 111 | 0 112 | ], 113 | "context_options": [ 114 | "20", 115 | 0 116 | ] 117 | }, 118 | "class_type": "ADE_UseEvolvedSampling", 119 | "_meta": { 120 | "title": "Use Evolved Sampling 🎭🅐🅓②" 121 | } 122 | }, 123 | "11": { 124 | "inputs": { 125 | "seed": 33698133299972, 126 | "steps": 8, 127 | "cfg": 1.8, 128 | "sampler_name": "lcm", 129 | "scheduler": "sgm_uniform", 130 | "denoise": 1, 131 | "model": [ 132 | "10", 133 | 0 134 | ], 135 | "positive": [ 136 | "13", 137 | 0 138 | ], 139 | "negative": [ 140 | "1", 141 | 0 142 | ], 143 | "latent_image": [ 144 | "5", 145 | 0 146 | ] 147 | }, 148 | "class_type": "KSampler", 149 | "_meta": { 150 | "title": "K采样器" 151 | } 152 | }, 153 | "13": { 154 | "inputs": { 155 | "text": "jellyfish in the sea,realistic,8k,best quality", 156 | "clip": [ 157 | "4", 158 | 1 159 | ] 160 | }, 161 | "class_type": "CLIPTextEncode", 162 | "_meta": { 163 | "title": "CLIP文本编码器 正向提示词" 164 | } 165 | }, 166 | "20": { 167 | "inputs": { 168 | "context_length": 16, 169 | "context_stride": 1, 170 | "context_overlap": 4, 171 | "fuse_method": "pyramid", 172 | "use_on_equal_length": false, 173 | "start_percent": 0, 174 | "guarantee_steps": 1 175 | }, 176 | "class_type": "ADE_StandardUniformContextOptions", 177 | "_meta": { 178 | "title": "Context Options◆Standard Uniform 🎭🅐🅓" 179 | } 180 | }, 181 | "21": { 182 | "inputs": { 183 | "frame_rate": 8, 184 | "quality": 75, 185 | "broadcast": false, 186 | "images": [ 187 | "2", 188 | 0 189 | ] 190 | }, 191 | "class_type": "VideotoTD", 192 | "_meta": { 193 | "title": "VideotoTD" 194 | } 195 | } 196 | } 197 | -------------------------------------------------------------------------------- /Workflows/Animatediff_Image2Video_Scribble.json: -------------------------------------------------------------------------------- 1 | { 2 | "3": { 3 | "inputs": { 4 | "seed": 945442756343725, 5 | "steps": 8, 6 | "cfg": 2, 7 | "sampler_name": "lcm", 8 | "scheduler": "sgm_uniform", 9 | "denoise": 1, 10 | "model": [ 11 | "39", 12 | 0 13 | ], 14 | "positive": [ 15 | "48", 16 | 0 17 | ], 18 | "negative": [ 19 | "48", 20 | 1 21 | ], 22 | "latent_image": [ 23 | "5", 24 | 0 25 | ] 26 | }, 27 | "class_type": "KSampler", 28 | "_meta": { 29 | "title": "K采样器" 30 | } 31 | }, 32 | "4": { 33 | "inputs": { 34 | "ckpt_name": "SD1.5_photon_v1.safetensors" 35 | }, 36 | "class_type": "CheckpointLoaderSimple", 37 | "_meta": { 38 | "title": "加载检查点" 39 | } 40 | }, 41 | "5": { 42 | "inputs": { 43 | "width": 512, 44 | "height": 512, 45 | "batch_size": 32 46 | }, 47 | "class_type": "EmptyLatentImage", 48 | "_meta": { 49 | "title": "空潜空间图像" 50 | } 51 | }, 52 | "6": { 53 | "inputs": { 54 | "text": "jellyfish in the sea,ink,8k", 55 | "clip": [ 56 | "62", 57 | 1 58 | ] 59 | }, 60 | "class_type": "CLIPTextEncode", 61 | "_meta": { 62 | "title": "CLIP文本编码器 正向提示词" 63 | } 64 | }, 65 | "7": { 66 | "inputs": { 67 | "text": "low quality", 68 | "clip": [ 69 | "62", 70 | 1 71 | ] 72 | }, 73 | "class_type": "CLIPTextEncode", 74 | "_meta": { 75 | "title": "CLIP文本编码器 负向提示词" 76 | } 77 | }, 78 | "8": { 79 | "inputs": { 80 | "samples": [ 81 | "3", 82 | 0 83 | ], 84 | "vae": [ 85 | "63", 86 | 0 87 | ] 88 | }, 89 | "class_type": "VAEDecode", 90 | "_meta": { 91 | "title": "VAE解码" 92 | } 93 | }, 94 | "37": { 95 | "inputs": { 96 | "lora_name": "AnimateLCM_sd15_t2v_lora.safetensors", 97 | "strength_model": 0.8, 98 | "model": [ 99 | "4", 100 | 0 101 | ] 102 | }, 103 | "class_type": "LoraLoaderModelOnly", 104 | "_meta": { 105 | "title": "仅加载LoRA模型" 106 | } 107 | }, 108 | "38": { 109 | "inputs": { 110 | "sampling": "lcm", 111 | "zsnr": false, 112 | "model": [ 113 | "62", 114 | 0 115 | ] 116 | }, 117 | "class_type": "ModelSamplingDiscrete", 118 | "_meta": { 119 | "title": "模型采样离散" 120 | } 121 | }, 122 | "39": { 123 | "inputs": { 124 | "beta_schedule": "lcm avg(sqrt_linear,linear)", 125 | "model": [ 126 | "38", 127 | 0 128 | ], 129 | "m_models": [ 130 | "40", 131 | 0 132 | ], 133 | "context_options": [ 134 | "59", 135 | 0 136 | ] 137 | }, 138 | "class_type": "ADE_UseEvolvedSampling", 139 | "_meta": { 140 | "title": "Use Evolved Sampling 🎭🅐🅓②" 141 | } 142 | }, 143 | "40": { 144 | "inputs": { 145 | "start_percent": 0, 146 | "end_percent": 1, 147 | "motion_model": [ 148 | "41", 149 | 0 150 | ] 151 | }, 152 | "class_type": "ADE_ApplyAnimateDiffModel", 153 | "_meta": { 154 | "title": "Apply AnimateDiff Model (Adv.) 🎭🅐🅓②" 155 | } 156 | }, 157 | "41": { 158 | "inputs": { 159 | "model_name": "AnimateLCM_sd15_t2v.ckpt" 160 | }, 161 | "class_type": "ADE_LoadAnimateDiffModel", 162 | "_meta": { 163 | "title": "Load AnimateDiff Model 🎭🅐🅓②" 164 | } 165 | }, 166 | "48": { 167 | "inputs": { 168 | "strength": 0.9, 169 | "start_percent": 0, 170 | "end_percent": 1, 171 | "positive": [ 172 | "6", 173 | 0 174 | ], 175 | "negative": [ 176 | "7", 177 | 0 178 | ], 179 | "control_net": [ 180 | "49", 181 | 0 182 | ], 183 | "image": [ 184 | "54", 185 | 0 186 | ], 187 | "vae": [ 188 | "63", 189 | 0 190 | ] 191 | }, 192 | "class_type": "ControlNetApplyAdvanced", 193 | "_meta": { 194 | "title": "应用控制网" 195 | } 196 | }, 197 | "49": { 198 | "inputs": { 199 | "sparsectrl_name": "v3_sd15_sparsectrl_scribble.ckpt", 200 | "use_motion": true, 201 | "motion_strength": 1, 202 | "motion_scale": 1, 203 | "context_aware": "nearest_hint", 204 | "sparse_hint_mult": 1, 205 | "sparse_nonhint_mult": 1, 206 | "sparse_mask_mult": 1, 207 | "sparse_method": [ 208 | "50", 209 | 0 210 | ] 211 | }, 212 | "class_type": "ACN_SparseCtrlLoaderAdvanced", 213 | "_meta": { 214 | "title": "Load SparseCtrl Model 🛂🅐🅒🅝" 215 | } 216 | }, 217 | "50": { 218 | "inputs": { 219 | "spread": "uniform" 220 | }, 221 | "class_type": "ACN_SparseCtrlSpreadMethodNode", 222 | "_meta": { 223 | "title": "SparseCtrl Spread Method 🛂🅐🅒🅝" 224 | } 225 | }, 226 | "54": { 227 | "inputs": { 228 | "width": 512, 229 | "height": 512, 230 | "upscale_method": "nearest-exact", 231 | "keep_proportion": false, 232 | "divisible_by": 2, 233 | "crop": "disabled", 234 | "image": [ 235 | "65", 236 | 0 237 | ] 238 | }, 239 | "class_type": "ImageResizeKJ", 240 | "_meta": { 241 | "title": "Resize Image" 242 | } 243 | }, 244 | "59": { 245 | "inputs": { 246 | "context_length": 16, 247 | "context_stride": 1, 248 | "context_overlap": 4, 249 | "closed_loop": false, 250 | "fuse_method": "pyramid", 251 | "use_on_equal_length": false, 252 | "start_percent": 0, 253 | "guarantee_steps": 1 254 | }, 255 | "class_type": "ADE_LoopedUniformContextOptions", 256 | "_meta": { 257 | "title": "Context Options◆Looped Uniform 🎭🅐🅓" 258 | } 259 | }, 260 | "62": { 261 | "inputs": { 262 | "lora_name": "SD1.5_(水墨山水)Ink scenery.safetensors", 263 | "strength_model": 1, 264 | "strength_clip": 1, 265 | "model": [ 266 | "37", 267 | 0 268 | ], 269 | "clip": [ 270 | "4", 271 | 1 272 | ] 273 | }, 274 | "class_type": "LoraLoader", 275 | "_meta": { 276 | "title": "加载LoRA" 277 | } 278 | }, 279 | "63": { 280 | "inputs": { 281 | "vae_name": "vaeFtMse840000EmaPruned_vaeFtMse840k.safetensors" 282 | }, 283 | "class_type": "VAELoader", 284 | "_meta": { 285 | "title": "加载VAE" 286 | } 287 | }, 288 | "65": { 289 | "inputs": { 290 | "image": "" 291 | }, 292 | "class_type": "LoadTDImage", 293 | "_meta": { 294 | "title": "Scribble 线框图" 295 | } 296 | }, 297 | "66": { 298 | "inputs": { 299 | "frame_rate": 8, 300 | "quality": 75, 301 | "broadcast": false, 302 | "images": [ 303 | "8", 304 | 0 305 | ] 306 | }, 307 | "class_type": "VideotoTD", 308 | "_meta": { 309 | "title": "VideotoTD" 310 | } 311 | } 312 | } 313 | -------------------------------------------------------------------------------- /Workflows/Hunyuan3D_PointCloud.json: -------------------------------------------------------------------------------- 1 | { 2 | "10": { 3 | "inputs": { 4 | "model": "hunyuan3d-dit-v2-0-fp16.safetensors", 5 | "attention_mode": "sdpa", 6 | "cublas_ops": false 7 | }, 8 | "class_type": "Hy3DModelLoader", 9 | "_meta": { 10 | "title": "Hy3DModelLoader" 11 | } 12 | }, 13 | "28": { 14 | "inputs": { 15 | "model": "hunyuan3d-delight-v2-0" 16 | }, 17 | "class_type": "DownloadAndLoadHy3DDelightModel", 18 | "_meta": { 19 | "title": "(Down)Load Hy3D DelightModel" 20 | } 21 | }, 22 | "35": { 23 | "inputs": { 24 | "steps": 50, 25 | "width": 512, 26 | "height": 512, 27 | "cfg_image": 1, 28 | "seed": 0, 29 | "delight_pipe": [ 30 | "28", 31 | 0 32 | ], 33 | "image": [ 34 | "64", 35 | 0 36 | ], 37 | "scheduler": [ 38 | "148", 39 | 0 40 | ] 41 | }, 42 | "class_type": "Hy3DDelightImage", 43 | "_meta": { 44 | "title": "Hy3DDelightImage" 45 | } 46 | }, 47 | "52": { 48 | "inputs": { 49 | "width": 543, 50 | "height": 512, 51 | "interpolation": "lanczos", 52 | "method": "pad", 53 | "condition": "always", 54 | "multiple_of": 2, 55 | "image": [ 56 | "170", 57 | 0 58 | ] 59 | }, 60 | "class_type": "ImageResize+", 61 | "_meta": { 62 | "title": "🔧 Image Resize" 63 | } 64 | }, 65 | "56": { 66 | "inputs": { 67 | "rembg_session": [ 68 | "153", 69 | 0 70 | ], 71 | "image": [ 72 | "52", 73 | 0 74 | ] 75 | }, 76 | "class_type": "ImageRemoveBackground+", 77 | "_meta": { 78 | "title": "🔧 Image Remove Background" 79 | } 80 | }, 81 | "59": { 82 | "inputs": { 83 | "remove_floaters": true, 84 | "remove_degenerate_faces": true, 85 | "reduce_faces": true, 86 | "max_facenum": 50000, 87 | "smooth_normals": false, 88 | "trimesh": [ 89 | "140", 90 | 0 91 | ] 92 | }, 93 | "class_type": "Hy3DPostprocessMesh", 94 | "_meta": { 95 | "title": "Hy3D Postprocess Mesh" 96 | } 97 | }, 98 | "61": { 99 | "inputs": { 100 | "camera_azimuths": "0, 90, 180, 270, 0, 180", 101 | "camera_elevations": "0, 0, 0, 0, 90, -90", 102 | "view_weights": "1, 0.1, 0.5, 0.1, 0.05, 0.05", 103 | "camera_distance": 1.45, 104 | "ortho_scale": 1.2 105 | }, 106 | "class_type": "Hy3DCameraConfig", 107 | "_meta": { 108 | "title": "Hy3D Camera Config" 109 | } 110 | }, 111 | "64": { 112 | "inputs": { 113 | "x": 0, 114 | "y": 0, 115 | "resize_source": false, 116 | "destination": [ 117 | "133", 118 | 0 119 | ], 120 | "source": [ 121 | "52", 122 | 0 123 | ], 124 | "mask": [ 125 | "56", 126 | 1 127 | ] 128 | }, 129 | "class_type": "ImageCompositeMasked", 130 | "_meta": { 131 | "title": "合成图像(遮罩)" 132 | } 133 | }, 134 | "79": { 135 | "inputs": { 136 | "render_size": 1024, 137 | "texture_size": 2048, 138 | "normal_space": "world", 139 | "trimesh": [ 140 | "83", 141 | 0 142 | ], 143 | "camera_config": [ 144 | "61", 145 | 0 146 | ] 147 | }, 148 | "class_type": "Hy3DRenderMultiView", 149 | "_meta": { 150 | "title": "Hy3D Render MultiView" 151 | } 152 | }, 153 | "83": { 154 | "inputs": { 155 | "trimesh": [ 156 | "59", 157 | 0 158 | ] 159 | }, 160 | "class_type": "Hy3DMeshUVWrap", 161 | "_meta": { 162 | "title": "Hy3D Mesh UV Wrap" 163 | } 164 | }, 165 | "85": { 166 | "inputs": { 167 | "model": "hunyuan3d-paint-v2-0" 168 | }, 169 | "class_type": "DownloadAndLoadHy3DPaintModel", 170 | "_meta": { 171 | "title": "(Down)Load Hy3D PaintModel" 172 | } 173 | }, 174 | "88": { 175 | "inputs": { 176 | "view_size": 512, 177 | "steps": 25, 178 | "seed": 1024, 179 | "denoise_strength": 1, 180 | "pipeline": [ 181 | "85", 182 | 0 183 | ], 184 | "ref_image": [ 185 | "35", 186 | 0 187 | ], 188 | "normal_maps": [ 189 | "79", 190 | 0 191 | ], 192 | "position_maps": [ 193 | "79", 194 | 1 195 | ], 196 | "camera_config": [ 197 | "61", 198 | 0 199 | ], 200 | "scheduler": [ 201 | "149", 202 | 0 203 | ] 204 | }, 205 | "class_type": "Hy3DSampleMultiView", 206 | "_meta": { 207 | "title": "Hy3D Sample MultiView" 208 | } 209 | }, 210 | "92": { 211 | "inputs": { 212 | "images": [ 213 | "117", 214 | 0 215 | ], 216 | "renderer": [ 217 | "79", 218 | 2 219 | ], 220 | "camera_config": [ 221 | "61", 222 | 0 223 | ] 224 | }, 225 | "class_type": "Hy3DBakeFromMultiview", 226 | "_meta": { 227 | "title": "Hy3D Bake From Multiview" 228 | } 229 | }, 230 | "98": { 231 | "inputs": { 232 | "texture": [ 233 | "104", 234 | 0 235 | ], 236 | "renderer": [ 237 | "129", 238 | 2 239 | ] 240 | }, 241 | "class_type": "Hy3DApplyTexture", 242 | "_meta": { 243 | "title": "Hy3D Apply Texture" 244 | } 245 | }, 246 | "104": { 247 | "inputs": { 248 | "inpaint_radius": 3, 249 | "inpaint_method": "ns", 250 | "texture": [ 251 | "129", 252 | 0 253 | ], 254 | "mask": [ 255 | "129", 256 | 1 257 | ] 258 | }, 259 | "class_type": "CV2InpaintTexture", 260 | "_meta": { 261 | "title": "CV2 Inpaint Texture" 262 | } 263 | }, 264 | "117": { 265 | "inputs": { 266 | "width": 2048, 267 | "height": 2048, 268 | "interpolation": "lanczos", 269 | "method": "stretch", 270 | "condition": "always", 271 | "multiple_of": 0, 272 | "image": [ 273 | "88", 274 | 0 275 | ] 276 | }, 277 | "class_type": "ImageResize+", 278 | "_meta": { 279 | "title": "🔧 Image Resize" 280 | } 281 | }, 282 | "129": { 283 | "inputs": { 284 | "texture": [ 285 | "92", 286 | 0 287 | ], 288 | "mask": [ 289 | "92", 290 | 1 291 | ], 292 | "renderer": [ 293 | "92", 294 | 2 295 | ] 296 | }, 297 | "class_type": "Hy3DMeshVerticeInpaintTexture", 298 | "_meta": { 299 | "title": "Hy3D Mesh Vertice Inpaint Texture" 300 | } 301 | }, 302 | "132": { 303 | "inputs": { 304 | "value": 0.8, 305 | "width": 512, 306 | "height": 512 307 | }, 308 | "class_type": "SolidMask", 309 | "_meta": { 310 | "title": "纯块遮罩" 311 | } 312 | }, 313 | "133": { 314 | "inputs": { 315 | "mask": [ 316 | "132", 317 | 0 318 | ] 319 | }, 320 | "class_type": "MaskToImage", 321 | "_meta": { 322 | "title": "遮罩转换为图像" 323 | } 324 | }, 325 | "140": { 326 | "inputs": { 327 | "box_v": 1.01, 328 | "octree_resolution": 384, 329 | "num_chunks": 32000, 330 | "mc_level": 0, 331 | "mc_algo": "mc", 332 | "vae": [ 333 | "10", 334 | 1 335 | ], 336 | "latents": [ 337 | "141", 338 | 0 339 | ] 340 | }, 341 | "class_type": "Hy3DVAEDecode", 342 | "_meta": { 343 | "title": "Hy3D VAE Decode" 344 | } 345 | }, 346 | "141": { 347 | "inputs": { 348 | "guidance_scale": 5.5, 349 | "steps": 50, 350 | "seed": 126, 351 | "pipeline": [ 352 | "10", 353 | 0 354 | ], 355 | "image": [ 356 | "52", 357 | 0 358 | ], 359 | "mask": [ 360 | "56", 361 | 1 362 | ] 363 | }, 364 | "class_type": "Hy3DGenerateMesh", 365 | "_meta": { 366 | "title": "Hy3DGenerateMesh" 367 | } 368 | }, 369 | "148": { 370 | "inputs": { 371 | "scheduler": "Euler A", 372 | "sigmas": "default", 373 | "pipeline": [ 374 | "28", 375 | 0 376 | ] 377 | }, 378 | "class_type": "Hy3DDiffusersSchedulerConfig", 379 | "_meta": { 380 | "title": "Hy3D Diffusers Scheduler Config" 381 | } 382 | }, 383 | "149": { 384 | "inputs": { 385 | "scheduler": "Euler A", 386 | "sigmas": "default", 387 | "pipeline": [ 388 | "85", 389 | 0 390 | ] 391 | }, 392 | "class_type": "Hy3DDiffusersSchedulerConfig", 393 | "_meta": { 394 | "title": "Hy3D Diffusers Scheduler Config" 395 | } 396 | }, 397 | "153": { 398 | "inputs": { 399 | "mode": "fast", 400 | "use_jit": true 401 | }, 402 | "class_type": "TransparentBGSession+", 403 | "_meta": { 404 | "title": "🔧 InSPyReNet TransparentBG" 405 | } 406 | }, 407 | "169": { 408 | "inputs": { 409 | "broadcast": false, 410 | "trimesh": [ 411 | "98", 412 | 0 413 | ] 414 | }, 415 | "class_type": "Hy3DtoTD", 416 | "_meta": { 417 | "title": "Hy3DtoTD" 418 | } 419 | }, 420 | "170": { 421 | "inputs": { 422 | "image": "" 423 | }, 424 | "class_type": "LoadTDImage", 425 | "_meta": { 426 | "title": "LoadTDImage" 427 | } 428 | } 429 | } 430 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ComfyUI-TD 2 | 3 | This node implements seamless data interaction between [TouchDesigner](https://derivative.ca/) (hereinafter referred to as "TD") and [ComfyUI](https://github.com/comfyanonymous/ComfyUI). 4 | 5 | It supports real-time transmission of **Images**, **Videos**, **3D Models (Point Clouds)**, and **Audio** generated by ComfyUI into TD. 6 | 7 | | ![](Image/image.gif) | ![](Image/Video.gif) | 8 | | :---: | :---: | 9 | | ![](Image/PointCloud.gif) | ![](Image/audio.gif) | 10 | 11 | # [🇨🇳 中文 README](README_zh.md) 12 | 13 | ## User Notice 14 | 15 | - Some nodes in **ComfyUI-TD** are ported and optimized based on [ComfyUI-Tooling-Nodes](https://github.com/Acly/comfyui-tooling-nodes/tree/main). 16 | - **ComfyUI-TD** must be used in conjunction with the **ComfyUI2TD.tox** component (the plugin has been uploaded to the `tox` folder). 17 | - Please ensure the **ComfyUI2TD.tox** component is updated to **v_5.1.x** or higher. 18 | - This version features a complete code refactor, supporting video and 3D model (point cloud) data transmission. 19 | - The WebSocket interface has been rewritten to effectively resolve issues where data (images) might not return properly when using cloud-based ComfyUI under poor network conditions. 20 | - Starting from **v_5.1.x**, the **ComfyUI2TD.tox** component's preset workflows use ComfyUI-TD nodes and no longer rely on [ComfyUI-Tooling-Nodes](https://github.com/Acly/comfyui-tooling-nodes/tree/main). 21 | - The legacy **ComfyUI2TD.tox** component was developed based on the [TDComfyUI](https://github.com/olegchomp/TDComfyUI) project. Thanks to olegchomp! 22 | - If you need to use cloud-based ComfyUI, you can choose [Xiangongyun](https://www.xiangongyun.com/register/YALSMH) servers; the [matching image](https://www.xiangongyun.com/image/detail/5f185465-ef11-42e5-ba21-3ee07acb5403) is ready. 23 | 24 | --- 25 | 26 | ## Instructions 27 | 28 | ### Video Tutorials 29 | 30 | Please watch the following videos in order (Videos are in Chinese): 31 | 1. [ComfyUI2TD_v 5.1 New Version Tutorial *Must Watch* (Bilibili)](https://www.bilibili.com/video/BV1BqQ8YDEJq/?share_source=copy_web&vd_source=3900738a289821efe0ce52f9c9fb663f) 32 | 2. [ComfyUI2TD Basic Tutorial (Bilibili)](https://www.bilibili.com/video/BV18t4oeNEgj/?share_source=copy_web&vd_source=3900738a289821efe0ce52f9c9fb663f) 33 | 3. [Cloud Deployment ComfyUI Xiangongyun Tutorial (Bilibili)](https://www.bilibili.com/video/BV1RxUyYyEeU/?share_source=copy_web&vd_source=3900738a289821efe0ce52f9c9fb663f) 34 | 35 | ### Installation 36 | 37 | #### Method 1: Manager Installation 38 | Use [ComfyUI-Manager](https://github.com/ltdrdata/ComfyUI-Manager?tab=readme-ov-file) to search for **ComfyUI-TD** and install it directly. 39 | 40 | ![Manager nodes](Image/Manager.png) 41 | 42 | #### Method 2: Manual Installation 43 | Download and unzip this project into `X:\ComfyUI_windows_portable\ComfyUI\custom_nodes`. 44 | 45 | #### Method 3: Git Clone 46 | Install using the git command: 47 | ```bash 48 | cd custom_nodes 49 | git clone https://github.com/JiSenHua/ComfyUI-TD.git 50 | ``` 51 | 52 | #### Method 4: Injection Installation 53 | In conjunction with the **ComfyUI2TD.tox** component, use the `InjectFile` function to automatically inject nodes into `X:\ComfyUI_windows_portable\ComfyUI\custom_nodes`. 54 | 55 | --- 56 | 57 | ## Node Descriptions 58 | 59 | | | 60 | | :--- | 61 | | **Hy3DtoTD** | 62 | | - This node supports converting GLB models generated by **Hunyuan3D_V2** into point cloud data and returning it to **TD** for parsing, generating the corresponding CHOP component.
- Requires [ComfyUI-Hunyuan3DWrapper](https://github.com/kijai/ComfyUI-Hunyuan3DWrapper) node.
- If you encounter difficulties installing, consider using the cloud [**Xiangongyun** image](https://www.xiangongyun.com/image/detail/5f185465-ef11-42e5-ba21-3ee07acb5403).
- The **ComfyUI2TD.tox** preset workflow **Hunyuan3DV2_PointCloud** provides a basic usage example for this node; the corresponding `.js` workflow file is in the `workflow` folder.
- The latest [ComfyUI-Hunyuan3DWrapper](https://github.com/kijai/ComfyUI-Hunyuan3DWrapper) has changed all model workflows to `trimesh`.
- It is recommended to install [ComfyUI_essentials](https://github.com/cubiq/ComfyUI_essentials) to avoid errors when running preset workflows.
- `broadcast` parameter (default off): When enabled, generated point cloud data will be broadcast to all connected WebSocket clients. | 63 | 64 | | | 65 | | :--- | 66 | | **Tripo3DtoTD** | 67 | | - This node supports converting GLB models generated by **Tripo3D** into point cloud data and returning it to **TD** for parsing, generating the corresponding CHOP component.
- Requires [ComfyUI-Tripo](https://github.com/VAST-AI-Research/ComfyUI-Tripo) node.
- **API Update**: Now supports calling Tripo services directly via the official ComfyUI interface. You **NO LONGER** need to register on the Tripo website or apply for an API Key separately. The legacy API configuration method is **deprecated**.
- `broadcast` parameter (default off): When enabled, generated point cloud data will be broadcast to all connected WebSocket clients. | 68 | 69 | | | 70 | | :--- | 71 | | **TripoSRtoTD** | 72 | | - This node supports converting GLB models generated by **TripoSR** into point cloud data and returning it to **TD** for parsing, generating the corresponding CHOP component.
- Requires [ComfyUI-Flowty-TripoSR](https://github.com/flowtyone/ComfyUI-Flowty-TripoSR) node.
- `broadcast` parameter (default off): When enabled, generated point cloud data will be broadcast to all connected WebSocket clients. | 73 | 74 | | | 75 | | :--- | 76 | | **Comfy3DPacktoTD** | 77 | | - This node supports converting GLB models generated by **3DPack** into point cloud data and returning it to **TD** for parsing, generating the corresponding CHOP component.
- Requires [ComfyUI-3D-Pack](https://github.com/MrForExample/ComfyUI-3D-Pack) node.
- If you encounter difficulties installing, consider using the cloud [**Xiangongyun** image](https://www.xiangongyun.com/image/detail/5f185465-ef11-42e5-ba21-3ee07acb5403).
- The **ComfyUI2TD.tox** preset workflow **3DPack_xxx_PointCloud** provides a basic usage example for this node; the corresponding `.js` workflow file is in the `workflow` folder.
- **Hunyuan3D_V2** in **3DPack** and **Hunyuan3DWrapper** are not interchangeable; please ensure you use the corresponding transmission node.
- `broadcast` parameter (default off): When enabled, generated point cloud data will be broadcast to all connected WebSocket clients.
- **Note**: Currently, the Xiangongyun cloud image has only been tested with **TRELLIS**, **Hunyuan3D_V2**, **TripoSR**, and **StableFast3D**. Other 3D models have not been verified. Please report any issues in the Issues section. | 78 | 79 | | | 80 | | :--- | 81 | | **VideotoTD** | 82 | | - This node supports converting video to data and returning it to **TD** for parsing.
- Replace the **Video Combine 🎥🅥🅗🅢** node from [ComfyUI-VideoHelperSuite](https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite) in your workflow with this node.
- **frame_rate**: Affects the synthesis frame rate of the video; 8 is recommended.
- **quality**: Controls video compression quality; 75 is recommended for a good balance between data size and image quality.
- Data will be parsed by **ComfyUI2TD.tox**, and an `.MP4` file will be generated and saved in the `VideoOutput` folder in the local root directory.
- `broadcast` parameter (default off): When enabled, generated video data will be broadcast to all connected WebSocket clients. | 83 | 84 | | | 85 | | :--- | 86 | | **ImagetoTD** | 87 | | - Secondary development based on [ComfyUI-Tooling-Nodes](https://github.com/Acly/comfyui-tooling-nodes/tree/main) **Send Image (WebSocket)** node.
- This node supports returning images generated by ComfyUI to **TD** for parsing, generating the corresponding TOP component.
- `broadcast` parameter (default off): When enabled, generated image data will be broadcast to all connected WebSocket clients.
- Starting from **v_5.1.x**, **ComfyUI2TD.tox** preset workflows use ComfyUI-TD nodes instead of [ComfyUI-Tooling-Nodes](https://github.com/Acly/comfyui-tooling-nodes/tree/main). | 88 | 89 | | | 90 | | :--- | 91 | | **AudiotoTD** | 92 | | - This node supports returning audio generated by ComfyUI to **TD** for parsing, generating the corresponding CHOP component.
- **format**: Supports selecting output format as **wav** or **mp3**.
- **bitrate_kbps**: Sets the audio bitrate to adjust output audio quality and size.
- `broadcast` parameter (default off): When enabled, generated **audio data** will be broadcast to all connected WebSocket clients. | 93 | 94 | | | 95 | | :--- | 96 | | **ImagetoTD(JPEG)** | 97 | | - **JPEG Transmission Mode**: This node encodes the image generated by ComfyUI into **JPEG compressed format** and returns it to **TD** via WebSocket for parsing into a TOP component.
- **Performance & Scenario**: Compared to the standard `ImageToTD` method, JPEG format significantly reduces transmitted data size. This speeds up transmission and parsing, making it especially suitable for **Cloud ComfyUI** users to reduce bandwidth requirements.
- **Quality**: Due to compression, image quality will be lower than `ImageToTD`. Please balance according to actual needs.
- **quality**: Controls image compression quality; 85 is recommended.
- `broadcast` parameter (default off): When enabled, generated image data will be broadcast to all connected WebSocket clients. | 98 | 99 | | | 100 | | :--- | 101 | | **LoadTDImage** | 102 | | - Secondary development based on [ComfyUI-Tooling-Nodes](https://github.com/Acly/comfyui-tooling-nodes/tree/main) **Load Image (Base64)** node.
- This node supports using TOP components sent from TD as image input sources for ComfyUI.
- Starting from **v_5.1.x**, **ComfyUI2TD.tox** preset workflows use ComfyUI-TD nodes instead of [ComfyUI-Tooling-Nodes](https://github.com/Acly/comfyui-tooling-nodes/tree/main). | 103 | -------------------------------------------------------------------------------- /README_zh.md: -------------------------------------------------------------------------------- 1 | # ComfyUI-TD 2 | 3 | 本节点实现了 [TouchDesigner](https://derivative.ca/)(以下简称 "TD")与 [ComfyUI](https://github.com/comfyanonymous/ComfyUI) 之间的无缝数据交互。 4 | 5 | 支持将 ComfyUI 生成的 **图像**、**视频**、**3D模型(点云)**、**音频** 数据实时传输进 TD。 6 | 7 | | ![](Image/image.gif) | ![](Image/Video.gif) | 8 | |:-------------------------:|:--------------------:| 9 | | ![](Image/PointCloud.gif) | ![](Image/audio.gif) | 10 | 11 | # [🇺🇸 English README](README.md) 12 | 13 | ## 用户须知 14 | 15 | - **ComfyUI-TD** 的部分节点基于 [ComfyUI-Tooling-Nodes](https://github.com/Acly/comfyui-tooling-nodes/tree/main) 进行了移植和优化。 16 | - **ComfyUI-TD** 需与 **ComfyUI2TD.tox** 组件配合使用(插件已上传至 `tox` 文件夹)。 17 | - 请确保 **ComfyUI2TD.tox** 组件版本更新至 **v_5.1.x** 或更高版本。 18 | - 此版本对组件代码进行了全面重构,支持了视频与 3D 模型(点云)的数据传输。 19 | - 重写了 WebSocket 接口,有效解决了在网络条件较差时,使用云端 ComfyUI 可能出现的数据(图像)无法正常返回的问题。 20 | - **ComfyUI2TD.tox** 组件至 **v_5.1.x** 版本起,预置的工作流将使用 ComfyUI-TD 节点,不再使用 [ComfyUI-Tooling-Nodes](https://github.com/Acly/comfyui-tooling-nodes/tree/main)。 21 | - 旧版 **ComfyUI2TD.tox** 组件基于 [TDComfyUI](https://github.com/olegchomp/TDComfyUI) 项目开发,感谢 olegchomp! 22 | - 若需使用云端 ComfyUI,可选择 [仙宫云](https://www.xiangongyun.com/register/YALSMH) 服务器,[配套镜像](https://www.xiangongyun.com/image/detail/5f185465-ef11-42e5-ba21-3ee07acb5403) 已准备完毕。 23 | 24 | --- 25 | 26 | ## 使用说明 27 | 28 | ### 视频教程 29 | 30 | 请按照顺序观看以下视频: 31 | 32 | 1. [ComfyUI2TD_v 5.1 新版使用教程 *必看* (哔哩哔哩)](https://www.bilibili.com/video/BV1BqQ8YDEJq/?share_source=copy_web&vd_source=3900738a289821efe0ce52f9c9fb663f) 33 | 2. [ComfyUI2TD 基础使用教程 (哔哩哔哩)](https://www.bilibili.com/video/BV18t4oeNEgj/?share_source=copy_web&vd_source=3900738a289821efe0ce52f9c9fb663f) 34 | 3. [云端部署 ComfyUI 仙宫云使用教程 (哔哩哔哩)](https://www.bilibili.com/video/BV1RxUyYyEeU/?share_source=copy_web&vd_source=3900738a289821efe0ce52f9c9fb663f) 35 | 36 | ### ComfyUI-TD 节点安装 37 | 38 | #### 方法一:使用 Manager 安装 39 | 40 | 使用 [ComfyUI-Manager](https://github.com/ltdrdata/ComfyUI-Manager?tab=readme-ov-file) 搜索 **ComfyUI-TD**,并直接进行节点安装。 41 | 42 | ![Manager nodes](Image/Manager.png) 43 | 44 | #### 方法二:手动安装 45 | 46 | 将本项目下载后解压,放置于 `X:\ComfyUI_windows_portable\ComfyUI\custom_nodes`。 47 | 48 | #### 方法三:Git Clone 安装 49 | 50 | 使用 git 命令进行安装: 51 | 52 | ```bash 53 | cd custom_nodes 54 | git clone https://github.com/JiSenHua/ComfyUI-TD.git 55 | ``` 56 | 57 | #### 方法四:注入安装 58 | 59 | 配合 **ComfyUI2TD.tox** 组件,使用 `InjectFile 注入插件` 功能,将节点自动注入至 `X:\ComfyUI_windows_portable\ComfyUI\custom_nodes`。 60 | 61 | --- 62 | 63 | ## ComfyUI-TD 节点说明 64 | 65 | | | 66 | |:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 67 | | **Hy3DtoTD** | 68 | | - 本节点支持将 **Hunyuan3D_V2 混元V2** 生成的 GLB 模型转换为点云数据,并返回至 **TD** 进行解析,从而生成对应的 CHOP 组件。
- 使用本节点需安装 [ComfyUI-Hunyuan3DWrapper](https://github.com/kijai/ComfyUI-Hunyuan3DWrapper) 节点。
- 若安装遇到困难,可选择使用云端 [**仙宫云**镜像](https://www.xiangongyun.com/image/detail/5f185465-ef11-42e5-ba21-3ee07acb5403)。
- **ComfyUI2TD.tox** 预置的工作流 **Hunyuan3DV2_PointCloud** 提供了此节点的基础用法示例,对应的 `.js` 工作流文件已上传至 `workflow` 文件夹。
- 最新的 [ComfyUI-Hunyuan3DWrapper](https://github.com/kijai/ComfyUI-Hunyuan3DWrapper) 已将所有模型工作流改为 `trimesh`。
- 建议配套安装 [ComfyUI_essentials](https://github.com/cubiq/ComfyUI_essentials),避免运行预置工作流时报错。
- `broadcast` 广播参数(默认关闭):启用该参数后,生成的点云数据将广播至所有已建立 WebSocket 连接的客户端。 | 69 | 70 | | | 71 | |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 72 | | **Tripo3DtoTD** | 73 | | - 本节点支持将 **Tripo3D** 生成的 GLB 模型转换为点云数据,并返回至 **TD** 进行解析,从而生成对应的 CHOP 组件。
- 使用本节点需安装 [ComfyUI-Tripo](https://github.com/VAST-AI-Research/ComfyUI-Tripo) 节点。
- **API 调用更新**:现已支持直接通过 ComfyUI 官方接口调用 Tripo 服务,**无需**再前往 Tripo 官网注册账户或单独申请 API Key,旧版的独立 API 配置方式已**弃用**。
- `broadcast` 广播参数(默认关闭):启用该参数后,生成的点云数据将广播至所有已建立 WebSocket 连接的客户端。 | 74 | 75 | | | 76 | |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 77 | | **TripoSRtoTD** | 78 | | - 本节点支持将 **TripoSR** 生成的 GLB 模型转换为点云数据,并返回至 **TD** 进行解析,从而生成对应的 CHOP 组件。
- 使用本节点需安装 [ComfyUI-Flowty-TripoSR](https://github.com/flowtyone/ComfyUI-Flowty-TripoSR) 节点。
- `broadcast` 广播参数(默认关闭):启用该参数后,生成的点云数据将广播至所有已建立 WebSocket 连接的客户端。 | 79 | 80 | | | 81 | |:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 82 | | **Comfy3DPacktoTD** | 83 | | - 本节点支持将 **3DPack** 生成的 GLB 模型转换为点云数据,并返回至 **TD** 进行解析,从而生成对应的 CHOP 组件。
- 使用本节点需安装 [ComfyUI-3D-Pack](https://github.com/MrForExample/ComfyUI-3D-Pack) 节点。
- 若安装遇到困难,可选择使用云端 [**仙宫云**镜像](https://www.xiangongyun.com/image/detail/5f185465-ef11-42e5-ba21-3ee07acb5403)。
- **ComfyUI2TD.tox** 预置的工作流 **3DPack_xxx_PointCloud** 提供了此节点的基础用法示例,对应的 `.js` 工作流文件已上传至 `workflow` 文件夹。
- **3DPack** 中的 **Hunyuan3D_V2** 与 **Hunyuan3DWrapper** 并不互通,请确保使用各自对应的传输节点。
- `broadcast` 广播参数(默认关闭):启用该参数后,生成的点云数据将广播至所有已建立 WebSocket 连接的客户端。
- **注意**:目前仙宫云端镜像仅对 **TRELLIS**、**Hunyuan3D_V2**、**TripoSR** 和 **StableFast3D** 进行了测试。其他 3D 模型尚未验证,如遇问题请在 Issues 中反馈。 | 84 | 85 | | | 86 | |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 87 | | **VideotoTD** | 88 | | - 本节点支持将视频转为数据,并返回至 **TD** 进行解析。
- 将你工作流中 [ComfyUI-VideoHelperSuite](https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite) 的 **Video Combine 🎥🅥🅗🅢** 替换成此节点。
- **frame_rate** 参数:影响视频的合成帧率,建议选择 8。
- **quality** 参数:控制视频的压缩质量,建议选择 75,以获得较好的数据大小与图像质量的平衡。
- 数据将通过 **ComfyUI2TD.tox** 解析,并生成 `.MP4` 格式文件保存在本地根目录中 `VideoOutput` 文件夹内。
- `broadcast` 广播参数(默认关闭):启用该参数后,生成的视频数据将广播至所有已建立 WebSocket 连接的客户端。 | 89 | 90 | | | 91 | |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 92 | | **ImagetoTD** | 93 | | - 基于 [ComfyUI-Tooling-Nodes](https://github.com/Acly/comfyui-tooling-nodes/tree/main) **Send Image (WebSocket)** 节点二次开发。
- 本节点支持将 ComfyUI 生成的图片返回至 **TD** 进行解析,从而生成对应的 TOP 组件。
- `broadcast` 广播参数(默认关闭):启用该参数后,生成的图片数据将广播至所有已建立 WebSocket 连接的客户端。
- **ComfyUI2TD.tox** 组件至 **v_5.1.x** 版本起,预置的工作流将使用 ComfyUI-TD 节点,不再使用 [ComfyUI-Tooling-Nodes](https://github.com/Acly/comfyui-tooling-nodes/tree/main)。 | 94 | 95 | | | 96 | |:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 97 | | **AudiotoTD** | 98 | | - 本节点支持将 ComfyUI 生成的音频返回至 **TD** 进行解析,从而生成对应的 CHOP 组件。
- **format** 参数:支持选择输出格式为 **wav** 或 **mp3**。
- **bitrate_kbps** 参数:设置音频比特率,用于调节输出音频的质量与大小。
- `broadcast` 广播参数(默认关闭):启用该参数后,生成的 **音频数据** 将广播至所有已建立 WebSocket 连接的客户端。 | 99 | 100 | | | 101 | |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 102 | | **ImagetoTD(JPEG)** | 103 | | - **JPEG 传输模式**:本节点会将 ComfyUI 生成的图像编码为 **JPEG 压缩格式** 后,通过 WebSocket 返回至 **TD** 进行解析生成 TOP 元件。
- **性能与场景**:相比于标准的 `ImageToTD` 方式,JPEG 格式显著减少了传输的数据量。这不仅加快了传输与解析速度,更特别适合 **云端部署 ComfyUI** 的用户,能有效降低网络带宽需求。
- **画质说明**:由于采用了压缩传输,图像质量相比 `ImageToTD` 会有所降低,请根据实际需求权衡使用。
- **quality** 参数:控制图像的压缩质量,建议选择 85,以获得较好的数据大小与图像质量的平衡。
- `broadcast` 广播参数(默认关闭):启用该参数后,生成的图片数据将广播至所有已建立 WebSocket 连接的客户端。 | 104 | 105 | | | 106 | |:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 107 | | **LoadTDImage** | 108 | | - 基于 [ComfyUI-Tooling-Nodes](https://github.com/Acly/comfyui-tooling-nodes/tree/main) **Load Image (Base64)** 节点二次开发。
- 本节点支持由 TD 发送的 TOP 元件作为图像输入源发送给 ComfyUI。
- **ComfyUI2TD.tox** 组件至 **v_5.1.x** 版本起,预置的工作流将使用 ComfyUI-TD 节点,不再使用 [ComfyUI-Tooling-Nodes](https://github.com/Acly/comfyui-tooling-nodes/tree/main)。 | 109 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /node.py: -------------------------------------------------------------------------------- 1 | import struct 2 | import numpy as np 3 | import io 4 | from server import PromptServer, BinaryEventTypes 5 | from pathlib import Path 6 | from PIL import Image 7 | import base64 8 | from io import BytesIO 9 | import torch 10 | import tempfile 11 | import os 12 | 13 | 14 | class Hy3DtoTD: 15 | #https://github.com/kijai/ComfyUI-Hunyuan3DWrapper 16 | @classmethod 17 | def INPUT_TYPES(s): 18 | return { 19 | "required": { 20 | "trimesh": ("TRIMESH",), 21 | "broadcast": ("BOOLEAN", {"default": False}), 22 | } 23 | } 24 | 25 | RETURN_TYPES = () 26 | FUNCTION = "send_mesh" 27 | OUTPUT_NODE = True 28 | CATEGORY = "TouchDesigner" 29 | 30 | def send_mesh(self, trimesh, broadcast): 31 | try: 32 | processed_mesh = self.process_mesh(trimesh) 33 | return self._send_to_td(processed_mesh, broadcast) 34 | except Exception as e: 35 | raise ValueError(f"Error processing mesh: {str(e)}") 36 | 37 | def process_mesh(self, mesh): 38 | try: 39 | import trimesh 40 | 41 | if isinstance(mesh, trimesh.Scene): 42 | meshes = [] 43 | for m in mesh.geometry.values(): 44 | if isinstance(m, trimesh.Trimesh): 45 | meshes.append(m) 46 | if meshes: 47 | mesh = trimesh.util.concatenate(meshes) 48 | else: 49 | raise ValueError("No valid mesh data found") 50 | 51 | if not isinstance(mesh, trimesh.Trimesh): 52 | raise ValueError("Input data is not a valid Trimesh object") 53 | 54 | mesh.fix_normals() 55 | 56 | if hasattr(mesh.visual, 'vertex_colors') and mesh.visual.vertex_colors is not None: 57 | pass 58 | elif hasattr(mesh.visual, 'uv') and mesh.visual.uv is not None: 59 | mesh.visual = mesh.visual.to_color() 60 | else: 61 | mesh.visual = trimesh.visual.ColorVisuals(mesh) 62 | mesh.visual.vertex_colors = np.tile([200, 200, 200, 255], (len(mesh.vertices), 1)) 63 | 64 | return mesh 65 | 66 | except ImportError: 67 | raise ImportError("Please install the trimesh library: pip install trimesh") 68 | except Exception as e: 69 | raise ValueError(f"Error processing mesh: {str(e)}") 70 | 71 | def _send_to_td(self, mesh, broadcast): 72 | try: 73 | import trimesh 74 | 75 | buffer = io.BytesIO() 76 | mesh.export(file_obj=buffer, file_type='ply') 77 | binary_data = buffer.getvalue() 78 | buffer.close() 79 | 80 | server = PromptServer.instance 81 | sid = None if broadcast else server.client_id 82 | server.send_sync(1000, binary_data, sid=sid) 83 | 84 | return {"ui": { 85 | "mesh": [{ 86 | "source": "websocket", 87 | "content-type": "model/ply", 88 | "type": "output", 89 | }] 90 | }} 91 | except ImportError: 92 | raise ImportError("Please install the trimesh library: pip install trimesh") 93 | except Exception as e: 94 | raise ValueError(f"Error sending mesh to TouchDesigner: {str(e)}") 95 | 96 | 97 | class Tripo3DtoTD: 98 | #https://github.com/VAST-AI-Research/ComfyUI-Tripo 99 | @classmethod 100 | def INPUT_TYPES(s): 101 | return { 102 | "required": { 103 | "model_file": ("STRING",), 104 | "broadcast": ("BOOLEAN", {"default": False}), 105 | } 106 | } 107 | 108 | RETURN_TYPES = () 109 | FUNCTION = "send_mesh" 110 | OUTPUT_NODE = True 111 | CATEGORY = "TouchDesigner" 112 | 113 | def send_mesh(self, model_file, broadcast): 114 | try: 115 | processed_mesh = self.process_mesh(model_file) 116 | return self._send_to_td(processed_mesh, broadcast) 117 | except Exception as e: 118 | raise ValueError(f"Error processing mesh: {str(e)}") 119 | 120 | def process_mesh(self, model_file): 121 | try: 122 | import trimesh 123 | if not model_file.startswith(('http://', 'https://')) and not os.path.isabs(model_file): 124 | try: 125 | import folder_paths 126 | output_dir = folder_paths.get_output_directory() 127 | local_path = os.path.join(output_dir, model_file) 128 | if os.path.exists(local_path): 129 | model_file = local_path 130 | except: 131 | pass 132 | 133 | mesh = trimesh.load(model_file) 134 | 135 | if isinstance(mesh, trimesh.Scene): 136 | meshes = [] 137 | for m in mesh.geometry.values(): 138 | if isinstance(m, trimesh.Trimesh): 139 | self._process_vertex_colors(m) 140 | meshes.append(m) 141 | 142 | if meshes: 143 | mesh = trimesh.util.concatenate(meshes) 144 | else: 145 | raise ValueError("No valid mesh data found") 146 | 147 | if not isinstance(mesh, trimesh.Trimesh): 148 | raise ValueError("Input data is not a valid Trimesh object") 149 | 150 | mesh.fix_normals() 151 | 152 | if not hasattr(mesh.visual, 'vertex_colors') or mesh.visual.vertex_colors is None: 153 | mesh.visual = trimesh.visual.ColorVisuals(mesh) 154 | mesh.visual.vertex_colors = np.tile([200, 200, 200, 255], (len(mesh.vertices), 1)) 155 | else: 156 | if mesh.visual.vertex_colors.max() <= 1.0: 157 | mesh.visual.vertex_colors = (mesh.visual.vertex_colors * 255).astype(np.uint8) 158 | else: 159 | mesh.visual.vertex_colors = mesh.visual.vertex_colors.astype(np.uint8) 160 | 161 | return mesh 162 | 163 | except ImportError: 164 | raise ImportError("Please install the trimesh library: pip install trimesh") 165 | except Exception as e: 166 | raise ValueError(f"Error processing mesh: {str(e)}") 167 | 168 | def _process_vertex_colors(self, m): 169 | try: 170 | import trimesh 171 | 172 | if not hasattr(m.visual, 'vertex_colors') or m.visual.vertex_colors is None: 173 | if hasattr(m.visual, 'material'): 174 | material = m.visual.material 175 | if hasattr(material, 'baseColorTexture') and material.baseColorTexture is not None: 176 | if hasattr(m.visual, 'uv') and m.visual.uv is not None: 177 | self._extract_colors_from_texture(m) 178 | elif hasattr(material, 'baseColorFactor'): 179 | color = np.array(material.baseColorFactor) 180 | if len(color) == 3: 181 | color = np.append(color, 1.0) 182 | color = np.clip(color, 0, 1) 183 | color = (color * 255).astype(np.uint8) 184 | m.visual = trimesh.visual.ColorVisuals(m) 185 | m.visual.vertex_colors = np.tile(color, (len(m.vertices), 1)) 186 | else: 187 | m.visual = trimesh.visual.ColorVisuals(m) 188 | m.visual.vertex_colors = np.tile([200, 200, 200, 255], (len(m.vertices), 1)) 189 | else: 190 | m.visual = trimesh.visual.ColorVisuals(m) 191 | m.visual.vertex_colors = np.tile([200, 200, 200, 255], (len(m.vertices), 1)) 192 | else: 193 | if m.visual.vertex_colors.max() <= 1.0: 194 | m.visual.vertex_colors = (m.visual.vertex_colors * 255).astype(np.uint8) 195 | else: 196 | m.visual.vertex_colors = m.visual.vertex_colors.astype(np.uint8) 197 | except ImportError: 198 | raise ImportError("Please install the trimesh library: pip install trimesh") 199 | except Exception as e: 200 | raise ValueError(f"Error processing vertex colors: {str(e)}") 201 | 202 | def _extract_colors_from_texture(self, m): 203 | try: 204 | import trimesh 205 | 206 | material = m.visual.material 207 | image = material.baseColorTexture 208 | if image is not None: 209 | image_data = np.array(image) 210 | if image_data.dtype != np.uint8: 211 | image_data = (np.clip(image_data, 0, 1) * 255).astype(np.uint8) 212 | 213 | uvs = m.visual.uv 214 | uvs = np.clip(uvs, 0, 1) 215 | h, w = image_data.shape[0], image_data.shape[1] 216 | i = ((1 - uvs[:, 1]) * (h - 1)).astype(int) 217 | j = (uvs[:, 0] * (w - 1)).astype(int) 218 | i = np.clip(i, 0, h - 1) 219 | j = np.clip(j, 0, w - 1) 220 | colors = image_data[i, j, :4] 221 | m.visual = trimesh.visual.ColorVisuals(m) 222 | m.visual.vertex_colors = colors 223 | else: 224 | m.visual = trimesh.visual.ColorVisuals(m) 225 | m.visual.vertex_colors = np.tile([200, 200, 200, 255], (len(m.vertices), 1)) 226 | except ImportError: 227 | raise ImportError("Please install the trimesh library: pip install trimesh") 228 | except Exception as e: 229 | raise ValueError(f"Error extracting colors from texture: {str(e)}") 230 | 231 | def _send_to_td(self, mesh, broadcast): 232 | try: 233 | if not hasattr(mesh.visual, 'vertex_colors') or mesh.visual.vertex_colors is None: 234 | colors = np.tile([200, 200, 200, 255], (len(mesh.vertices), 1)).astype(np.uint8) 235 | else: 236 | colors = mesh.visual.vertex_colors.astype(np.uint8) 237 | 238 | header = [ 239 | "ply", 240 | "format binary_little_endian 1.0", 241 | f"element vertex {len(mesh.vertices)}", 242 | "property float x", 243 | "property float y", 244 | "property float z", 245 | "property uchar red", 246 | "property uchar green", 247 | "property uchar blue", 248 | "property uchar alpha", 249 | "end_header\n" 250 | ] 251 | header = '\n'.join(header).encode('ascii') 252 | 253 | vertices = mesh.vertices.astype('I", type_num) 352 | bytesIO.write(header) 353 | 354 | image.save(bytesIO, format="JPEG", quality=quality) 355 | jpeg_bytes = bytesIO.getvalue() 356 | 357 | server = PromptServer.instance 358 | sid = None if broadcast else server.client_id 359 | 360 | server.send_sync( 361 | BinaryEventTypes.PREVIEW_IMAGE, 362 | jpeg_bytes, 363 | sid, 364 | ) 365 | results.append({ 366 | "source": "websocket", 367 | "content-type": "image/jpeg", 368 | "type": "output", 369 | }) 370 | 371 | return {"ui": {"images": results}} 372 | 373 | class Comfy3DPacktoTD: 374 | #https://github.com/MrForExample/ComfyUI-3D-Pack 375 | @classmethod 376 | def INPUT_TYPES(cls): 377 | return { 378 | "required": { 379 | "mesh": ("MESH",), 380 | "broadcast": ("BOOLEAN", {"default": False}), 381 | }, 382 | } 383 | 384 | RETURN_TYPES = () 385 | FUNCTION = "send_to_td" 386 | OUTPUT_NODE = True 387 | CATEGORY = "TouchDesigner" 388 | 389 | def send_to_td(self, mesh, broadcast): 390 | try: 391 | vertices = mesh.v.cpu().numpy().astype(np.float32) 392 | colors = None 393 | color_source = "none" 394 | 395 | if hasattr(mesh, 'albedo') and mesh.albedo is not None: 396 | albedo = mesh.albedo 397 | if hasattr(albedo, 'cpu'): 398 | albedo = albedo.cpu() 399 | if hasattr(albedo, 'numpy'): 400 | albedo = albedo.numpy() 401 | 402 | if len(albedo.shape) > 1: 403 | if hasattr(mesh, 'vt') and mesh.vt is not None: 404 | uvs = mesh.vt.cpu().numpy() 405 | uvs = np.clip(uvs, 0, 1) 406 | tex_h, tex_w = albedo.shape[:2] 407 | 408 | mapped_u, mapped_v = uvs[:, 0], uvs[:, 1] 409 | 410 | tex_x = mapped_u * (tex_w - 1) 411 | tex_y = mapped_v * (tex_h - 1) 412 | 413 | tex_x0 = np.floor(tex_x).astype(np.int32) 414 | tex_y0 = np.floor(tex_y).astype(np.int32) 415 | tex_x1 = np.minimum(tex_x0 + 1, tex_w - 1) 416 | tex_y1 = np.minimum(tex_y0 + 1, tex_h - 1) 417 | 418 | wx = tex_x - tex_x0 419 | wy = tex_y - tex_y0 420 | 421 | c00 = albedo[tex_y0, tex_x0] 422 | c01 = albedo[tex_y0, tex_x1] 423 | c10 = albedo[tex_y1, tex_x0] 424 | c11 = albedo[tex_y1, tex_x1] 425 | 426 | c0 = c00 * (1 - wx[:, np.newaxis]) + c01 * wx[:, np.newaxis] 427 | c1 = c10 * (1 - wx[:, np.newaxis]) + c11 * wx[:, np.newaxis] 428 | colors = c0 * (1 - wy[:, np.newaxis]) + c1 * wy[:, np.newaxis] 429 | 430 | color_source = "albedo_with_uv_no_v_flip" 431 | else: 432 | if albedo.shape[0] == len(vertices): 433 | colors = albedo 434 | color_source = "albedo_direct" 435 | else: 436 | colors = albedo 437 | color_source = "albedo_scalar" 438 | 439 | if colors is None and hasattr(mesh, 'vc') and mesh.vc is not None: 440 | colors = mesh.vc.cpu().numpy() 441 | color_source = "vertex_colors" 442 | 443 | if colors is None: 444 | positions = vertices - vertices.min(axis=0) 445 | positions = positions / positions.max(axis=0) if positions.max() > 0 else positions 446 | colors = positions 447 | color_source = "generated" 448 | 449 | if colors is not None: 450 | if colors.max() <= 1.0: 451 | colors = (colors * 255).astype(np.uint8) 452 | else: 453 | colors = np.clip(colors, 0, 255).astype(np.uint8) 454 | 455 | if colors.shape[1] == 3: 456 | alpha = np.full((len(vertices), 1), 255, dtype=np.uint8) 457 | colors = np.concatenate([colors, alpha], axis=1) 458 | 459 | header = [ 460 | "ply", 461 | "format binary_little_endian 1.0", 462 | f"element vertex {len(vertices)}", 463 | "property float x", 464 | "property float y", 465 | "property float z", 466 | "property uchar red", 467 | "property uchar green", 468 | "property uchar blue", 469 | "property uchar alpha", 470 | "end_header\n" 471 | ] 472 | header = '\n'.join(header).encode('ascii') 473 | 474 | binary_data = bytearray() 475 | for i in range(len(vertices)): 476 | binary_data.extend(struct.pack(' 0: 530 | mesh_obj = mesh[0] 531 | else: 532 | raise ValueError("Empty mesh list received") 533 | else: 534 | mesh_obj = mesh 535 | 536 | if hasattr(mesh_obj, 'vertices'): 537 | vertices = mesh_obj.vertices 538 | if hasattr(vertices, 'cpu'): 539 | vertices = vertices.cpu() 540 | if hasattr(vertices, 'numpy'): 541 | vertices = vertices.numpy() 542 | vertices = vertices.astype(np.float32) 543 | else: 544 | raise ValueError("Cannot find vertex data in mesh object") 545 | 546 | rotated_vertices = vertices.copy() 547 | rotated_vertices[:, 0] = -vertices[:, 0] 548 | rotated_vertices[:, 1], rotated_vertices[:, 2] = vertices[:, 2], vertices[:, 1] 549 | 550 | final_vertices = rotated_vertices.copy() 551 | final_vertices[:, 0] = rotated_vertices[:, 2] 552 | final_vertices[:, 2] = -rotated_vertices[:, 0] 553 | 554 | vertices = final_vertices 555 | 556 | colors = None 557 | 558 | if hasattr(mesh_obj, 'visual') and mesh_obj.visual is not None: 559 | visual = mesh_obj.visual 560 | 561 | if hasattr(visual, 'vertex_colors') and visual.vertex_colors is not None: 562 | colors = visual.vertex_colors 563 | if hasattr(colors, 'cpu'): 564 | colors = colors.cpu() 565 | if hasattr(colors, 'numpy'): 566 | colors = colors.numpy() 567 | 568 | elif hasattr(visual, 'face_colors') and visual.face_colors is not None: 569 | face_colors = visual.face_colors 570 | if hasattr(face_colors, 'cpu'): 571 | face_colors = face_colors.cpu() 572 | if hasattr(face_colors, 'numpy'): 573 | face_colors = face_colors.numpy() 574 | 575 | if hasattr(mesh_obj, 'faces') and mesh_obj.faces is not None: 576 | faces = mesh_obj.faces 577 | if hasattr(faces, 'cpu'): 578 | faces = faces.cpu() 579 | if hasattr(faces, 'numpy'): 580 | faces = faces.numpy() 581 | 582 | colors = np.zeros((len(vertices), 4), dtype=np.uint8) 583 | vertex_color_count = np.zeros(len(vertices), dtype=np.int32) 584 | 585 | for i, face in enumerate(faces): 586 | for vertex_idx in face: 587 | colors[vertex_idx] += face_colors[i] 588 | vertex_color_count[vertex_idx] += 1 589 | 590 | for i in range(len(vertices)): 591 | if vertex_color_count[i] > 0: 592 | colors[i] = colors[i] // vertex_color_count[i] 593 | 594 | elif hasattr(visual, 'material') and visual.material is not None: 595 | material = visual.material 596 | 597 | if hasattr(material, 'diffuse') and material.diffuse is not None: 598 | diffuse = material.diffuse 599 | colors = np.tile(diffuse, (len(vertices), 1)) 600 | 601 | if colors is None and hasattr(mesh_obj, '_visual') and mesh_obj._visual is not None: 602 | visual = mesh_obj._visual 603 | 604 | if hasattr(visual, 'vertex_colors') and visual.vertex_colors is not None: 605 | colors = visual.vertex_colors 606 | if hasattr(colors, 'cpu'): 607 | colors = colors.cpu() 608 | if hasattr(colors, 'numpy'): 609 | colors = colors.numpy() 610 | 611 | if colors is None and hasattr(mesh_obj, 'visual') and hasattr(mesh_obj.visual, 612 | 'uv') and mesh_obj.visual.uv is not None: 613 | if hasattr(mesh_obj.visual, 'material') and hasattr(mesh_obj.visual.material, 'image'): 614 | uvs = mesh_obj.visual.uv 615 | image = mesh_obj.visual.material.image 616 | 617 | h, w = image.shape[:2] 618 | u = np.clip(uvs[:, 0], 0, 1) * (w - 1) 619 | v = np.clip(uvs[:, 1], 0, 1) * (h - 1) 620 | 621 | u_int = np.round(u).astype(np.int32) 622 | v_int = np.round(v).astype(np.int32) 623 | 624 | u_int = np.clip(u_int, 0, w - 1) 625 | v_int = np.clip(v_int, 0, h - 1) 626 | 627 | colors = image[v_int, u_int] 628 | 629 | if colors is None: 630 | np.random.seed(42) 631 | colors = np.random.randint(100, 200, size=(len(vertices), 3), dtype=np.uint8) 632 | alpha = np.full((len(vertices), 1), 255, dtype=np.uint8) 633 | colors = np.concatenate([colors, alpha], axis=1) 634 | 635 | if colors is not None: 636 | if len(colors.shape) == 1: 637 | colors = np.column_stack([colors, colors, colors]) 638 | 639 | if colors.max() <= 1.0 and colors.dtype != np.uint8: 640 | colors = (colors * 255).astype(np.uint8) 641 | else: 642 | colors = np.clip(colors, 0, 255).astype(np.uint8) 643 | 644 | if colors.shape[1] == 3: 645 | alpha = np.full((len(vertices), 1), 255, dtype=np.uint8) 646 | colors = np.concatenate([colors, alpha], axis=1) 647 | elif colors.shape[1] > 4: 648 | colors = colors[:, :4] 649 | 650 | if len(colors) != len(vertices): 651 | if len(colors) > len(vertices): 652 | colors = colors[:len(vertices)] 653 | else: 654 | last_color = colors[-1] 655 | padding = np.tile(last_color, (len(vertices) - len(colors), 1)) 656 | colors = np.vstack([colors, padding]) 657 | 658 | header = [ 659 | "ply", 660 | "format binary_little_endian 1.0", 661 | f"element vertex {len(vertices)}", 662 | "property float x", 663 | "property float y", 664 | "property float z", 665 | "property uchar red", 666 | "property uchar green", 667 | "property uchar blue", 668 | "property uchar alpha", 669 | "end_header\n" 670 | ] 671 | header = '\n'.join(header).encode('ascii') 672 | 673 | binary_data = bytearray() 674 | for i in range(len(vertices)): 675 | binary_data.extend(struct.pack(' 1: 879 | waveform = waveform[0:1, ...] 880 | waveform = waveform[0] 881 | 882 | with torch.no_grad(): 883 | max_abs = waveform.abs().amax() 884 | if torch.isfinite(max_abs) and max_abs > 1.0: 885 | waveform = waveform / max_abs 886 | 887 | wav_np = waveform.detach().cpu().float().numpy() 888 | if wav_np.ndim != 2: 889 | raise ValueError(f"Waveform must be [C, T] after squeeze, got {wav_np.shape}") 890 | wav_np = np.transpose(wav_np, (1, 0)) 891 | 892 | if format == "wav": 893 | audio_binary, content_type = self._encode_wav(wav_np, sample_rate) 894 | elif format == "mp3": # 改为 mp3 895 | audio_binary, content_type = self._encode_mp3(wav_np, sample_rate, bitrate_kbps) 896 | else: 897 | raise ValueError(f"Unsupported format: {format}") 898 | 899 | return self._send_to_td(audio_binary, content_type, broadcast) 900 | 901 | def _encode_wav(self, wav_np, sample_rate): 902 | import soundfile as sf 903 | buf = io.BytesIO() 904 | if wav_np.ndim == 1: 905 | wav_np = wav_np[:, None] 906 | sf.write(buf, wav_np, samplerate=sample_rate, subtype="PCM_16", format="WAV") 907 | audio_binary = buf.getvalue() 908 | buf.close() 909 | return audio_binary, "audio/wav" 910 | 911 | def _encode_mp3(self, wav_np, sample_rate, bitrate_kbps): 912 | import imageio_ffmpeg, subprocess 913 | with tempfile.NamedTemporaryFile(suffix=".mp3", delete=False) as temp_file: 914 | temp_path = temp_file.name 915 | try: 916 | channels = wav_np.shape[1] if wav_np.ndim == 2 else 1 917 | if wav_np.ndim == 1: 918 | wav_np = wav_np[:, None] 919 | channels = 1 920 | pcm = wav_np.astype(np.float32, copy=False) 921 | if not pcm.flags["C_CONTIGUOUS"]: 922 | pcm = np.ascontiguousarray(pcm) 923 | 924 | cmd = [ 925 | imageio_ffmpeg.get_ffmpeg_exe(), 926 | "-y", 927 | "-f", "f32le", 928 | "-ac", str(channels), 929 | "-ar", str(sample_rate), 930 | "-i", "pipe:0", 931 | "-c:a", "libmp3lame", 932 | "-b:a", f"{int(bitrate_kbps)}k", 933 | temp_path 934 | ] 935 | proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 936 | proc.stdin.write(pcm.tobytes()) 937 | proc.stdin.close() 938 | rc = proc.wait() 939 | if rc != 0: 940 | stderr = proc.stderr.read().decode("utf-8", errors="ignore") 941 | raise RuntimeError(f"ffmpeg failed (code {rc}): {stderr.strip()}") 942 | with open(temp_path, "rb") as f: 943 | audio_binary = f.read() 944 | finally: 945 | try: 946 | os.unlink(temp_path) 947 | except Exception: 948 | pass 949 | return audio_binary, "audio/mpeg" 950 | 951 | def _send_to_td(self, audio_binary, content_type, broadcast): 952 | server = PromptServer.instance 953 | sid = None if broadcast else server.client_id 954 | server.send_sync(1002, audio_binary, sid=sid) 955 | return {"ui": { 956 | "audio": [{ 957 | "source": "websocket", 958 | "content-type": content_type, 959 | "type": "output", 960 | }] 961 | }} 962 | --------------------------------------------------------------------------------