### Environment Setup Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Set up the conda environment and install PyTorch with CUDA support. Ensure the CUDA version matches your machine's configuration. ```shell # step 1, create conda env conda create -n hunyuan3d-1 python=3.9 or 3.10 or 3.11 or 3.12 conda activate hunyuan3d-1 # step 2. install torch realated package which pip # check pip corresponds to python # modify the cuda version according to your machine (recommended) pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121 ``` -------------------------------- ### Install Build Tools on Ubuntu Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md Install necessary build tools, including GCC and G++, on Ubuntu 22.04 before proceeding with CUDA toolkit installation. ```bash sudo apt update sudo apt install gcc g++ ``` -------------------------------- ### Download and Install CUDA 11.8 Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md Download the CUDA 11.8 runfile installer for Linux x86_64 and execute it with sudo. ```bash wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run sudo sh cuda_11.8.0_520.61.05_linux.run ``` -------------------------------- ### Install Hugging Face CLI Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Install the huggingface-cli tool to manage model downloads. Refer to Hugging Face documentation for detailed instructions. ```bash python3 -m pip install "huggingface_hub[cli]" ``` -------------------------------- ### Launch Training Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/Hunyuan3D_2_1/hy3dpaint/README.md Start the training process using the provided configuration file and specify a log directory. This command is used for overfitting training tests. ```bash python3 train.py --base 'cfgs/hunyuan-paint-pbr.yaml' --name overfit --logdir logs/ ``` -------------------------------- ### Minimal Dataset Configuration Example Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/PartCrafter/datasets/README.md A minimal configuration file for the dataset. Ensure all paths and parameters are correctly set for your data. ```json [ { "mesh_path": "/path/to/object.glb", "surface_path": "/path/to/object.npy", "image_path": "/path/to/object.png", "num_parts": 4, "iou_mean": 0.5, "iou_max": 0.9, "valid": true }, { "...": "..." }, ... ] ``` -------------------------------- ### Install Miniconda Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md Download the Miniconda3 installer script for Linux x86_64 and execute it. Source the bashrc to activate Miniconda. ```bash wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda-installer.sh bash miniconda-installer.sh source ~/.bashrc ``` -------------------------------- ### Install PartCrafter Dependencies Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/PartCrafter/README.md Sets up a conda environment and installs PyTorch with CUDA support, followed by other project dependencies. Ensure you have the correct CUDA version installed. ```bash conda create -n partcrafter python=3.11.13 conda activate partcrafter pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124 ``` ```bash git clone https://github.com/wgsxm/PartCrafter.git cd PartCrafter bash settings/setup.sh ``` ```bash conda install -c conda-forge libegl libglu pyopengl ``` -------------------------------- ### Launch Gradio Demo (Standard) Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Start the Gradio web interface for multi-view generation using the standard model. The demo will be accessible at http://0.0.0.0:8080. ```bash python3 app.py python3 app.py --save_memory ``` -------------------------------- ### Install Optional Acceleration Packages Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Install xformers or flash_attn to potentially accelerate computation. Ensure PyTorch and CUDA versions are compatible. ```bash pip install xformers --index-url https://download.pytorch.org/whl/cu121 ``` ```bash pip install flash_attn ``` -------------------------------- ### Install nvidia-container-runtime on Linux Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md Install the nvidia-container-runtime package on a Linux host to enable GPU support in Docker. ```bash sudo apt-get install nvidia-container-runtime ``` -------------------------------- ### Configure Color Picker with Coloris Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/web/html/threeVisualizer.html Initialize Coloris for a color picker element. This example sets up a dark theme with RGB format and predefined swatches. ```javascript Coloris({ el: '.coloris', theme: 'polaroid', themeMode: 'dark', format: 'rgb', alpha: false, swatches: [ 'rgb(0, 0, 0)', 'rgb(128, 128, 128)', 'rgb(255, 255, 255)', 'rgb(132, 188, 218)', 'rgb(128, 227, 119)', 'rgb(213, 96, 98)' ] }); ``` -------------------------------- ### Download and Install CUDA 12.1 Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md Download the CUDA 12.1 runfile installer for Linux x86_64 and execute it with sudo. ```bash wget https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run sudo sh cuda_12.1.0_530.30.02_linux.run ``` -------------------------------- ### Launch Gradio Demo (Lite) Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Start the Gradio web interface for multi-view generation using the lite model. The demo will be accessible at http://0.0.0.0:8080. Use --save_memory to reduce VRAM usage. ```bash python3 app.py --use_lite python3 app.py --use_lite --save_memory ``` -------------------------------- ### Manage Multiple CUDA Installations Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md Use update-alternatives to manage symbolic links for multiple CUDA installations, setting priorities. ```bash sudo update-alternatives --install /usr/local/cuda cuda /usr/local/cuda-11.8 10 sudo update-alternatives --install /usr/local/cuda cuda /usr/local/cuda-12.1 10 ``` -------------------------------- ### Manual Installation of ComfyUI-3D-Pack Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/README.md Use these bash commands to manually clone the ComfyUI-3D-Pack repository into your ComfyUI custom_nodes directory and install its dependencies. Ensure you are in the correct ComfyUI directory before executing. ```bash cd Your ComfyUI Root Directory\ComfyUI\custom_nodes\ git clone https://github.com/MrForExample/ComfyUI-3D-Pack.git cd ComfyUI-3D-Pack Your ComfyUI Root Directory\python_embeded\python.exe -s -m pip install -r requirements.txt Your ComfyUI Root Directory\python_embeded\python.exe install.py ``` -------------------------------- ### Install Rendering Dependencies Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/Hunyuan3D_2_1/hy3dshape/tools/README.md Installs necessary Python packages for Blender's rendering script. Ensure you are using the correct Python executable path for your Blender version. ```bash /Applications/Blender.app/Contents/Resources/4.1/python/bin/python3.11 -m pip install OpenEXR Imath opencv-python ``` -------------------------------- ### Build Wheels with CUDA 11.8 on Windows Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md Following the CUDA 11.8 swap, execute the build script for each Python environment to create wheels for this CUDA version. Verify the Python path is accurate for your setup. ```bash # Example of using the path to the miniconda envs on my PC, you may need to change the python path C:\Users\reall\Softwares\Miniconda\envs\Comy3D_py310_cu118\python ./ComfyUI-3D-Pack/_Pre_Builds/_Build_Scripts/auto_build_all.py C:\Users\reall\Softwares\Miniconda\envs\Comy3D_py311_cu118\python ./ComfyUI-3D-Pack/_Pre_Builds/_Build_Scripts/auto_build_all.py C:\Users\reall\Softwares\Miniconda\envs\Comy3D_py312_cu118\python ./ComfyUI-3D-Pack/_Pre_Builds/_Build_Scripts/auto_build_all.py ``` -------------------------------- ### Install PyTorch with Specific Versions Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Manually specify PyTorch and torchvision versions for compatibility, especially for Python 3.9. Ensure CUDA version matches your environment. ```bash # python3.9 pip install torch==2.0.1 torchvision==0.15.2 --index-url https://download.pytorch.org/whl/cu118 ``` -------------------------------- ### Add CUDA Environment Variables Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md Set the PATH and LD_LIBRARY_PATH environment variables for both CUDA 11.8 and CUDA 12.1 installations. ```bash export PATH="/usr/local/cuda-11.8/bin:$PATH" export LD_LIBRARY_PATH="/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH" export PATH="/usr/local/cuda-12.1/bin:$PATH" export LD_LIBRARY_PATH="/usr/local/cuda-12.1/lib64:$LD_LIBRARY_PATH" ``` -------------------------------- ### Build Wheels with CUDA 12.4 on Windows Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md Execute the build script for each Python environment to generate wheels compatible with CUDA 12.4. Ensure the Python path is correctly set for your Miniconda installation. ```bash # Example of using the path to the miniconda envs on my PC, you may need to change the python path C:\Users\reall\Softwares\Miniconda\envs\Comy3D_py310_cu124\python ./ComfyUI-3D-Pack/_Pre_Builds/_Build_Scripts/auto_build_all.py C:\Users\reall\Softwares\Miniconda\envs\Comy3D_py311_cu124\python ./ComfyUI-3D-Pack/_Pre_Builds/_Build_Scripts/auto_build_all.py C:\Users\reall\Softwares\Miniconda\envs\Comy3D_py312_cu124\python ./ComfyUI-3D-Pack/_Pre_Builds/_Build_Scripts/auto_build_all.py ``` -------------------------------- ### Execute Blender Rendering Script Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/Hunyuan3D_2_1/hy3dshape/tools/README.md Runs the Blender rendering script for converting 3D formats to PLY or rendering condition images. Adjust BLENDER_PATH and INPUT_FILE according to your setup. ```bash $BLENDER_PATH -b -P render/render.py -- \ --object ${INPUT_FILE} --geo_mode --resolution 512 \ --output_folder $OUTPUT_FOLDER ``` -------------------------------- ### Generate Image with SD v2.1-base (Zero Terminal SNR) Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-2/hunyuan3d-paint-v2-0-turbo/README.md Use this snippet to generate an image from a text prompt using the SD v2.1-base (Zero Terminal SNR) model. Ensure you have the 'diffusers' library installed and a CUDA-enabled GPU. ```python from diffusers import StableDiffusionPipeline prompt = "A young girl smiling" pipe = StableDiffusionPipeline.from_pretrained("ByteDance/sd2.1-base-zsnr-laionaes6").to("cuda") pipe(prompt, guidance_scale=7.5, guidance_rescale=0.7).images[0].save("out.jpg") ``` -------------------------------- ### Clone Repository Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Begin by cloning the repository to your local machine. ```shell git clone https://github.com/tencent/Hunyuan3D-1 cd Hunyuan3D-1 ``` -------------------------------- ### Run Quick Inference Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/Hunyuan3D_2_1/hy3dpaint/README.md Execute the `demo.py` script for quick inference using a 3D mesh and a reference image. The result will be saved as `textured_mesh.glb`. ```bash python3 demo.py ``` -------------------------------- ### Run Separated Image-to-3D Pipeline (Lite) Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Run the lite image-to-3D pipeline in separate modules for GPUs with at least 10GB of VRAM. Requires specifying the image path and output folder. ```bash bash scripts/image_to_3d_lite_separately.sh ./demos/example_000.png ./outputs/test # >= 10G ``` -------------------------------- ### Run Separated Text-to-3D Pipeline (Lite) Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Run the lite text-to-3D pipeline in separate modules for GPUs with at least 14GB of VRAM. Requires specifying the text prompt and output folder. ```bash bash scripts/text_to_3d_lite_separately.sh 'a lovely rabbit' ./outputs/test # >= 14G ``` -------------------------------- ### Train PartCrafter from Scratch Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/PartCrafter/README.md Train the PartCrafter model using the specified configuration file. Adjust gradient accumulation steps, output directory, and tags as needed. ```bash bash scripts/train_partcrafter.sh --config configs/mp8_nt512.yaml --use_ema \ --gradient_accumulation_steps 4 \ --output_dir output_partcrafter \ --tag scaleup_mp8_nt512 ``` -------------------------------- ### Download RealESRGAN Weight Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/Hunyuan3D_2_1/hy3dpaint/README.md Manually download the RealESRGAN weight to the `ckpt` folder. This is a prerequisite for quick inference. ```bash wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P ckpt ``` -------------------------------- ### Download TripoSG Weights Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/PartCrafter/README.md Download the pre-trained TripoSG model weights from Hugging Face. Store them in the specified directory for training. ```bash huggingface-cli download VAST-AI/TripoSG --local-dir pretrained_weights/TripoSG ``` -------------------------------- ### Initialize Coloris Color Picker Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/web/html/gsVisualizer.html Initializes the Coloris color picker with specified options. Use this to enable color selection in the UI. ```javascript Coloris({ el: '.coloris', theme: 'polaroid', themeMode: 'dark', format: 'rgb', alpha: false, swatches: [ 'rgb(0, 0, 0)', 'rgb(128, 128, 128)', 'rgb(255, 255, 255)', 'rgb(132, 188, 218)', 'rgb(128, 227, 119)', 'rgb(213, 96, 98)' ] }); ``` -------------------------------- ### Finetune PartCrafter with More Tokens Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/PartCrafter/README.md Finetune the PartCrafter model with more tokens, which may improve performance. Load pre-trained models and checkpoints, and specify a new tag. ```bash bash scripts/train_partcrafter.sh --config configs/mp16_nt1024.yaml --use_ema \ --gradient_accumulation_steps 4 \ --output_dir output_partcrafter \ --load_pretrained_model scaleup_mp16_nt512 \ --load_pretrained_model_ckpt 10 \ --tag scaleup_mp16_nt1024 ``` -------------------------------- ### Run Lite Image-to-3D Pipeline Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Execute the lite version of the image-to-3D generation pipeline. Requires approximately 22GB of VRAM, or 18GB with the --save_memory flag. ```bash bash scripts/image_to_3d_lite.sh ``` -------------------------------- ### Build and Run Comfy3D Docker Container Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md Build the Comfy3D Docker image and run it, mapping port 8188 and enabling all GPUs. ```bash docker build -t comfy3d . && docker run --rm -it -p 8188:8188 --gpus all comfy3d ``` -------------------------------- ### Run Standard Image-to-3D Pipeline Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Execute the standard image-to-3D generation pipeline using a provided script. Requires approximately 30GB of VRAM, or 24GB with the --save_memory flag. ```bash bash scripts/image_to_3d_std.sh ``` -------------------------------- ### Run Lite Text-to-3D Pipeline Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Execute the lite version of the text-to-3D generation pipeline. Requires approximately 22GB of VRAM, or 18GB with the --save_memory flag. ```bash bash scripts/text_to_3d_lite.sh ``` -------------------------------- ### Finetune PartCrafter with More Parts Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/PartCrafter/README.md Finetune the PartCrafter model to handle a larger number of parts. Load pre-trained models and checkpoints, and specify a new tag. ```bash bash scripts/train_partcrafter.sh --config configs/mp16_nt512.yaml --use_ema \ --gradient_accumulation_steps 4 \ --output_dir output_partcrafter \ --load_pretrained_model scaleup_mp8_nt512 \ --load_pretrained_model_ckpt 10 \ --tag scaleup_mp16_nt512 ``` -------------------------------- ### Run Standard Text-to-3D Pipeline Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Execute the standard text-to-3D generation pipeline using a provided script. Requires approximately 30GB of VRAM, or 24GB with the --save_memory flag. ```bash bash scripts/text_to_3d_std.sh ``` -------------------------------- ### Sample Points from Mesh Surface Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/PartCrafter/datasets/README.md Use this script to sample points from the mesh surface of a single 3D object. Ensure the input GLB file and output directory are correctly specified. ```python python datasets/preprocess/mesh_to_point.py --input assets/objects/scissors.glb --output preprocessed_data ``` -------------------------------- ### Build Wheels with CUDA 12.1 on Windows Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md After swapping to CUDA 12.1, run the build script for each Python environment to generate wheels compatible with this CUDA version. Adjust the Python path as necessary. ```bash # Example of using the path to the miniconda envs on my PC, you may need to change the python path C:\Users\reall\Softwares\Miniconda\envs\Comy3D_py310_cu121\python ./ComfyUI-3D-Pack/_Pre_Builds/_Build_Scripts/auto_build_all.py C:\Users\reall\Softwares\Miniconda\envs\Comy3D_py311_cu121\python ./ComfyUI-3D-Pack/_Pre_Builds/_Build_Scripts/auto_build_all.py C:\Users\reall\Softwares\Miniconda\envs\Comy3D_py312_cu121\python ./ComfyUI-3D-Pack/_Pre_Builds/_Build_Scripts/auto_build_all.py ``` -------------------------------- ### Run Separated Image-to-3D Pipeline (Std) Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Run the standard image-to-3D pipeline in separate modules for GPUs with at least 16GB of VRAM. Requires specifying the image path and output folder. ```bash bash scripts/image_to_3d_std_separately.sh ./demos/example_000.png ./outputs/test # >= 16G ``` -------------------------------- ### Run Separated Text-to-3D Pipeline (Std) Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Run the standard text-to-3D pipeline in separate modules for GPUs with at least 16GB of VRAM. Requires specifying the text prompt and output folder. ```bash bash scripts/text_to_3d_std_separately.sh 'a lovely rabbit' ./outputs/test # >= 16G ``` -------------------------------- ### Preprocess Folder of Meshes Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/PartCrafter/datasets/README.md Use this script to preprocess an entire folder of meshes. It will process all GLB files in the input directory and generate a configuration file. ```python python datasets/preprocess/preprocess.py --input assets/objects --output preprocessed_data ``` -------------------------------- ### Configure Docker Daemon for NVIDIA Runtime Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md Edit or create the /etc/docker/daemon.json file to configure Docker to use the NVIDIA container runtime. ```json { "runtimes": { "nvidia": { "path": "/usr/bin/nvidia-container-runtime", "runtimeArgs": [] } }, "default-runtime": "nvidia" } ``` -------------------------------- ### Build Wheels with CUDA 12.1 Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md Build wheels for ComfyUI-3D-Pack using Python environments with CUDA 12.1. Ensure CUDA 12.1 is selected via update-alternatives and set CUDA_HOME. ```bash sudo update-alternatives --config cuda export CUDA_HOME="/usr/local/cuda-12.1/" ~/miniconda3/envs/Comy3D_py310_cu121/bin/python ./ComfyUI-3D-Pack/_Pre_Builds/_Build_Scripts/auto_build_all.py ~/miniconda3/envs/Comy3D_py311_cu121/bin/python ./ComfyUI-3D-Pack/_Pre_Builds/_Build_Scripts/auto_build_all.py ~/miniconda3/envs/Comy3D_py312_cu121/bin/python ./ComfyUI-3D-Pack/_Pre_Builds/_Build_Scripts/auto_build_all.py ``` -------------------------------- ### Download Hunyuan3D-1 Model Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Download the standard Hunyuan3D-1 model for multi-view generation using the Hugging Face CLI. Models are saved to the 'weights' directory. ```bash mkdir weights huggingface-cli download tencent/Hunyuan3D-1 --local-dir ./weights ``` -------------------------------- ### Run InstantMesh Reconstruction Source: https://context7.com/mrforexample/comfyui-3d-pack/llms.txt Reconstructs a textured 3D mesh from multi-view images using the InstantMesh model. Requires the loaded model, multi-view images, and their camera poses. ```json { "class_type": "[Comfy3D] InstantMesh Reconstruction Model", "inputs": { "lrm_model": ["Load_InstantMesh_Model", 0], "multiview_images": ["Zero123Plus_Model", 0], "orbit_camera_poses": ["Zero123Plus_Model", 1], "orbit_camera_fovy": 30.0, "texture_resolution": 1024 } } ``` -------------------------------- ### Download Unique3D Models Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/DOCKER_INSTRUCTIONS.md Download the required models for the Unique3D workflow and place them in the 'models' directory. Ensure you have sufficient disk space. ```bash wget -c https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter_sd15.safetensors -P models/ wget -c https://huggingface.co/h94/IP-Adapter/resolve/main/models/image_encoder/model.safetensors -P models/ wget -c https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P models/ wget -c https://huggingface.co/spaces/Wuvin/Unique3D/resolve/main/ckpt/controlnet-tile/diffusion_pytorch_model.safetensors -P models/ wget -c https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt -P models/ ``` -------------------------------- ### Use Built Wheels Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md Copy the built wheels folder to the specified ComfyUI custom nodes path and reinstall Comfy3D. ```text Copy the folder _Wheels_win_py{python_version}_cu{cuda_version} to {Your ComfyUI Root Folder Path}\ComfyUI\custom_nodes\ComfyUI-3D-Pack\_Pre_Builds\_Build_Wheels and then reinstall the Comfy3D For example, _Wheels_win_py311_cu121 to C:\Users\reall\Softwares\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-3D-Pack\_Pre_Builds\_Build_Wheels ``` -------------------------------- ### Load InstantMesh Reconstruction Model Source: https://context7.com/mrforexample/comfyui-3d-pack/llms.txt Loads the InstantMesh reconstruction model, supporting 'instant_mesh_large' for FlexiCubes. This is the first step for mesh reconstruction. ```json { "class_type": "[Comfy3D] Load InstantMesh Reconstruction Model", "inputs": { "model_name": "instant_mesh_large.ckpt" } } ``` -------------------------------- ### Build Wheels with CUDA 11.8 Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md Build wheels for ComfyUI-3D-Pack using Python environments with CUDA 11.8. Ensure CUDA 11.8 is selected via update-alternatives and set CUDA_HOME. ```bash sudo update-alternatives --config cuda export CUDA_HOME="/usr/local/cuda-11.8/" ~/miniconda3/envs/Comy3D_py310_cu118/bin/python ./ComfyUI-3D-Pack/_Pre_Builds/_Build_Scripts/auto_build_all.py ~/miniconda3/envs/Comy3D_py311_cu118/bin/python ./ComfyUI-3D-Pack/_Pre_Builds/_Build_Scripts/auto_build_all.py ~/miniconda3/envs/Comy3D_py312_cu118/bin/python ./ComfyUI-3D-Pack/_Pre_Builds/_Build_Scripts/auto_build_all.py ``` -------------------------------- ### Stack Orbit Camera Poses Source: https://context7.com/mrforexample/comfyui-3d-pack/llms.txt Generates camera poses for multi-view rendering and training by defining ranges and steps for orbit radius, elevation, azimuth, and orbit center position. ```python # ComfyUI Node: [Comfy3D] Stack Orbit Camera Poses # Input Types: # orbit_radius_start/stop/step: FLOAT - camera distance range # elevation_start/stop/step: FLOAT - vertical angle (-90 to 90) # azimuth_start/stop/step: FLOAT - horizontal angle (-180 to 180) # orbit_center_X/Y/Z_start/stop/step: FLOAT - orbit center position # Output Types: # orbit_camposes: ORBIT_CAMPOSES - list of camera poses ``` -------------------------------- ### Build Docker Image Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/DOCKER_INSTRUCTIONS.md Build the Docker image for ComfyUI 3D Pack. The DOCKER_BUILDKIT=0 flag is used to disable buildkit, which is not compatible with the docker-compose file. ```bash DOCKER_BUILDKIT=0 docker build -t comfy3d --file Dockerfile . ``` ```bash DOCKER_BUILDKIT=0 docker compose build ``` -------------------------------- ### Run PartCrafter Inference Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/PartCrafter/README.md Generates a 3D part-level object from an input image. The script automatically downloads necessary model weights. Use the `--rmbg` flag for custom images to remove the background. ```python python scripts/inference_partcrafter.py \ --image_path assets/images/np3_2f6ab901c5a84ed6bbdf85a67b22a2ee.png \ --num_parts 3 --tag robot --render ``` -------------------------------- ### Clone ComfyUI-3D-Pack Repository Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/README.md Clone the ComfyUI-3D-Pack repository from GitHub to your local machine. ```bash git clone https://github.com/MrForExample/ComfyUI-3D-Pack.git ``` -------------------------------- ### Feature Extraction with DINOv2 ViT Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/CharacterGen/3D_Stage/models/base/README.md Demonstrates how to load the DINOv2 base model and its processor from Hugging Face, process an image, and extract its last hidden states for feature extraction. ```python from transformers import AutoImageProcessor, AutoModel from PIL import Image import requests url = 'http://images.cocodataset.org/val2017/000000039769.jpg' image = Image.open(requests.get(url, stream=True).raw) processor = AutoImageProcessor.from_pretrained('facebook/dinov2-base') model = AutoModel.from_pretrained('facebook/dinov2-base') inputs = processor(images=image, return_tensors="pt") outputs = model(**inputs) last_hidden_states = outputs.last_hidden_state ``` -------------------------------- ### Execute Overall Data Processing Pipeline Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/Hunyuan3D_2_1/hy3dshape/tools/README.md Runs the main data processing pipeline by executing the 'pipeline.sh' script. Ensure the first four variables (INPUT_FILE, OUTPUT_FOLDER, NAME, BLENDER_PATH) are correctly configured in the script. ```bash bash pipeline.sh ``` -------------------------------- ### KUIKIT (kiuikit) Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/_Pre_Builds/_Build_Scripts/dependencies.txt A utility library, likely for 3D or graphics applications. ```git https://github.com/ashawkey/kiuikit.git ``` -------------------------------- ### OpenGL Coordinate System Visualization Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/README.md Illustrates the world and camera coordinate systems used in OpenGL, relevant for understanding 3D transformations and rendering. Note the axis orientations and conventions for elevation and azimuth. ```text World Camera +y up target | | / | | / |______+x |/______right / / / / +z forward z-axis is pointing towards you and is coming out of the screen elevation: in (-90, 90), from +y to +x is (-90, 0) azimuth: in (-180, 180), from +z to +x is (0, 90) ``` -------------------------------- ### Run TripoSR Reconstruction Source: https://context7.com/mrforexample/comfyui-3d-pack/llms.txt Performs 3D mesh reconstruction using the loaded TripoSR model. Requires the model, a reference image, and a foreground mask. ```json { "class_type": "[Comfy3D] TripoSR", "inputs": { "tsr_model": ["Load_TripoSR_Model", 0], "reference_image": ["LoadImage", 0], "reference_mask": ["RemoveBackground", 0], "geometry_extract_resolution": 256, "marching_cude_threshold": 25.0 } } ``` -------------------------------- ### Download HunyuanDiT Model Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-1/README.md Download the HunyuanDiT v1.1 Distilled model for diffusion-based generation. Models are saved to a specific subdirectory within 'weights'. ```bash mkdir weights/hunyuanDiT huggingface-cli download Tencent-Hunyuan/HunyuanDiT-v1.1-Diffusers-Distilled --local-dir ./weights/hunyuanDiT ``` -------------------------------- ### Load 3D Mesh Node Source: https://context7.com/mrforexample/comfyui-3d-pack/llms.txt Loads a 3D mesh file from disk. Supports .obj, .ply, and .glb formats with options for resizing, renormalization, and cleaning. ```python # ComfyUI Node: [Comfy3D] Load 3D Mesh # Input Types: # mesh_file_path: STRING - path to mesh file (relative to input dir or absolute) # resize: BOOLEAN - whether to resize the mesh # renormal: BOOLEAN - whether to recalculate normals # retex: BOOLEAN - whether to reset texture # optimizable: BOOLEAN - enable gradient computation # clean: BOOLEAN - clean mesh geometry # resize_bound: FLOAT - bound for resizing (default: 0.5) # Output Types: # mesh: MESH - loaded mesh object # Example workflow usage: { "class_type": "[Comfy3D] Load 3D Mesh", "inputs": { "mesh_file_path": "example_inputs/my_model.glb", "resize": false, "renormal": true, "retex": false, "optimizable": false, "clean": false, "resize_bound": 0.5 } } ``` -------------------------------- ### Hunyuan3D 2.1 Texture Generation Pipeline Source: https://context7.com/mrforexample/comfyui-3d-pack/llms.txt Loads the Hunyuan3D 2.1 texture generation pipeline and applies PBR materials to a mesh using a generated image. Configure resolution and enable PBR material creation. ```json # Stage 2: Texture generation with PBR materials { "class_type": "[Comfy3D] Load Hunyuan3D 21 TexGen Pipeline", "inputs": { "max_num_view": 8, "resolution": 768, "enable_mmgp": true } } { "class_type": "[Comfy3D] Hunyuan3D 21 TexGen", "inputs": { "texgen_pipe": ["Load_TexGen", 0], "mesh_path": ["Save_Mesh_Path", 0], "image": ["ShapeGen_Output", 1], "create_pbr": true, "use_remesh": false } } # Outputs textured mesh with albedo, metallic, roughness, and normal maps ``` -------------------------------- ### Render Images from 3D Object Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Gen_3D_Modules/PartCrafter/datasets/README.md This script renders images from a given 3D object. Specify the input GLB file and the output directory for the rendered images. ```python python datasets/preprocess/render.py --input assets/objects/scissors.glb --output preprocessed_data ``` -------------------------------- ### Run Docker Container Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/DOCKER_INSTRUCTIONS.md Run the ComfyUI 3D Pack Docker container with NVIDIA support and volume mounts for output and models. This command maps local directories to container paths and exposes port 8188. ```bash docker run -d \ --name comfy3d \ --platform linux/amd64 \ --runtime=nvidia \ -p 8188:8188 \ -e NVIDIA_VISIBLE_DEVICES=all \ -e NVIDIA_DRIVER_CAPABILITIES=all \ -e COMFYUI_PATH=/app \ -v $(pwd)/output:/app/output \ -v $(pwd)/models/diffusion_pytorch_model.safetensors:/app/models/controlnet/control_unique3d_sd15_tile.safetensors \ -v $(pwd)/models/ip-adapter_sd15.safetensors:/app/models/ipadapter/ip-adapter_sd15.safetensors \ -v $(pwd)/models/RealESRGAN_x4plus.pth:/app/models/upscale_models/RealESRGAN_x4plus.pth \ -v $(pwd)/models/v1-5-pruned-emaonly.ckpt:/app/models/checkpoints/v1-5-pruned-emaonly.ckpt \ -v $(pwd)/models/model.safetensors:/app/models/clip_vision/OpenCLIP-ViT-H-14.safetensors \ comfy3d ``` ```bash docker compose up ``` -------------------------------- ### Load 3D Mesh Source: https://context7.com/mrforexample/comfyui-3d-pack/llms.txt Loads a 3D mesh file from disk. Supports .obj, .ply, and .glb formats with options for resizing, renormalization, and cleaning. ```APIDOC ## Load 3D Mesh ### Description Loads a 3D mesh file from disk into memory. Supports .obj, .ply, and .glb formats with options for resizing, renormalization, and cleaning the mesh geometry. ### Method Not applicable (ComfyUI Node) ### Endpoint Not applicable (ComfyUI Node) ### Parameters #### Input Types: - **mesh_file_path** (STRING) - Required - path to mesh file (relative to input dir or absolute) - **resize** (BOOLEAN) - Optional - whether to resize the mesh - **renormal** (BOOLEAN) - Optional - whether to recalculate normals - **retex** (BOOLEAN) - Optional - whether to reset texture - **optimizable** (BOOLEAN) - Optional - enable gradient computation - **clean** (BOOLEAN) - Optional - clean mesh geometry - **resize_bound** (FLOAT) - Optional - bound for resizing (default: 0.5) #### Output Types: - **mesh** (MESH) - loaded mesh object ### Request Example ```json { "class_type": "[Comfy3D] Load 3D Mesh", "inputs": { "mesh_file_path": "example_inputs/my_model.glb", "resize": false, "renormal": true, "retex": false, "optimizable": false, "clean": false, "resize_bound": 0.5 } } ``` ### Response #### Success Response (200) - **mesh** (MESH) - loaded mesh object ``` -------------------------------- ### Load TripoSG Image to 3D Model Pipeline Source: https://context7.com/mrforexample/comfyui-3d-pack/llms.txt Loads the TripoSG pipeline from VAST-AI for high-quality single-image to 3D reconstruction. Supports flash decoder for faster processing. ```json # Load pipeline: { "class_type": "[Comfy3D] Load Diffusers Pipeline", "inputs": { "diffusers_pipeline_name": "TripoSGPipeline", "repo_id": "VAST-AI/TripoSG" } } ``` -------------------------------- ### Cite Common Diffusion Noise Schedules and Sample Steps are Flawed Source: https://github.com/mrforexample/comfyui-3d-pack/blob/main/Checkpoints/Diffusers/tencent/Hunyuan3D-2/hunyuan3d-paint-v2-0-turbo/README.md BibTeX entry for the 'Common Diffusion Noise Schedules and Sample Steps are Flawed' paper. ```bibtex @misc{lin2023common, title={Common Diffusion Noise Schedules and Sample Steps are Flawed}, author={Shanchuan Lin and Bingchen Liu and Jiashi Li and Xiao Yang}, year={2023}, eprint={2305.08891}, archivePrefix={arXiv}, primaryClass={cs.CV} } ```