### Install Delta-Prox from Source Source: https://github.com/tencent/hunyuan3d-2/blob/main/docs/source/installation/index.md Installs the Delta-Prox library directly from its GitHub repository. This method is useful for users who want the latest version or to contribute to the project. ```bash pip install git+https://github.com/princeton-computational-imaging/Delta-Prox.git ``` -------------------------------- ### Install Python Requirements for Hunyuan3D Source: https://github.com/tencent/hunyuan3d-2/blob/main/README.md Installs necessary Python packages for Hunyuan3D, including PyTorch, and then installs the project in editable mode. It also includes specific setup commands for texture generation components. ```bash pip install -r requirements.txt pip install -e . # for texture cd hy3dgen/texgen/custom_rasterizer python3 setup.py install cd ../../.. cd hy3dgen/texgen/differentiable_renderer python3 setup.py install ``` -------------------------------- ### Editable Install Delta-Prox from Source Source: https://github.com/tencent/hunyuan3d-2/blob/main/docs/source/installation/index.md Performs an editable installation of Delta-Prox from its source code. This is recommended for developers who need to use the main version of the source code or test their code changes. ```bash git clone git+https://github.com/princeton-computational-imaging/Delta-Prox.git cd DeltaProx pip install -e . ``` -------------------------------- ### Install Delta-Prox with pip Source: https://github.com/tencent/hunyuan3d-2/blob/main/docs/source/installation/index.md Installs the Delta-Prox library using pip. This is the simplest method for users who want to quickly add the library to their Python environment. ```bash pip install dprox ``` -------------------------------- ### Launch API Server for Hunyuan3D-2 (Bash) Source: https://github.com/tencent/hunyuan3d-2/blob/main/README.md This command starts a local API server on the specified host and port. This server can handle requests for image-to-3D generation and texturing existing meshes. ```bash python api_server.py --host 0.0.0.0 --port 8080 ``` -------------------------------- ### Multiview Texture Generation Pipeline Example Source: https://github.com/tencent/hunyuan3d-2/blob/main/README.md This Python script demonstrates the usage of the multiview texture generation pipeline for Hunyuan3D-Paint-v2-0-Turbo. It is part of the examples provided with the Hunyuan3D release. ```python from huggingface.hub import HfApi # Example usage for fast texture generation with multiview input # This script is a placeholder and would contain actual implementation details # depending on the specific pipeline structure. print("Running multiview texture generation pipeline...") # Placeholder for actual code # api = HfApi() # repo_id = "tencent/Hunyuan3D-2/tree/main/hunyuan3d-paint-v2-0-turbo" # files = api.list_repo_files(repo_id) # print(files) ``` -------------------------------- ### Generate Texture for 3D Mesh using Hunyuan3D-Paint Source: https://github.com/tencent/hunyuan3d-2/blob/main/docs/source/started/code.md This example demonstrates how to first generate a mesh using Hunyuan3D-DiT and then apply texture synthesis using the Hunyuan3D-Paint pipeline. It takes a mesh and an image as input to generate a textured mesh. ```python from hy3dgen.texgen import Hunyuan3DPaintPipeline from hy3dgen.shapegen import Hunyuan3DDiTFlowMatchingPipeline # let's generate a mesh first pipeline = Hunyuan3DDiTFlowMatchingPipeline.from_pretrained('tencent/Hunyuan3D-2') mesh = pipeline(image='assets/demo.png')[0] pipeline = Hunyuan3DPaintPipeline.from_pretrained('tencent/Hunyuan3D-2') mesh = pipeline(mesh, image='assets/demo.png') ``` -------------------------------- ### Generate 3D Mesh using Hunyuan3D-DiT Source: https://github.com/tencent/hunyuan3d-2/blob/main/docs/source/started/code.md This snippet shows how to load the Hunyuan3D-DiT pipeline from pre-trained weights and generate a 3D mesh from an input image. The output is a trimesh object that can be saved to various formats. ```python from hy3dgen.shapegen import Hunyuan3DDiTFlowMatchingPipeline pipeline = Hunyuan3DDiTFlowMatchingPipeline.from_pretrained('tencent/Hunyuan3D-2') mesh = pipeline(image='assets/demo.png')[0] ``` -------------------------------- ### Guidance Distillation Model Inference (Hunyuan3D-DiT-v2-0-Fast) Source: https://github.com/tencent/hunyuan3d-2/blob/main/README.md This Python script demonstrates the usage of Hunyuan3D-DiT-v2-0-Fast, a guidance distillation model designed to halve diffusion transformer inference time. The minimal_demo.py file provides practical examples for its application. ```python # Placeholder for the minimal demo script demonstrating Hunyuan3D-DiT-v2-0-Fast. # This script would show how to load the model and perform inference. print("Running minimal demo for Hunyuan3D-DiT-v2-0-Fast...") # Placeholder for actual code def run_fast_dit_inference(model_path, input_data): print(f"Running inference with model: {model_path}") # Simulate inference return "generated_3d_data" # Example call (replace with actual model path and input data) # generated_output = run_fast_dit_inference("path/to/Hunyuan3D-DiT-v2-0-Fast", "some_input") # print(f"Inference complete: {generated_output}") ``` -------------------------------- ### Make POST Request to Hunyuan3D-2 API Server (Bash) Source: https://github.com/tencent/hunyuan3d-2/blob/main/README.md This example shows how to send a POST request to the locally running Hunyuan3D-2 API server to generate a 3D model from an image without texture. The image is base64 encoded and sent in JSON format. ```bash img_b64_str=$(base64 -i assets/demo.png) curl -X POST "http://localhost:8080/generate" \ -H "Content-Type: application/json" \ -d '{ "image": "'"$img_b64_str"'" }' \ -o test2.glb ``` -------------------------------- ### Run Standard Gradio App with Hunyuan3D-2 Source: https://github.com/tencent/hunyuan3d-2/blob/main/docs/source/started/gradio.md Launches the standard Gradio application for different Hunyuan3D-2 model variants. Requires Python 3 and specifies model paths, subfolders, and optional low VRAM mode. Intended for bash execution. ```bash python3 gradio_app.py --model_path tencent/Hunyuan3D-2mini --subfolder hunyuan3d-dit-v2-mini --texgen_model_path tencent/Hunyuan3D-2 --low_vram_mode ``` ```bash python3 gradio_app.py --model_path tencent/Hunyuan3D-2mv --subfolder hunyuan3d-dit-v2-mv --texgen_model_path tencent/Hunyuan3D-2 --low_vram_mode ``` ```bash python3 gradio_app.py --model_path tencent/Hunyuan3D-2 --subfolder hunyuan3d-dit-v2-0 --texgen_model_path tencent/Hunyuan3D-2 --low_vram_mode ``` -------------------------------- ### Launch Gradio App for Hunyuan3D-2 (Bash) Source: https://github.com/tencent/hunyuan3d-2/blob/main/README.md These commands demonstrate how to launch the Gradio application for Hunyuan3D-2 in different configurations (Standard and Turbo versions) and with various model subfolders. The `--low_vram_mode` and `--enable_flashvdm` flags can be used for optimization. ```bash # Hunyuan3D-2mini python3 gradio_app.py --model_path tencent/Hunyuan3D-2mini --subfolder hunyuan3d-dit-v2-mini --texgen_model_path tencent/Hunyuan3D-2 --low_vram_mode # Hunyuan3D-2mv python3 gradio_app.py --model_path tencent/Hunyuan3D-2mv --subfolder hunyuan3d-dit-v2-mv --texgen_model_path tencent/Hunyuan3D-2 --low_vram_mode # Hunyuan3D-2 python3 gradio_app.py --model_path tencent/Hunyuan3D-2 --subfolder hunyuan3d-dit-v2-0 --texgen_model_path tencent/Hunyuan3D-2 --low_vram_mode ``` ```bash # Hunyuan3D-2mini (Turbo Version) python3 gradio_app.py --model_path tencent/Hunyuan3D-2mini --subfolder hunyuan3d-dit-v2-mini-turbo --texgen_model_path tencent/Hunyuan3D-2 --low_vram_mode --enable_flashvdm # Hunyuan3D-2mv (Turbo Version) python3 gradio_app.py --model_path tencent/Hunyuan3D-2mv --subfolder hunyuan3d-dit-v2-mv-turbo --texgen_model_path tencent/Hunyuan3D-2 --low_vram_mode --enable_flashvdm # Hunyuan3D-2 (Turbo Version) python3 gradio_app.py --model_path tencent/Hunyuan3D-2 --subfolder hunyuan3d-dit-v2-0-turbo --texgen_model_path tencent/Hunyuan3D-2 --low_vram_mode --enable_flashvdm ``` -------------------------------- ### Run Turbo Gradio App with Hunyuan3D-2 Source: https://github.com/tencent/hunyuan3d-2/blob/main/docs/source/started/gradio.md Launches the turbo version of the Gradio application for different Hunyuan3D-2 model variants. Includes options for low VRAM mode and flash VDM. These commands are intended for bash execution. ```bash python3 gradio_app.py --model_path tencent/Hunyuan3D-2mini --subfolder hunyuan3d-dit-v2-mini-turbo --texgen_model_path tencent/Hunyuan3D-2 --low_vram_mode --enable_flashvdm ``` ```bash python3 gradio_app.py --model_path tencent/Hunyuan3D-2mv --subfolder hunyuan3d-dit-v2-mv-turbo --texgen_model_path tencent/Hunyuan3D-2 --low_vram_mode --enable_flashvdm ``` ```bash python3 gradio_app.py --model_path tencent/Hunyuan3D-2 --subfolder hunyuan3d-dit-v2-0-turbo --texgen_model_path tencent/Hunyuan3D-2 --low_vram_mode --enable_flashvdm ``` -------------------------------- ### Texture Enhancement Module Demo Source: https://github.com/tencent/hunyuan3d-2/blob/main/README.md This Python script provides a minimal demo for the texture enhancement module. Users can obtain high-definition textures by running this script. It's intended for quick testing and demonstration of the module's capabilities. ```python # Placeholder for the minimal demo script for the texture enhancement module. # This script would typically load a model and process textures to enhance them. print("Running minimal demo for texture enhancement module...") # Placeholder for actual code def enhance_texture(input_texture_path, output_texture_path): print(f"Enhancing texture from {input_texture_path} to {output_texture_path}") # Simulate enhancement process pass # Example call (replace with actual paths and model loading) # enhance_texture("input_low_res.png", "output_high_res.png") ``` -------------------------------- ### Hunyuan3D 2.0 Inference and Pretrained Models Source: https://github.com/tencent/hunyuan3d-2/blob/main/README.md This entry covers the release of inference code and pretrained models for Hunyuan3D 2.0. It includes links to Hugging Face for the models and a Hugging Face space for interactive use, as well as the official website for more details. ```python # Example Python code to load and use Hunyuan3D 2.0 pretrained models. # This is a conceptual example; actual usage would depend on the library structure. # Assuming a library `hunyuan3d_inference` is available: # from hunyuan3d_inference import Hunyuan3DModel print("Loading Hunyuan3D 2.0 pretrained models...") # model_id = "tencent/Hunyuan3D-2" # try: # model = Hunyuan3DModel.from_pretrained(model_id) # print(f"Successfully loaded model: {model_id}") # # Example of using the model for generation: # # generated_asset = model.generate(prompt="a red chair") # # print("Generated a 3D asset.") # except Exception as e: # print(f"Failed to load model: {e}") # print("Please refer to the Hugging Face repository for direct usage instructions.") print("Refer to https://huggingface.co/tencent/Hunyuan3D-2 for model details and usage.") print("Try it interactively at https://huggingface.co/spaces/tencent/Hunyuan3D-2") ``` -------------------------------- ### Apply Metallic and Roughness Factors to Model Materials (JavaScript) Source: https://github.com/tencent/hunyuan3d-2/blob/main/assets/modelviewer-textured-template.html This script listens for the 'load' event on 'model-viewer' elements. Once loaded, it iterates through the model's materials and sets their metallic and roughness factors using the pbrMetallicRoughness properties. This is useful for fine-tuning the visual appearance of 3D models. ```javascript document.addEventListener('DOMContentLoaded', () => { const modelViewers = document.querySelectorAll('model-viewer'); modelViewers.forEach(modelViewer => { modelViewer.addEventListener('load', (event) => { const [material] = modelViewer.model.materials; material.pbrMetallicRoughness.setMetallicFactor(0.1); material.pbrMetallicRoughness.setRoughnessFactor(0.5); }); }); }); ``` -------------------------------- ### Initialize Model-Viewer with Environment Map (JavaScript) Source: https://github.com/tencent/hunyuan3d-2/blob/main/assets/modelviewer-template.html This JavaScript code initializes 'model-viewer' elements on the page after the DOM is loaded. It sets a default environment map image and includes logic for handling Safari browser-specific material adjustments upon model load. The code iterates through all 'model-viewer' elements and applies the environment image attribute. ```javascript document.addEventListener('DOMContentLoaded', () => { const modelViewers = document.querySelectorAll('model-viewer'); const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); modelViewers.forEach(modelViewer => { modelViewer.setAttribute( "environment-image", "/static/env_maps/gradient.jpg" ); // The following commented-out code demonstrates Safari-specific adjustments: // if (!isSafari) { // modelViewer.setAttribute( // "environment-image", // "/static/env_maps/gradient.jpg" // ); // } else { // modelViewer.addEventListener('load', (event) => { // const [material] = modelViewer.model.materials; // let color = [43, 44, 46, 255]; // color = color.map(x => x / 255); // material.pbrMetallicRoughness.setMetallicFactor(0.1); // material.pbrMetallicRoughness.setRoughnessFactor(0.7); // material.pbrMetallicRoughness.setBaseColorFactor(color); // }); // } // This event listener is always active in the provided code, applying material changes. modelViewer.addEventListener('load', (event) => { const [material] = modelViewer.model.materials; let color = [43, 44, 46, 255]; color = color.map(x => x / 255); material.pbrMetallicRoughness.setMetallicFactor(0.1); material.pbrMetallicRoughness.setRoughnessFactor(0.7); material.pbrMetallicRoughness.setBaseColorFactor(color); }); }); }); ``` -------------------------------- ### CSS for 3D Model Viewer UI Elements Source: https://github.com/tencent/hunyuan3d-2/blob/main/assets/modelviewer-textured-template.html This CSS provides styling for various UI components used in a 3D model viewer application. It includes styles for basic body margins, centering content, and defining the appearance and behavior of buttons for panel controls, including hover and checked states. ```css body { margin: 0; font-family: Arial, sans-serif; } .centered-container { display: flex; justify-content: center; align-items: center; } .modelviewer-panel-button { height: 30px; margin: 4px 4px; padding: 0px 14px; background: white; border-radius: 10px; box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25); font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s ease; } .modelviewer-panel-button.checked { background: #6567C9; color: white; } .modelviewer-panel-button:hover { background-color: #e2e6ea; } .modelviewer-panel-button-container { display: flex; justify-content: space-around; } .centered-container { display: flex; flex-direction: column; align-items: center; } ``` -------------------------------- ### Basic CSS Styling for Body and Centered Container Source: https://github.com/tencent/hunyuan3d-2/blob/main/assets/modelviewer-template.html This CSS defines basic styling for the HTML body, setting margin to 0 and font-family to Arial, sans-serif. It also includes a class for a centered container, utilizing flexbox properties to horizontally and vertically align content within a bordered, rounded box. ```css body { margin: 0; font-family: Arial, sans-serif; } .centered-container { display: flex; justify-content: center; align-items: center; border-radius: 8px; border-color: #e5e7eb; border-style: solid; border-width: 1px; } ``` -------------------------------- ### Toggle Texture Visibility and Environment Map (JavaScript) Source: https://github.com/tencent/hunyuan3d-2/blob/main/assets/modelviewer-textured-template.html This JavaScript function allows toggling the visibility of textures on a 3D model and changing the environment map. It saves the current textures and exposure settings before hiding them and reverts to them when shown again. This is useful for debugging or presenting models in different visual contexts. ```javascript var window_state = {}; function hideTexture() { let appearanceButton = document.getElementById('appearance-button'); let geometryButton = document.getElementById('geometry-button'); appearanceButton.classList.remove('checked'); geometryButton.classList.add('checked'); let modelViewer = document.getElementById('modelviewer'); if (modelViewer.model.materials[0].pbrMetallicRoughness.baseColorTexture.texture === null) return; window_state.textures = []; for (let i = 0; i < modelViewer.model.materials.length; i++) { window_state.textures.push(modelViewer.model.materials[i].pbrMetallicRoughness.baseColorTexture.texture); } window_state.exposure = modelViewer.exposure; modelViewer.environmentImage = '/static/env_maps/gradient.jpg'; for (let i = 0; i < modelViewer.model.materials.length; i++) { modelViewer.model.materials[i].pbrMetallicRoughness.baseColorTexture.setTexture(null); } modelViewer.exposure = 4; } function showTexture() { let appearanceButton = document.getElementById('appearance-button'); let geometryButton = document.getElementById('geometry-button'); appearanceButton.classList.add('checked'); geometryButton.classList.remove('checked'); let modelViewer = document.getElementById('modelviewer'); if (modelViewer.model.materials[0].pbrMetallicRoughness.baseColorTexture.texture !== null) return; modelViewer.environmentImage = '/static/env_maps/white.jpg'; for (let i = 0; i < modelViewer.model.materials.length; i++) { modelViewer.model.materials[i].pbrMetallicRoughness.baseColorTexture.setTexture(window_state.textures[i]); } modelViewer.exposure = window_state.exposure; } ``` -------------------------------- ### BibTeX Citations for Hunyuan3D-2 Publications Source: https://github.com/tencent/hunyuan3d-2/blob/main/docs/source/citation.md BibTeX entries for citing publications related to the Hunyuan3D-2 project. These entries contain metadata such as title, author, year, and arXiv identifiers, formatted for use in LaTeX documents. ```bibtex @misc{lai2025flashvdm, title={Unleashing Vecset Diffusion Model for Fast Shape Generation}, author={Zeqiang Lai and Yunfei Zhao and Zibo Zhao and Haolin Liu and Fuyun Wang and Huiwen Shi and Xianghui Yang and Qinxiang Lin and Jinwei Huang and Yuhong Liu and Jie Jiang and Chunchao Guo and Xiangyu Yue}, year={2025}, eprint={2503.16302}, archivePrefix={arXiv}, primaryClass={cs.CV}, url={https://arxiv.org/abs/2503.16302} } @misc{hunyuan3d22025tencent, title={Hunyuan3D 2.0: Scaling Diffusion Models for High Resolution Textured 3D Assets Generation}, author={Tencent Hunyuan3D Team}, year={2025}, eprint={2501.12202}, archivePrefix={arXiv}, primaryClass={cs.CV} } @misc{yang2024hunyuan3d, title={Hunyuan3D 1.0: A Unified Framework for Text-to-3D and Image-to-3D Generation}, author={Tencent Hunyuan3D Team}, year={2024}, eprint={2411.02293}, archivePrefix={arXiv}, primaryClass={cs.CV} } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.