Full Code of PKU-YuanGroup/UltraShape-1.0 for AI

main 5e8dcef05df1 cached
70 files
25.7 MB
139.8k tokens
502 symbols
1 requests
Download .txt
Showing preview only (605K chars total). Download the full file or copy to clipboard to get everything.
Repository: PKU-YuanGroup/UltraShape-1.0
Branch: main
Commit: 5e8dcef05df1
Files: 70
Total size: 25.7 MB

Directory structure:
gitextract_8lwu3ua4/

├── .gitignore
├── LICENSE
├── Notice.txt
├── README.md
├── configs/
│   ├── infer_dit_refine.yaml
│   ├── train_dit_refine.yaml
│   └── train_vae_refine.yaml
├── docs/
│   ├── carousel.css
│   ├── carousel.js
│   ├── index copy.html
│   ├── index.html
│   ├── main.css
│   ├── pv.css
│   ├── style.css
│   ├── stylesheet.css
│   └── window.css
├── inputs/
│   └── coarse_mesh/
│       └── 1.glb
├── main.py
├── requirements.txt
├── scripts/
│   ├── gradio_app.py
│   ├── infer_dit_refine.py
│   ├── install_env.sh
│   ├── run.sh
│   ├── sampling.py
│   └── train_deepspeed.sh
├── train.sh
└── ultrashape/
    ├── __init__.py
    ├── data/
    │   ├── objaverse_dit.py
    │   ├── objaverse_vae.py
    │   └── utils.py
    ├── models/
    │   ├── __init__.py
    │   ├── autoencoders/
    │   │   ├── __init__.py
    │   │   ├── attention_blocks.py
    │   │   ├── attention_processors.py
    │   │   ├── model.py
    │   │   ├── surface_extractors.py
    │   │   ├── vae_trainer.py
    │   │   └── volume_decoders.py
    │   ├── conditioner_mask.py
    │   ├── denoisers/
    │   │   ├── __init__.py
    │   │   ├── dit_mask.py
    │   │   └── moe_layers.py
    │   └── diffusion/
    │       ├── flow_matching_dit_trainer.py
    │       └── transport/
    │           ├── __init__.py
    │           ├── integrators.py
    │           ├── path.py
    │           ├── transport.py
    │           └── utils.py
    ├── pipelines.py
    ├── postprocessors.py
    ├── preprocessors.py
    ├── rembg.py
    ├── schedulers.py
    ├── surface_loaders.py
    └── utils/
        ├── __init__.py
        ├── ema.py
        ├── misc.py
        ├── trainings/
        │   ├── __init__.py
        │   ├── callback.py
        │   ├── lr_scheduler.py
        │   ├── mesh.py
        │   ├── mesh_log_callback.py
        │   └── peft.py
        ├── typing.py
        ├── utils.py
        ├── visualizers/
        │   ├── __init__.py
        │   ├── color_util.py
        │   ├── html_util.py
        │   └── pythreejs_viewer.py
        └── voxelize.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
!hy3dgen/texgen/custom_rasterizer/lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
#   For a library or package, you might want to ignore these files since the code is
#   intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
#   However, in case of collaboration, if having platform-specific dependencies or dependencies
#   having no cross-platform support, pipenv may install dependencies that don't work, or not
#   install all needed dependencies.
#Pipfile.lock

# UV
#   Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
#   This is especially recommended for binary packages to ensure reproducibility, and is more
#   commonly ignored for libraries.
#uv.lock

# poetry
#   Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
#   This is especially recommended for binary packages to ensure reproducibility, and is more
#   commonly ignored for libraries.
#   https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
#   Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
#   pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
#   in version control.
#   https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/
.DS_Store
# Cython debug symbols
cython_debug/
gradio_cache/
# PyCharm
#  JetBrains specific template is maintained in a separate JetBrains.gitignore that can
#  be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
#  and can be added to the global gitignore or merged into this file.  For a more nuclear
#  option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/


================================================
FILE: LICENSE
================================================
TENCENT HUNYUAN 3D 2.1 COMMUNITY LICENSE AGREEMENT
Tencent Hunyuan 3D 2.1 Release Date: June 13, 2025
THIS LICENSE AGREEMENT DOES NOT APPLY IN THE EUROPEAN UNION, UNITED KINGDOM AND SOUTH KOREA AND IS EXPRESSLY LIMITED TO THE TERRITORY, AS DEFINED BELOW.
By clicking to agree or by using, reproducing, modifying, distributing, performing or displaying any portion or element of the Tencent Hunyuan 3D 2.1 Works, including via any Hosted Service, You will be deemed to have recognized and accepted the content of this Agreement, which is effective immediately.
1.	DEFINITIONS.
a.	“Acceptable Use Policy” shall mean the policy made available by Tencent as set forth in the Exhibit A.
b.	“Agreement” shall mean the terms and conditions for use, reproduction, distribution, modification, performance and displaying of Tencent Hunyuan 3D 2.1 Works or any portion or element thereof set forth herein.
c.	“Documentation” shall mean the specifications, manuals and documentation for Tencent Hunyuan 3D 2.1 made publicly available by Tencent.
d.	“Hosted Service” shall mean a hosted service offered via an application programming interface (API), web access, or any other electronic or remote means.
e.	“Licensee,” “You” or “Your” shall mean a natural person or legal entity exercising the rights granted by this Agreement and/or using the Tencent Hunyuan 3D 2.1 Works for any purpose and in any field of use.
f.	“Materials” shall mean, collectively, Tencent’s proprietary Tencent Hunyuan 3D 2.1 and Documentation (and any portion thereof) as made available by Tencent under this Agreement.
g.	“Model Derivatives” shall mean all: (i) modifications to Tencent Hunyuan 3D 2.1 or any Model Derivative of Tencent Hunyuan 3D 2.1; (ii) works based on Tencent Hunyuan 3D 2.1 or any Model Derivative of Tencent Hunyuan 3D 2.1; or (iii) any other machine learning model which is created by transfer of patterns of the weights, parameters, operations, or Output of Tencent Hunyuan 3D 2.1 or any Model Derivative of Tencent Hunyuan 3D 2.1, to that model in order to cause that model to perform similarly to Tencent Hunyuan 3D 2.1 or a Model Derivative of Tencent Hunyuan 3D 2.1, including distillation methods, methods that use intermediate data representations, or methods based on the generation of synthetic data Outputs by Tencent Hunyuan 3D 2.1 or a Model Derivative of Tencent Hunyuan 3D 2.1 for training that model. For clarity, Outputs by themselves are not deemed Model Derivatives.
h.	“Output” shall mean the information and/or content output of Tencent Hunyuan 3D 2.1 or a Model Derivative that results from operating or otherwise using Tencent Hunyuan 3D 2.1 or a Model Derivative, including via a Hosted Service.
i.	“Tencent,” “We” or “Us” shall mean THL Q Limited.
j.	“Tencent Hunyuan 3D 2.1” shall mean the 3D generation models and their software and algorithms, including trained model weights, parameters (including optimizer states), machine-learning model code, inference-enabling code, training-enabling code, fine-tuning enabling code and other elements of the foregoing made publicly available by Us at [ https://github.com/Tencent-Hunyuan/Hunyuan3D-2.1].
k.	“Tencent Hunyuan 3D 2.1 Works” shall mean: (i) the Materials; (ii) Model Derivatives; and (iii) all derivative works thereof.
l.	“Territory” shall mean the worldwide territory, excluding the territory of the European Union, United Kingdom and South Korea. 
m.	“Third Party” or “Third Parties” shall mean individuals or legal entities that are not under common control with Us or You.
n.	“including” shall mean including but not limited to.
2.	GRANT OF RIGHTS.
We grant You, for the Territory only, a non-exclusive, non-transferable and royalty-free limited license under Tencent’s intellectual property or other rights owned by Us embodied in or utilized by the Materials to use, reproduce, distribute, create derivative works of (including Model Derivatives), and make modifications to the Materials, only in accordance with the terms of this Agreement and the Acceptable Use Policy, and You must not violate (or encourage or permit anyone else to violate) any term of this Agreement or the Acceptable Use Policy.
3.	DISTRIBUTION.
You may, subject to Your compliance with this Agreement, distribute or make available to Third Parties the Tencent Hunyuan 3D 2.1 Works, exclusively in the Territory, provided that You meet all of the following conditions:
a.	You must provide all such Third Party recipients of the Tencent Hunyuan 3D 2.1 Works or products or services using them a copy of this Agreement;
b.	You must cause any modified files to carry prominent notices stating that You changed the files;
c.	You are encouraged to: (i) publish at least one technology introduction blogpost or one public statement expressing Your experience of using the Tencent Hunyuan 3D 2.1 Works; and (ii) mark the products or services developed by using the Tencent Hunyuan 3D 2.1 Works to indicate that the product/service is “Powered by Tencent Hunyuan”; and
d.	All distributions to Third Parties (other than through a Hosted Service) must be accompanied by a “Notice” text file that contains the following notice: “Tencent Hunyuan 3D 2.1 is licensed under the Tencent Hunyuan 3D 2.1 Community License Agreement, Copyright © 2025 Tencent. All Rights Reserved. The trademark rights of “Tencent Hunyuan” are owned by Tencent or its affiliate.”
You may add Your own copyright statement to Your modifications and, except as set forth in this Section and in Section 5, may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Model Derivatives as a whole, provided Your use, reproduction, modification, distribution, performance and display of the work otherwise complies with the terms and conditions of this Agreement (including as regards the Territory). If You receive Tencent Hunyuan 3D 2.1 Works from a Licensee as part of an integrated end user product, then this Section 3 of this Agreement will not apply to You.
4.	ADDITIONAL COMMERCIAL TERMS.
If, on the Tencent Hunyuan 3D 2.1 version release date, the monthly active users of all products or services made available by or for Licensee is greater than 1 million monthly active users in the preceding calendar month, You must request a license from Tencent, which Tencent may grant to You in its sole discretion, and You are not authorized to exercise any of the rights under this Agreement unless or until Tencent otherwise expressly grants You such rights. 
Subject to Tencent's written approval, you may request a license for the use of Tencent Hunyuan 3D 2.1 by submitting the following information to hunyuan3d@tencent.com:
a.	Your company’s name and associated business sector that plans to use Tencent Hunyuan 3D 2.1.
b.	Your intended use case and the purpose of using Tencent Hunyuan 3D 2.1.
c.	Your plans to modify Tencent Hunyuan 3D 2.1 or create Model Derivatives.
5.	RULES OF USE.
a.	Your use of the Tencent Hunyuan 3D 2.1 Works must comply with applicable laws and regulations (including trade compliance laws and regulations) and adhere to the Acceptable Use Policy for the Tencent Hunyuan 3D 2.1 Works, which is hereby incorporated by reference into this Agreement. You must include the use restrictions referenced in these Sections 5(a) and 5(b) as an enforceable provision in any agreement (e.g., license agreement, terms of use, etc.) governing the use and/or distribution of Tencent Hunyuan 3D 2.1 Works and You must provide notice to subsequent users to whom You distribute that Tencent Hunyuan 3D 2.1 Works are subject to the use restrictions in these Sections 5(a) and 5(b).
b.	You must not use the Tencent Hunyuan 3D 2.1 Works or any Output or results of the Tencent Hunyuan 3D 2.1 Works to improve any other AI model (other than Tencent Hunyuan 3D 2.1 or Model Derivatives thereof).
c.	You must not use, reproduce, modify, distribute, or display the Tencent Hunyuan 3D 2.1 Works, Output or results of the Tencent Hunyuan 3D 2.1 Works outside the Territory. Any such use outside the Territory is unlicensed and unauthorized under this Agreement.
6.	INTELLECTUAL PROPERTY.
a.	Subject to Tencent’s ownership of Tencent Hunyuan 3D 2.1 Works made by or for Tencent and intellectual property rights therein, conditioned upon Your compliance with the terms and conditions of this Agreement, as between You and Tencent, You will be the owner of any derivative works and modifications of the Materials and any Model Derivatives that are made by or for You.
b.	No trademark licenses are granted under this Agreement, and in connection with the Tencent Hunyuan 3D 2.1 Works, Licensee may not use any name or mark owned by or associated with Tencent or any of its affiliates, except as required for reasonable and customary use in describing and distributing the Tencent Hunyuan 3D 2.1 Works. Tencent hereby grants You a license to use “Tencent Hunyuan” (the “Mark”) in the Territory solely as required to comply with the provisions of Section 3(c), provided that You comply with any applicable laws related to trademark protection. All goodwill arising out of Your use of the Mark will inure to the benefit of Tencent.
c.	If You commence a lawsuit or other proceedings (including a cross-claim or counterclaim in a lawsuit) against Us or any person or entity alleging that the Materials or any Output, or any portion of any of the foregoing, infringe any intellectual property or other right owned or licensable by You, then all licenses granted to You under this Agreement shall terminate as of the date such lawsuit or other proceeding is filed. You will defend, indemnify and hold harmless Us from and against any claim by any Third Party arising out of or related to Your or the Third Party’s use or distribution of the Tencent Hunyuan 3D 2.1 Works.
d.	Tencent claims no rights in Outputs You generate. You and Your users are solely responsible for Outputs and their subsequent uses.
7.	DISCLAIMERS OF WARRANTY AND LIMITATIONS OF LIABILITY.
a.	We are not obligated to support, update, provide training for, or develop any further version of the Tencent Hunyuan 3D 2.1 Works or to grant any license thereto.
b.	UNLESS AND ONLY TO THE EXTENT REQUIRED BY APPLICABLE LAW, THE TENCENT HUNYUAN 3D 2.1 WORKS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED “AS IS” WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES OF ANY KIND INCLUDING ANY WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, COURSE OF DEALING, USAGE OF TRADE, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING, REPRODUCING, MODIFYING, PERFORMING, DISPLAYING OR DISTRIBUTING ANY OF THE TENCENT HUNYUAN 3D 2.1 WORKS OR OUTPUTS AND ASSUME ANY AND ALL RISKS ASSOCIATED WITH YOUR OR A THIRD PARTY’S USE OR DISTRIBUTION OF ANY OF THE TENCENT HUNYUAN 3D 2.1 WORKS OR OUTPUTS AND YOUR EXERCISE OF RIGHTS AND PERMISSIONS UNDER THIS AGREEMENT.
c.	TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL TENCENT OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, FOR ANY DAMAGES, INCLUDING ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, EXEMPLARY, CONSEQUENTIAL OR PUNITIVE DAMAGES, OR LOST PROFITS OF ANY KIND ARISING FROM THIS AGREEMENT OR RELATED TO ANY OF THE TENCENT HUNYUAN 3D 2.1 WORKS OR OUTPUTS, EVEN IF TENCENT OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.
8.	SURVIVAL AND TERMINATION.
a.	The term of this Agreement shall commence upon Your acceptance of this Agreement or access to the Materials and will continue in full force and effect until terminated in accordance with the terms and conditions herein.
b.	We may terminate this Agreement if You breach any of the terms or conditions of this Agreement. Upon termination of this Agreement, You must promptly delete and cease use of the Tencent Hunyuan 3D 2.1 Works. Sections 6(a), 6(c), 7 and 9 shall survive the termination of this Agreement.
9.	GOVERNING LAW AND JURISDICTION.
a.	This Agreement and any dispute arising out of or relating to it will be governed by the laws of the Hong Kong Special Administrative Region of the People’s Republic of China, without regard to conflict of law principles, and the UN Convention on Contracts for the International Sale of Goods does not apply to this Agreement.
b.	Exclusive jurisdiction and venue for any dispute arising out of or relating to this Agreement will be a court of competent jurisdiction in the Hong Kong Special Administrative Region of the People’s Republic of China, and Tencent and Licensee consent to the exclusive jurisdiction of such court with respect to any such dispute.
 
EXHIBIT A
ACCEPTABLE USE POLICY

Tencent reserves the right to update this Acceptable Use Policy from time to time.
Last modified: November 5, 2024

Tencent endeavors to promote safe and fair use of its tools and features, including Tencent Hunyuan 3D 2.1. You agree not to use Tencent Hunyuan 3D 2.1 or Model Derivatives:
1.	Outside the Territory;
2.	In any way that violates any applicable national, federal, state, local, international or any other law or regulation;
3.	To harm Yourself or others;
4.	To repurpose or distribute output from Tencent Hunyuan 3D 2.1 or any Model Derivatives to harm Yourself or others; 
5.	To override or circumvent the safety guardrails and safeguards We have put in place;
6.	For the purpose of exploiting, harming or attempting to exploit or harm minors in any way;
7.	To generate or disseminate verifiably false information and/or content with the purpose of harming others or influencing elections;
8.	To generate or facilitate false online engagement, including fake reviews and other means of fake online engagement;
9.	To intentionally defame, disparage or otherwise harass others;
10.	To generate and/or disseminate malware (including ransomware) or any other content to be used for the purpose of harming electronic systems;
11.	To generate or disseminate personal identifiable information with the purpose of harming others;
12.	To generate or disseminate information (including images, code, posts, articles), and place the information in any public context (including –through the use of bot generated tweets), without expressly and conspicuously identifying that the information and/or content is machine generated;
13.	To impersonate another individual without consent, authorization, or legal right;
14.	To make high-stakes automated decisions in domains that affect an individual’s safety, rights or wellbeing (e.g., law enforcement, migration, medicine/health, management of critical infrastructure, safety components of products, essential services, credit, employment, housing, education, social scoring, or insurance);
15.	In a manner that violates or disrespects the social ethics and moral standards of other countries or regions;
16.	To perform, facilitate, threaten, incite, plan, promote or encourage violent extremism or terrorism;
17.	For any use intended to discriminate against or harm individuals or groups based on protected characteristics or categories, online or offline social behavior or known or predicted personal or personality characteristics;
18.	To intentionally exploit any of the vulnerabilities of a specific group of persons based on their age, social, physical or mental characteristics, in order to materially distort the behavior of a person pertaining to that group in a manner that causes or is likely to cause that person or another person physical or psychological harm;
19.	For military purposes;
20.	To engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or other professional practices.


================================================
FILE: Notice.txt
================================================
Usage and Legal Notices:

Tencent is pleased to support the open source community by making Hunyuan 3D 2.1 available.

Copyright (C) 2025 Tencent.  All rights reserved. The below software and/or models in this distribution may have been modified by Tencent ("Tencent Modifications"). All Tencent Modifications are Copyright (C) Tencent.

Hunyuan 3D 2.1 is licensed under the TENCENT HUNYUAN 3D 2.1 COMMUNITY LICENSE AGREEMENT except for the third-party components listed below, which is licensed under different terms. Hunyuan 3D 2.1 does not impose any additional limitations beyond what is outlined in the respective licenses of these third-party components. Users must comply with all terms and conditions of original licenses of these third-party components and must ensure that the usage of the third party components adheres to all relevant laws and regulations. 

For avoidance of doubts, Hunyuan 3D 2.1 means inference-enabling code, parameters, and weights of this Model only, which are made publicly available by Tencent in accordance with TENCENT HUNYUAN 3D 2.1 COMMUNITY LICENSE AGREEMENT.


Other dependencies and licenses:


Open Source Model Licensed under the MIT and CreativeML Open RAIL++-M License:
--------------------------------------------------------------------
1. Stable Diffusion
Copyright (c) 2022 Stability AI


Terms of the MIT and CreativeML Open RAIL++-M License:
--------------------------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


CreativeML Open RAIL++-M License
dated November 24, 2022

Section I: PREAMBLE

Multimodal generative models are being widely adopted and used, and have the potential to transform the way artists, among other individuals, conceive and benefit from AI or ML technologies as a tool for content creation.

Notwithstanding the current and potential benefits that these artifacts can bring to society at large, there are also concerns about potential misuses of them, either due to their technical limitations or ethical considerations.

In short, this license strives for both the open and responsible downstream use of the accompanying model. When it comes to the open character, we took inspiration from open source permissive licenses regarding the grant of IP rights. Referring to the downstream responsible use, we added use-based restrictions not permitting the use of the Model in very specific scenarios, in order for the licensor to be able to enforce the license in case potential misuses of the Model may occur. At the same time, we strive to promote open and responsible research on generative models for art and content generation.

Even though downstream derivative versions of the model could be released under different licensing terms, the latter will always have to include - at minimum - the same use-based restrictions as the ones in the original license (this license). We believe in the intersection between open and responsible AI development; thus, this License aims to strike a balance between both in order to enable responsible open-science in the field of AI.

This License governs the use of the model (and its derivatives) and is informed by the model card associated with the model.

NOW THEREFORE, You and Licensor agree as follows:

1. Definitions

- "License" means the terms and conditions for use, reproduction, and Distribution as defined in this document.
- "Data" means a collection of information and/or content extracted from the dataset used with the Model, including to train, pretrain, or otherwise evaluate the Model. The Data is not licensed under this License.
- "Output" means the results of operating a Model as embodied in informational content resulting therefrom.
- "Model" means any accompanying machine-learning based assemblies (including checkpoints), consisting of learnt weights, parameters (including optimizer states), corresponding to the model architecture as embodied in the Complementary Material, that have been trained or tuned, in whole or in part on the Data, using the Complementary Material.
- "Derivatives of the Model" means all modifications to the Model, works based on the Model, or any other model which is created or initialized by transfer of patterns of the weights, parameters, activations or output of the Model, to the other model, in order to cause the other model to perform similarly to the Model, including - but not limited to - distillation methods entailing the use of intermediate data representations or methods based on the generation of synthetic data by the Model for training the other model.
- "Complementary Material" means the accompanying source code and scripts used to define, run, load, benchmark or evaluate the Model, and used to prepare data for training or evaluation, if any. This includes any accompanying documentation, tutorials, examples, etc, if any.
- "Distribution" means any transmission, reproduction, publication or other sharing of the Model or Derivatives of the Model to a third party, including providing the Model as a hosted service made available by electronic or other remote means - e.g. API-based or web access.
- "Licensor" means the copyright owner or entity authorized by the copyright owner that is granting the License, including the persons or entities that may have rights in the Model and/or distributing the Model.
- "You" (or "Your") means an individual or Legal Entity exercising permissions granted by this License and/or making use of the Model for whichever purpose and in any field of use, including usage of the Model in an end-use application - e.g. chatbot, translator, image generator.
- "Third Parties" means individuals or legal entities that are not under common control with Licensor or You.
- "Contribution" means any work of authorship, including the original version of the Model and any modifications or additions to that Model or Derivatives of the Model thereof, that is intentionally submitted to Licensor for inclusion in the Model by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Model, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
- "Contributor" means Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Model.

Section II: INTELLECTUAL PROPERTY RIGHTS

Both copyright and patent grants apply to the Model, Derivatives of the Model and Complementary Material. The Model and Derivatives of the Model are subject to additional terms as described in Section III.

2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare, publicly display, publicly perform, sublicense, and distribute the Complementary Material, the Model, and Derivatives of the Model.
3. Grant of Patent License. Subject to the terms and conditions of this License and where and as applicable, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this paragraph) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Model and the Complementary Material, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Model to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Model and/or Complementary Material or a Contribution incorporated within the Model and/or Complementary Material constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for the Model and/or Work shall terminate as of the date such litigation is asserted or filed.

Section III: CONDITIONS OF USAGE, DISTRIBUTION AND REDISTRIBUTION

4. Distribution and Redistribution. You may host for Third Party remote access purposes (e.g. software-as-a-service), reproduce and distribute copies of the Model or Derivatives of the Model thereof in any medium, with or without modifications, provided that You meet the following conditions:
Use-based restrictions as referenced in paragraph 5 MUST be included as an enforceable provision by You in any type of legal agreement (e.g. a license) governing the use and/or distribution of the Model or Derivatives of the Model, and You shall give notice to subsequent users You Distribute to, that the Model or Derivatives of the Model are subject to paragraph 5. This provision does not apply to the use of Complementary Material.
You must give any Third Party recipients of the Model or Derivatives of the Model a copy of this License;
You must cause any modified files to carry prominent notices stating that You changed the files;
You must retain all copyright, patent, trademark, and attribution notices excluding those notices that do not pertain to any part of the Model, Derivatives of the Model.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions - respecting paragraph 4.a. - for use, reproduction, or Distribution of Your modifications, or for any such Derivatives of the Model as a whole, provided Your use, reproduction, and Distribution of the Model otherwise complies with the conditions stated in this License.
5. Use-based restrictions. The restrictions set forth in Attachment A are considered Use-based restrictions. Therefore You cannot use the Model and the Derivatives of the Model for the specified restricted uses. You may use the Model subject to this License, including only for lawful purposes and in accordance with the License. Use may include creating any content with, finetuning, updating, running, training, evaluating and/or reparametrizing the Model. You shall require all of Your users who use the Model or a Derivative of the Model to comply with the terms of this paragraph (paragraph 5).
6. The Output You Generate. Except as set forth herein, Licensor claims no rights in the Output You generate using the Model. You are accountable for the Output you generate and its subsequent uses. No use of the output can contravene any provision as stated in the License.

Section IV: OTHER PROVISIONS

7. Updates and Runtime Restrictions. To the maximum extent permitted by law, Licensor reserves the right to restrict (remotely or otherwise) usage of the Model in violation of this License.
8. Trademarks and related. Nothing in this License permits You to make use of Licensors’ trademarks, trade names, logos or to otherwise suggest endorsement or misrepresent the relationship between the parties; and any rights not expressly granted herein are reserved by the Licensors.
9. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Model and the Complementary Material (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Model, Derivatives of the Model, and the Complementary Material and assume any risks associated with Your exercise of permissions under this License.
10. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Model and the Complementary Material (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
11. Accepting Warranty or Additional Liability. While redistributing the Model, Derivatives of the Model and the Complementary Material thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
12. If any provision of this License is held to be invalid, illegal or unenforceable, the remaining provisions shall be unaffected thereby and remain valid as if such provision had not been set forth herein.

END OF TERMS AND CONDITIONS




Attachment A

Use Restrictions

You agree not to use the Model or Derivatives of the Model:

- In any way that violates any applicable national, federal, state, local or international law or regulation;
- For the purpose of exploiting, harming or attempting to exploit or harm minors in any way;
- To generate or disseminate verifiably false information and/or content with the purpose of harming others;
- To generate or disseminate personal identifiable information that can be used to harm an individual;
- To defame, disparage or otherwise harass others;
- For fully automated decision making that adversely impacts an individual’s legal rights or otherwise creates or modifies a binding, enforceable obligation;
- For any use intended to or which has the effect of discriminating against or harming individuals or groups based on online or offline social behavior or known or predicted personal or personality characteristics;
- To exploit any of the vulnerabilities of a specific group of persons based on their age, social, physical or mental characteristics, in order to materially distort the behavior of a person pertaining to that group in a manner that causes or is likely to cause that person or another person physical or psychological harm;
- For any use intended to or which has the effect of discriminating against individuals or groups based on legally protected characteristics or categories;
- To provide medical advice and medical results interpretation;
- To generate or disseminate information for the purpose to be used for administration of justice, law enforcement, immigration or asylum processes, such as predicting an individual will commit fraud/crime commitment (e.g. by text profiling, drawing causal relationships between assertions made in documents, indiscriminate and arbitrarily-targeted use).


================================================
FILE: README.md
================================================
<div align="center">

<h1>UltraShape 1.0: High-Fidelity 3D Shape Generation via Scalable Geometric Refinement</h1>

<a href="https://arxiv.org/pdf/2512.21185"><img src="https://img.shields.io/badge/arXiv-2512.21185-b31b1b.svg?style=flat-square" alt="arXiv"></a>
<a href="https://pku-yuangroup.github.io/UltraShape-1.0/"><img src="https://img.shields.io/badge/Project-Page-blue?style=flat-square" alt="Project Page"></a>
<a href="https://huggingface.co/infinith/UltraShape"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Models-yellow?style=flat-square" alt="HuggingFace Models"></a>

</div>

<br/>

<div align="center">
  <img src="docs/assets/images/teaser.png" width="100%" alt="UltraShape 1.0 Teaser" />
</div>

<br/>

## 📖 Abstract

In this report, we introduce **UltraShape 1.0**, a scalable 3D diffusion framework for high-fidelity 3D geometry generation. The proposed approach adopts a **two-stage generation pipeline**: a coarse global structure is first synthesized and then refined to produce detailed, high-quality geometry.

To support reliable 3D generation, we develop a comprehensive data processing pipeline that includes a novel **watertight processing method** and **high-quality data filtering**. This pipeline improves the geometric quality of publicly available 3D datasets by removing low-quality samples, filling holes, and thickening thin structures, while preserving fine-grained geometric details. 

To enable fine-grained geometry refinement, we decouple spatial localization from geometric detail synthesis in the diffusion process. We achieve this by performing **voxel-based refinement** at fixed spatial locations, where voxel queries derived from coarse geometry provide explicit positional anchors encoded via **RoPE**, allowing the diffusion model to focus on synthesizing local geometric details within a reduced, structured solution space.

Extensive evaluations demonstrate that UltraShape 1.0 performs competitively with existing open-source methods in both data processing quality and geometry generation.

## 🔥 News

* **[2025-12-25]** 📄 We released the technical report of **UltraShape 1.0** on arXiv.
* **[2025-12-26]** 🚀 We released the inference code and pre-trained models.
* **[2025-12-31]** 🚀 We released the training code.

## 🗓️ To-Do List
- [x] Release inference code
- [x] Release pre-trained weights (Hugging Face)
- [x] Release training code
- [ ] Release data processing scripts

## 🛠️ Installation & Usage

### 1. Environment Setup
```bash
git clone https://github.com/PKU-YuanGroup/UltraShape-1.0.git
cd UltraShape-1.0
# 1. Create and activate the environment
conda create -n ultrashape python=3.10
conda activate ultrashape

# 2. Install PyTorch (CUDA 12.1 recommended)
pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu121

# 3. Install dependencies
pip install -r requirements.txt

# 4. Install cubvh (Required for MC acceleration)
pip install git+https://github.com/ashawkey/cubvh --no-build-isolation

# For Training & Sampling (Optional)
pip install --no-build-isolation "git+https://github.com/facebookresearch/pytorch3d.git@stable"
pip install https://data.pyg.org/whl/torch-2.5.0%2Bcu121/torch_cluster-1.6.3%2Bpt25cu121-cp310-cp310-linux_x86_64.whl
```
⬇️ Model Weights

Please download the pre-trained weights from Hugging Face [ [infinith/UltraShape](https://huggingface.co/infinith/UltraShape/tree/main) ] and place them in your checkpoint directory (e.g., ./checkpoints/).


### 2. Generate Coarse Mesh

First, use Hunyuan3D-2.1 to generate a coarse mesh from your input image.

Repository: [Tencent-Hunyuan/Hunyuan3D-2.1](https://github.com/Tencent-Hunyuan/Hunyuan3D-2.1)

Follow the instructions in the Hunyuan3D-2.1 repository to obtain the initial mesh file (e.g., .glb or .obj).

### 3. Generate Refined Mesh

Once you have the coarse mesh, use the provided script to run the refinement stage.

Run the inference script:
```bash
sh scripts/run.sh
```

**image**: Path to the reference image.

**mesh**: Path to the coarse mesh.

**output_dir**: Directory to save the refined result.

**ckpt**: Path to the downloaded UltraShape checkpoint.

**step**: the number of DiT inference sampling steps. The default is 50, and it can be reduced to 12 to speed up generation.

*Alternatively, you can run the gradio app for interactive inference:*
```bash
python scripts/gradio_app.py --ckpt <path_to_checkpoint>
```

#### Low VRAM
1. Use a low value for num_latents (Try 8192)
2. Use a low chunk_size (Try 2048)
3. Try the --low_vram arg in gradio_app.py and infer_dit_refine.py

### 4. Data Preparation & Training

First, prepare the data, including watertight meshes and rendered images.
Then, run the sampling script as follows:
```
python scripts/sampling.py \
    --mesh_json data/mesh_paths.json \
    --output_dir data/sample
```

Here, mesh_json is a list containing the file paths of the watertight meshes.


The multi-node training script is:
```
sh train.sh [node_idx]
```

**training_data_list**: the folder containing train.json and val.json, which store the ID lists for datasets.

**sample_pcd_dir**: the directory containing the sampled .npz files.

**image_data_json**: the file paths of the rendered images.

You can switch between VAE and DiT training in train.sh, and specify the output directory and configuration file there as well.

## 🔗 BibTeX

If you found this repository helpful, please cite our reports:

```bibtex
@article{jia2025ultrashape,
    title={UltraShape 1.0: High-Fidelity 3D Shape Generation via Scalable Geometric Refinement},
    author={Jia, Tanghui and Yan, Dongyu and Hao, Dehao and Li, Yang and Zhang, Kaiyi and He, Xianyi and Li, Lanjiong and Chen, Jinnan and Jiang, Lutao and Yin, Qishen and Quan, Long and Chen, Ying-Cong and Yuan, Li},
    journal={arxiv preprint arXiv:2512.21185},
    year={2025}
}
```

## Acknowledgements

Our code is built upon the excellent work of [Hunyuan3D-2.1](https://github.com/Tencent-Hunyuan/Hunyuan3D-2.1). The core idea of our method is greatly inspired by [LATTICE](https://arxiv.org/abs/2512.03052). We deeply appreciate the contributions of these works to the 3D generation community. Please also consider citing **Hunyuan3D 2.1** and **LATTICE**:

- **[Hunyuan3D-2.1](https://github.com/Tencent-Hunyuan/Hunyuan3D-2.1)**
- **[Lattice3D](https://lattice3d.github.io/)**


================================================
FILE: configs/infer_dit_refine.yaml
================================================
model:
  target: ultrashape.pipelines.UltraShapePipeline
  params:
    # 1. VAE Config
    vae_config:
      target: ultrashape.models.autoencoders.ShapeVAE
      params:
        num_latents: &token_num 32768 # infer token_num
        embed_dim: 64
        num_freqs: 8
        include_pi: false
        heads: 16
        width: 1024
        point_feats: 4
        num_encoder_layers: 8
        num_decoder_layers: 16
        pc_size: 409600 # num_s (204800) + num_u (204800)
        pc_sharpedge_size: 0
        downsample_ratio: 20
        qkv_bias: false
        qk_norm: true
        scale_factor: 1.0039506158752403
        geo_decoder_mlp_expand_ratio: 4
        # geo_decoder_downsample_ratio: 1
        geo_decoder_ln_post: true
        enable_flashvdm: true
        jitter_query: false
        voxel_query: true
        voxel_query_res: &voxel_query_res 128
      
    # 2. DiT Denoiser Config
    dit_cfg:
      target: ultrashape.models.denoisers.dit_mask.RefineDiT
      params:
        input_size: *token_num
        in_channels: 64
        hidden_size: 2048
        context_dim: 1024
        depth: 21
        num_heads: 16
        qk_norm: true
        text_len: 1370
        qk_norm_type: 'rms'
        qkv_bias: false
        num_moe_layers: 6
        num_experts: 8
        moe_top_k: 2
        voxel_query_res: *voxel_query_res

    # 3. Image Encoder Config
    conditioner_config:
      target: ultrashape.models.conditioner_mask.SingleImageEncoder
      params:
        drop_ratio: 0.0
        main_image_encoder:
            type: DinoImageEncoder 
            kwargs:
                version: 'facebook/dinov2-large' 
                image_size: 1022
                use_cls_token: true
        
    # 4. Scheduler Config
    scheduler_cfg:
      target: ultrashape.schedulers.FlowMatchEulerDiscreteScheduler
      params:
        num_train_timesteps: 1000

    # 5. Image Processor
    image_processor_cfg:
      target: ultrashape.preprocessors.ImageProcessorV2
      params: 
        size: 1024


================================================
FILE: configs/train_dit_refine.yaml
================================================
name: "UltraShape Refine DiT"

training:
  # ckpt_path:
  steps: 10_0000_0000
  use_amp: true
  amp_type: "bf16"
  base_lr: 1e-5
  gradient_clip_val: 1.0
  gradient_clip_algorithm: "norm"
  every_n_train_steps: 2500
  val_check_interval: 1000
  limit_val_batches: 16
  accumulate_grad_batches: 4

dataset:
  target: ultrashape.data.objaverse_dit.ObjaverseDataModule
  params:
    batch_size: 1
    num_workers: 4
    val_num_workers: 4

    # data
    training_data_list: data/data_list
    sample_pcd_dir: data/sample
    image_data_json: data/render.json

    # image
    image_size: &image_size 1022  # 518
    mean: &mean [0.5, 0.5, 0.5]
    std: &std [0.5, 0.5, 0.5]
    padding: true

    # input_pcd
    pc_size: &pc_size 163840
    pc_sharpedge_size: &pc_sharpedge_size 0
    sharpedge_label: &sharpedge_label true
    return_normal: true

model:
  target: ultrashape.models.diffusion.flow_matching_dit_trainer.Diffuser
  params:
    ckpt_path: ckpt/dit_step=XXX.ckpt
    scale_by_std: false
    z_scale_factor: &z_scale_factor 1.0039506158752403
    torch_compile: false

    vae_config:
      target: ultrashape.models.autoencoders.ShapeVAE
      from_pretrained: ckpt/vae_step=XXX.ckpt
      params:
        num_latents: &num_latents 8192  # 4096
        embed_dim: 64
        num_freqs: 8
        include_pi: false
        heads: 16
        width: 1024
        point_feats: 4
        num_encoder_layers: 8
        num_decoder_layers: 16
        pc_size: *pc_size
        pc_sharpedge_size: *pc_sharpedge_size
        downsample_ratio: 20
        qkv_bias: false
        qk_norm: true
        scale_factor: *z_scale_factor
        geo_decoder_mlp_expand_ratio: 4
        geo_decoder_downsample_ratio: 1
        geo_decoder_ln_post: true
        enable_flashvdm: true
        jitter_query: false
        voxel_query: true
        voxel_query_res: 128

    cond_config:
      target: ultrashape.models.conditioner_mask.SingleImageEncoder
      params:
        drop_ratio: 0.1
        # disable_drop: false
        main_image_encoder:
            type: DinoImageEncoder 
            kwargs:
                version: 'facebook/dinov2-large'
                image_size: *image_size
                use_cls_token: true

    dit_cfg:
      target: ultrashape.models.denoisers.dit_mask.RefineDiT
      params:
        input_size: *num_latents
        in_channels: 64
        hidden_size: 2048
        context_dim: 1024
        depth: 21
        num_heads: 16
        qk_norm: true
        text_len: 5330  # 1370
        qk_norm_type: 'rms'
        qkv_bias: false
        num_moe_layers: 6
        num_experts: 8
        moe_top_k: 2
        
    scheduler_cfg:
      transport:
        target: ultrashape.models.diffusion.transport.create_transport
        params:
          path_type: Linear
          prediction: velocity
      sampler:
        target: ultrashape.models.diffusion.transport.Sampler
        params: {}
        ode_params:
          sampling_method: euler
          num_steps: &num_steps 50

    optimizer_cfg:
      optimizer:
        target: torch.optim.AdamW
        params:
          betas: [0.9, 0.99]
          eps: 1.e-6
          weight_decay: 1.e-2

      scheduler:
        target: ultrashape.utils.trainings.lr_scheduler.LambdaWarmUpCosineFactorScheduler
        params:
          warm_up_steps: 500 # 5000
          f_start: 1.e-6
          f_min: 1.e-3
          f_max: 1.0

    pipeline_cfg:
      target: ultrashape.pipelines.UltraShapePipeline

    image_processor_cfg:
      target: ultrashape.preprocessors.ImageProcessorV2
      params: {}


================================================
FILE: configs/train_vae_refine.yaml
================================================
name: "UltraShape Refine VAE"

training:
  # ckpt_path: 
  steps: 10_0000_0000
  use_amp: true
  amp_type: "bf16"
  base_lr: 1e-5
  gradient_clip_val: 1.0
  gradient_clip_algorithm: "norm"
  every_n_train_steps: 2500
  val_check_interval: 1000
  limit_val_batches: 16

dataset:
  target: ultrashape.data.objaverse_vae.ObjaverseDataModule
  params:
    batch_size: 4
    num_workers: 4
    val_num_workers: 4

    # data 
    training_data_list: data/data_list
    sample_pcd_dir: data/sample

    # input_pcd
    pc_size: &pc_size 163840
    pc_sharpedge_size: &pc_sharpedge_size 0
    sharpedge_label: &sharpedge_label true
    return_normal: true

    # sup_pcd
    sup_near_uni_size: 100000
    sup_near_sharp_size: 100000
    sup_space_size: 100000
    tsdf_threshold: 0.01

model:
  target: ultrashape.models.autoencoders.VAETrainer
  params:
    ckpt_path: ckpt/vae_step=15000.ckpt
    torch_compile: false
    save_dir: outputs/vae_recon
    mc_res: 512
    vae_config:
      target: ultrashape.models.autoencoders.ShapeVAE
      params:
        num_latents: &num_latents 8192 # 4096
        embed_dim: 64
        num_freqs: 8
        include_pi: false
        heads: 16
        width: 1024
        point_feats: 4
        num_encoder_layers: 8
        num_decoder_layers: 16
        pc_size: *pc_size
        pc_sharpedge_size: *pc_sharpedge_size
        downsample_ratio: 20
        qkv_bias: false
        qk_norm: true
        geo_decoder_mlp_expand_ratio: 4
        geo_decoder_downsample_ratio: 1
        geo_decoder_ln_post: true
        enable_flashvdm: true
        jitter_query: true

    optimizer_cfg:
      optimizer:
        target: torch.optim.AdamW
        params:
          betas: [0.9, 0.99]
          eps: 1.e-6
          weight_decay: 1.e-2

      scheduler:
        target: ultrashape.utils.trainings.lr_scheduler.LambdaWarmUpCosineFactorScheduler
        params:
          warm_up_steps: 500 # 5000
          f_start: 1.e-6
          f_min: 1.e-3
          f_max: 1.0
        
    loss_cfg:
      lambda_logits: 1.
      lambda_kl: 0.001
      # lambda_eik: -1.
      # lambda_sn: -1.
      # lambda_sign: -1.


================================================
FILE: docs/carousel.css
================================================
.x-carousel-tags {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: left;
    flex-wrap: wrap;
}

.x-carousel-tag {
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 4px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #2a2a2a;
    margin: 4px;
    padding: 8px 16px;
    text-align: center;
}

.x-carousel-tag:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: rgba(0, 0, 0, 0.15) 0px 4px 6px;
}

.x-carousel-tag.active { border-color: #666; background-color: rgba(255, 255, 255, 1); }

.x-carousel-slider {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.x-carousel-slider-item {
    max-width: 100%;
    width: 100%;
    flex: 1 0 0;
}

.x-carousel-nav {
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.x-carousel-switch {
    width: 50px;
    height: 25px;
    margin: 8px;
    border-radius: 25px;
    cursor: pointer;
    user-select: none;
    color: rgba(42, 42, 42, 0.4);
    font-size: 24px;
    font-weight: 500;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.x-carousel-switch:hover {
    color: rgba(42, 42, 42, 0.8);
    transform: scale(1.05);
}

.x-carousel-pages {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.x-carousel-page {
    width: 10px;
    height: 10px;
    border-radius: 10px;
    background: rgba(42, 42, 42, 0.2);
    /* background: linear-gradient(107.54deg, #0078d4 .39%, #8661c5 51.23%, #ff9349 100%) fixed; */
    margin: 0 3px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.x-carousel-page:hover {
    background: rgba(42, 42, 42, 0.5);
}

.x-carousel-page.x-carousel-page-active {
    width: 12px;
    height: 13px;
}


================================================
FILE: docs/carousel.js
================================================
/**
 * Carousel functionality for research project page
 * Handles navigation, filtering, and page indicators for carousel components
 */

(function() {
    'use strict';

    /**
     * Initialize carousel functionality
     * @param {string} carouselId - ID of the carousel container
     */
    function initCarousel(carouselId) {
        const carousel = document.getElementById(carouselId);
        if (!carousel) return;

        const slider = carousel.querySelector('.x-carousel-slider');
        const allItems = carousel.querySelectorAll('.x-carousel-slider-item');
        const prevBtn = carousel.querySelector('.x-carousel-nav .x-carousel-switch:first-child');
        const nextBtn = carousel.querySelector('.x-carousel-nav .x-carousel-switch:last-child');
        const pages = carousel.querySelectorAll('.x-carousel-page');
        const tags = carousel.querySelectorAll('.x-carousel-tag');

        if (!slider || !allItems.length) return;

        let currentIndex = 0;
        let currentFilter = 'all'; // Current filter: 'all', 'class1', 'class2', 'class3'
        let filteredItems = Array.from(allItems); // Currently visible items

        /**
         * Filter items by tag
         * @param {string} filter - Filter value: 'all', 'class1', 'class2', 'class3'
         */
        function filterItems(filter) {
            currentFilter = filter;
            
            // Filter items based on data-tag attribute
            if (filter === 'all') {
                filteredItems = Array.from(allItems);
            } else {
                filteredItems = Array.from(allItems).filter(item => {
                    return item.getAttribute('data-tag') === filter;
                });
            }

            // Reset to first item after filtering
            currentIndex = 0;
            
            // Update visibility of all items
            allItems.forEach(item => {
                if (filteredItems.includes(item)) {
                    item.style.display = 'block';
                } else {
                    item.style.display = 'none';
                }
            });

            // Show first filtered item
            goToSlide(0);
            updatePages();
        }

        /**
         * Navigate to a specific slide (within filtered items)
         * @param {number} index - Index of the slide to show
         */
        function goToSlide(index) {
            const totalItems = filteredItems.length;
            currentIndex = Math.max(0, Math.min(index, totalItems - 1));

            // Hide all filtered items
            filteredItems.forEach(item => {
                item.style.display = 'none';
            });

            // Show current item - use block instead of flex to preserve card's flex layout
            if (filteredItems[currentIndex]) {
                filteredItems[currentIndex].style.display = 'block';
            }

            updatePages();
            updateButtons();
        }

        /**
         * Update page indicators to reflect current slide
         */
        function updatePages() {
            const totalItems = filteredItems.length;
            pages.forEach((page, index) => {
                if (index === currentIndex && index < totalItems) {
                    page.classList.add('x-carousel-page-active');
                } else {
                    page.classList.remove('x-carousel-page-active');
                }
            });
            
            // Hide unused page indicators
            pages.forEach((page, index) => {
                if (index >= totalItems) {
                    page.style.display = 'none';
                } else {
                    page.style.display = '';
                }
            });
        }

        /**
         * Update navigation buttons state (enable/disable at boundaries)
         */
        function updateButtons() {
            const totalItems = filteredItems.length;
            if (prevBtn) {
                prevBtn.style.opacity = currentIndex === 0 ? '0.3' : '1';
                prevBtn.style.cursor = currentIndex === 0 ? 'not-allowed' : 'pointer';
            }
            if (nextBtn) {
                nextBtn.style.opacity = currentIndex === totalItems - 1 ? '0.3' : '1';
                nextBtn.style.cursor = currentIndex === totalItems - 1 ? 'not-allowed' : 'pointer';
            }
        }

        /**
         * Tag filtering (only for results-gen carousel)
         */
        if (tags.length && carouselId === 'results-gen') {
            tags.forEach((tag) => {
                tag.addEventListener('click', function() {
                    const filter = tag.getAttribute('data-filter');
                    if (!filter) return;
                    
                    // Remove active class from all tags
                    tags.forEach(t => t.classList.remove('active'));
                    // Add active class to clicked tag
                    tag.classList.add('active');
                    // Filter items
                    filterItems(filter);
                });
            });
        }

        // Previous/Next buttons
        if (prevBtn) {
            prevBtn.addEventListener('click', function() {
                if (currentIndex > 0) {
                    goToSlide(currentIndex - 1);
                }
            });
        }

        if (nextBtn) {
            nextBtn.addEventListener('click', function() {
                const totalItems = filteredItems.length;
                if (currentIndex < totalItems - 1) {
                    goToSlide(currentIndex + 1);
                }
            });
        }

        // Page indicators - click to jump to specific slide
        pages.forEach((page, index) => {
            page.addEventListener('click', function() {
                goToSlide(index);
            });
        });

        // Initialize - filter to 'all' and show first item
        filterItems('all');
    }

    // Initialize all carousels when DOM is ready
    document.addEventListener('DOMContentLoaded', function() {
        initCarousel('results-gen');
        initCarousel('results-recon');
    });
})();


document.addEventListener('DOMContentLoaded', function() {
    
    // 1. 预先创建一个用于显示图片的容器(一开始隐藏)
    const promptImgContainer = document.createElement('div');
    promptImgContainer.id = 'glb-prompt-image-container';
    promptImgContainer.style.cssText = `
        position: fixed; 
        bottom: 20px; 
        right: 20px; 
        width: 200px; 
        height: 200px; 
        z-index: 10000; /* 保证在最上层 */
        display: none; /* 默认隐藏 */
        background-color: white;
        padding: 5px;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        cursor: pointer; /* 提示可点击关闭 */
    `;
    
    // 创建图片元素
    const promptImg = document.createElement('img');
    promptImg.style.cssText = `
        width: 100%; 
        height: 100%; 
        object-fit: contain; 
        display: block;
    `;
    promptImgContainer.appendChild(promptImg);

    // 添加关闭提示文字(可选)
    const closeTip = document.createElement('div');
    closeTip.innerText = "Click to close";
    closeTip.style.cssText = "position:absolute; top:-25px; right:0; color:white; font-size:12px; background:rgba(0,0,0,0.5); padding:2px 5px; border-radius:4px;";
    promptImgContainer.appendChild(closeTip);

    document.body.appendChild(promptImgContainer);

    // 点击图片容器时,自己隐藏
    promptImgContainer.addEventListener('click', function() {
        this.style.display = 'none';
    });


    // 2. 为所有的 View GLB 按钮添加点击事件
    const buttons = document.querySelectorAll('.x-button');
    
    buttons.forEach(btn => {
        btn.addEventListener('click', function(e) {
            // 获取 HTML 中定义的 data-prompt 属性 (assets/images/1.png)
            const imgUrl = this.getAttribute('data-prompt');
            
            if (imgUrl) {
                promptImg.src = imgUrl;
                promptImgContainer.style.display = 'block'; // 显示图片
            }
        });
    });

    // 3. (可选) 如果你的 GLB 查看器有“关闭”按钮(例如 class 为 .close-viewer),
    // 你需要在这里添加逻辑,让点击关闭查看器时,图片也跟着消失。
    // 假设关闭按钮的类名是 .close-btn (你需要确认实际类名)
    /*
    const closeGlbBtn = document.querySelector('.close-btn-class-name');
    if(closeGlbBtn) {
        closeGlbBtn.addEventListener('click', () => {
             promptImgContainer.style.display = 'none';
        });
    }
    */
});

================================================
FILE: docs/index copy.html
================================================
<html lang="en"><head><style type="text/css">
.anticon {
  display: inline-block;
  color: inherit;
  font-style: normal;
  line-height: 0;
  text-align: center;
  text-transform: none;
  vertical-align: -0.125em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.anticon > * {
  line-height: 1;
}

.anticon svg {
  display: inline-block;
}

.anticon::before {
  display: none;
}

.anticon .anticon-icon {
  display: block;
}

.anticon[tabindex] {
  cursor: pointer;
}

.anticon-spin::before,
.anticon-spin {
  display: inline-block;
  -webkit-animation: loadingCircle 1s infinite linear;
  animation: loadingCircle 1s infinite linear;
}

@-webkit-keyframes loadingCircle {
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@keyframes loadingCircle {
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}
</style>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>UltraShape 1.0: High-Fidelity 3D Shape Generation via Scalable Geometric Refinement</title>
        <!-- TODO: Replace with UltraShape 1.0 favicon -->
        <link rel="icon" href="assets/favicon.png">
        <link rel="stylesheet" href="stylesheet.css">
        <link rel="stylesheet" href="style.css">
        <link rel="stylesheet" href="window.css">
        <link rel="stylesheet" href="carousel.css">
        <link rel="stylesheet" href="main.css">
        <link rel="stylesheet" href="pv.css">
        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
        <script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.3.0/model-viewer.min.js"></script>
        <script src="carousel.js" defer></script>
    </head>
    <body>
        <div class="animated-gradient hero-expandable" style="width: 100%; height: 90vh; position: relative; overflow: hidden;">
    
            <img 
                src="assets\images\teaser.png" 
                alt="Hero background" 
                style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.9;"
            >
            <div style="position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; color: #ffffff; padding: 80px 20px; text-align: center;">

                <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;700&family=Inter:wght@300;400&display=swap" rel="stylesheet">

                <div style="font-family: 'Outfit', sans-serif;">
                    
                    <div style="
                        font-size: 100px; 
                        font-weight: 700; 
                        margin-bottom: 24px; 
                        background: linear-gradient(135deg, #ffffff 0%, #c3ecff 100%);
                        -webkit-background-clip: text;
                        -webkit-text-fill-color: transparent;
                        letter-spacing: -2px; 
                        text-shadow: 0px 10px 30px rgba(0,0,0,0.3); 
                    ">
                        UltraShape 1.0
                    </div>

                    <div style="
                        font-family: 'Inter', sans-serif;
                        font-size: 60px; 
                        font-weight: 600; 
                        color: rgba(255, 255, 255, 0.9);
                        margin-bottom: 48px; 
                        max-width: 1200px; 
                        line-height: 1.6;
                        letter-spacing: 1px; 
                    ">
                        High-Fidelity 3D Shape Generation via Scalable Geometric Refinement
                    </div>

                </div>

                <div style="font-size: 22px; font-weight: 400; margin-bottom: 48px; max-width: 1200px; line-height: 1.8; opacity: 0.95;">
                    We introduce UltraShape-1.0, a scalable two-stage diffusion framework for high-quality 3D geometry generation, enhanced by an advanced data processing pipeline that ensures geometric details through watertight processing and quality filtering.
                </div>
                <div id="links" style="display: flex; gap: 16px; flex-wrap: wrap; justify-content: center;">
                    <div><a id="paper" href="https://arxiv.org/pdf/2512.21185">Tech Report</a></div>
                    <div><a id="code" href="https://github.com/PKU-YuanGroup/UltraShape-1.0">Code</a></div>
                    <div><a id="demo" href="#demo">Demo</a></div>
                </div>
            </div>
        </div>

        <div id="main" style="background: #faf9f7;">
            <div class="x-section-title" style="text-align: center; margin-top: 80px;">Main Pipeline</div>
            
            <div style="background: #f8f9fa; padding: 80px 20px;">
                <div style="max-width: 1200px; margin: 40px auto; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,0.15); position: relative; padding: 20px; background-color: #ffffff;">
                    
                    <img src="assets/images/pipeline.png?v=2" alt="Video cover" style="width: 100%; height: auto; display: block;">
                    
                    
                </div>
            </div>    

            <div class="x-section-title"  style="text-align: center; margin-top: 50px;">Image to 3D Shape Generation</div>
            <div id="results-gen">
                <div class="x-carousel-tags">
                    <!-- <div class="x-carousel-tag active" data-filter="all">All</div> -->
                    <!-- <div class="x-carousel-tag" data-filter="class1">Object</div> -->
                    <!-- <div class="x-carousel-tag" data-filter="class2">Multi-Object</div> -->
                    <!-- <div class="x-carousel-tag" data-filter="class3">Character</div> -->
                    <!-- <div class="x-carousel-tag" data-filter="class4">Car</div> -->
                </div>
                <div class="x-carousel-slider">
                    <!-- Item 1 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <div class="x-button" 
                                style="position: absolute; top: 10px; right: 85px; padding: 15px 30px; 
                                        font-size: 22px; font-weight: bold; z-index: 10; cursor: pointer;" 
                                data-glb="https://huggingface.co/datasets/infinith/ultrashape_page/resolve/main/1.glb">
                                View GLB
                            </div>
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px; padding: 12px 24px; font-size: 24px;" data-glb="assets/meshs/1.glb" data-prompt="assets/images/1.png">View GLB</div> -->
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/1.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/1.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 2 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/2.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/2.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/2.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 3 -->
                    <div class="x-carousel-slider-item" data-tag="class3" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/3.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/3.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/3.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 4 -->
                    <div class="x-carousel-slider-item" data-tag="class3" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/4.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/4.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/4.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 5 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/5.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/5.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/5.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 6 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/6.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/6.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/6.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 7 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/7.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/7.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/7.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 8 -->
                    <div class="x-carousel-slider-item" data-tag="class3" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/8.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/8.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/8.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 9 -->
                    <div class="x-carousel-slider-item" data-tag="class3" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/9.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/9.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/9.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 10 -->
                    <div class="x-carousel-slider-item" data-tag="class3" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/10.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/10.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/10.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 11 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/11.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/11.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/11.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 12 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/12.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/12.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/12.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 13 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/13.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/13.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/13.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                </div>
                <div class="x-carousel-nav">
                    <div class="x-carousel-switch">&lt;</div>
                    <div class="x-carousel-pages">
                        <div class="x-carousel-page x-carousel-page-active"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                    </div>
                    <div class="x-carousel-switch">&gt;</div>
                </div>
            </div>

            <div class="x-section-title" style="text-align: center; margin-top: 150px;">Comparison of 3D Shape Generation</div>

            <div id="results-recon" style="max-width: 1200px; margin: 0 auto; padding: 0 20px;">
                <div class="x-carousel-slider">
                    
                    <!-- 第一张图 -->
                    <div class="x-carousel-slider-item" style="flex-basis: calc(100% / 1);">
                        <!-- 修改1:增加 display: flex; flex-direction: column; -->
                        <div class="x-card" style="height: 86vh; background-color: #faf9f7; border-radius: 4px; display: flex; flex-direction: column; padding: 0 0 40px 0;">
                            <div class="x-img-caption" style="padding: 10px; text-align: center; background: #faf9f7; font-size: 24px; color: #333; flex-shrink: 0;">
                                Comparison with Open-Source Models 1
                            </div>
                            <!-- 修改2:将图片高度改为 flex: 1 或 auto,去掉 height: 100% -->
                            <div style="flex: 1; min-height: 0; padding: 20px; background-color: #ffffff; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); margin: 0 20px 20px 20px; display: flex; align-items: center; justify-content: center;">
                                <img 
                                    src="assets/images/comp-open1.png" 
                                    alt="Comparison with Open-Source Models 1"
                                    style="max-width: 100%; max-height: 100%; width: auto; height: auto; display: block;"
                                >
                            </div>
                        </div>
                    </div>

                    <!-- 第二张图 -->
                    <div class="x-carousel-slider-item" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 86vh; background-color: #faf9f7; border-radius: 4px; display: flex; flex-direction: column; padding: 0 0 40px 0;">
                            <div class="x-img-caption" style="padding: 10px; text-align: center; background: #faf9f7; font-size: 24px; color: #333; flex-shrink: 0;">
                                Comparison with Open-Source Models 2
                            </div>
                            <div style="flex: 1; min-height: 0; padding: 20px; background-color: #ffffff; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); margin: 0 20px 20px 20px; display: flex; align-items: center; justify-content: center;">
                                <img 
                                    src="assets/images/comp-open2.png" 
                                    alt="Comparison with Open-Source Models 2"
                                    style="max-width: 100%; max-height: 100%; width: auto; height: auto; display: block;"
                                >
                            </div>
                            <!-- <div class="x-img-caption" style="padding: 10px; text-align: center; background: #faf9f7; font-size: 16px; color: #333;">
                                Comparison with Open-Source Models 2
                            </div> -->
                        </div>
                    </div>

                    <!-- 第三张图 -->
                    <div class="x-carousel-slider-item" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 86vh; background-color: #faf9f7; border-radius: 4px; display: flex; flex-direction: column; padding: 0 0 40px 0;">
                            <div class="x-img-caption" style="padding: 10px; text-align: center; background: #faf9f7; font-size: 24px; color: #333; flex-shrink: 0;">
                                Comparison with Commercial Models
                            </div>
                            <div style="flex: 1; min-height: 0; padding: 20px; background-color: #ffffff; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); margin: 0 20px 20px 20px; display: flex; align-items: center; justify-content: center;">
                                <img 
                                    src="assets/images/comp-close.png" 
                                    alt="Comparison with Close Models 1"
                                    style="max-width: 100%; max-height: 100%; width: auto; height: auto; display: block;"
                                >
                            </div>
                            <!-- <div class="x-img-caption" style="padding: 15px; text-align: center; background: #faf9f7; font-size: 16px; color: #333;">
                                Comparison with Close Models 1
                            </div> -->
                        </div>
                    </div>

                </div>
                
                <div class="x-carousel-nav">
                    <div class="x-carousel-switch">&lt;</div>
                    <div class="x-carousel-pages">
                        <div class="x-carousel-page x-carousel-page-active"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                    </div>
                    <div class="x-carousel-switch">&gt;</div>
                </div>
            </div>

            </div>
            <div class="x-small-header" style="text-align: center; margin-top: -100px;">Citation</div>
            <div class="bibtex-entry" style="max-width: 800px; width: 90%; margin: 20px auto; box-sizing: border-box; background-color: #f5f5f5; padding: 15px; border-radius: 5px; overflow-x: auto;">
                <div class="line">
                    <span class="value">@article{jia2025ultrashape,</span>
                </div>
                <div class="line">
                    <span class="key">    title={</span>
                    <span class="value">UltraShape 1.0: High-Fidelity 3D Shape Generation via Scalable Geometric Refinement},</span>
                </div>
                <div class="line">
                    <span class="key">    author={</span>
                    <span class="value">Jia, Tanghui and Yan, Dongyu and Hao, Dehao and Li, Yang and Zhang, Kaiyi and He, Xianyi and Li, Lanjiong and Chen, Jinnan and Jiang, Lutao and Yin, Qishen and Quan, Long and Chen, Ying-Cong and Yuan, Li},</span>
                </div>
                <div class="line">
                    <span class="key">    journal={</span>
                    <span class="value">arxiv preprint arXiv:2512.21185},</span>
                </div>
                <div class="line">
                    <span class="key">    year={</span>
                    <span class="value">2025}</span>
                </div>
                <div class="line">}</div>
            </div>
            <div style="height: 100px;"> </div>

        </div>

        <footer style="text-align: center; padding: 20px 0; color: #666; font-size: 14px;">
            <p>
                The website template was borrowed from <a href="https://microsoft.github.io/TRELLIS.2/" target="_blank">TRELLIS.2</a>.
            </p>
        </footer>

        <!-- Scroll Down Indicator -->
        <div id="scroll-indicator" class="scroll-indicator">
            <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                <path d="M7 13l5 5 5-5"></path>
            </svg>
        </div>

    <div id="fullscreen">
        <div id="window">
            <div id="close">✕</div>
            <div id="content"></div>
        </div>
    </div>
        <script>
            // Mouse-following gradient effect
            document.addEventListener('DOMContentLoaded', function() {
                const gradientEl = document.querySelector('.animated-gradient');
                if (!gradientEl) return;

                gradientEl.addEventListener('mousemove', function(e) {
                    const rect = gradientEl.getBoundingClientRect();
                    const x = ((e.clientX - rect.left) / rect.width) * 100;
                    const y = ((e.clientY - rect.top) / rect.height) * 100;
                    
                    gradientEl.style.setProperty('--mouse-x', x + '%');
                    gradientEl.style.setProperty('--mouse-y', y + '%');
                });

                // Reset to center when mouse leaves
                gradientEl.addEventListener('mouseleave', function() {
                    gradientEl.style.setProperty('--mouse-x', '50%');
                    gradientEl.style.setProperty('--mouse-y', '50%');
                });
            });

            // Scroll expand effect - hero section expands on scroll
            (function() {
                const hero = document.querySelector('.hero-expandable');
                if (!hero) return;

                const windowHeight = window.innerHeight;
                const expandThreshold = windowHeight * 0.5; // Start expanding after scrolling 50vh
                
                function updateHero() {
                    const scrollY = window.scrollY;
                    
                    if (scrollY === 0) {
                        // Initial state - hero is 90vh (positioned lower, showing content below)
                        hero.style.height = '90vh';
                    } else if (scrollY <= expandThreshold) {
                        // Expanding phase - hero grows from 90vh to 100vh
                        const progress = scrollY / expandThreshold;
                        const newHeight = 90 + (10 * progress);
                        hero.style.height = newHeight + 'vh';
                    } else {
                        // Fully expanded - hero is 100vh
                        hero.style.height = '100vh';
                    }
                }

                // Initial state
                hero.style.height = '90vh';
                
                // Throttle scroll for better performance
                let ticking = false;
                window.addEventListener('scroll', function() {
                    if (!ticking) {
                        window.requestAnimationFrame(function() {
                            updateHero();
                            ticking = false;
                        });
                        ticking = true;
                    }
                }, { passive: true });
                
                // Handle initial load
                updateHero();
            })();

            // View GLB functionality
            (function() {
                const fullscreen = document.getElementById('fullscreen');
                const windowEl = document.getElementById('window');
                const closeBtn = document.getElementById('close');
                const content = document.getElementById('content');

                if (!fullscreen || !windowEl || !closeBtn || !content) return;

                /**
                 * Open fullscreen window with GLB model
                 * @param {string} glbPath - Path to GLB file
                 * @param {string} prompt - Input prompt text
                 */
                function openGLBViewer(glbPath, prompt) {
                    // Create model-viewer element
                    content.innerHTML = `
                        <div style="display: flex; flex-wrap: wrap; align-items: start; justify-content: center;">
                            <div class="modelviewer-container" style="width: 500px; height: 500px;">
                                <model-viewer
                                    src="${glbPath}"
                                    alt="3D Model"
                                    camera-controls
                                    auto-rotate
                                    interaction-policy="allow-when-focused"
                                    reveal="auto"
                                    style="width: 100%; height: 100%; background-color: #f5f5f5; display: block;"
                                    loading="eager"
                                    shadow-intensity="1"
                                    exposure="1"
                                    tone-mapping="neutral"
                                >
                                </model-viewer>
                            </div>
                            <div class="modelviewer-panel">
                                <div class="modelviewer-panel-desc">
                                    <div>Input Prompt</div>
                                </div>
                                <div class="modelviewer-panel-prompt">
                                    ${prompt || '[PLACEHOLDER: Input prompt text]'}
                                </div>
                            </div>
                        </div>
                    `;

                    // Show fullscreen window
                    fullscreen.style.display = 'flex';
                    // Trigger opacity transition after a short delay to ensure model-viewer is ready
                    setTimeout(() => {
                        fullscreen.style.opacity = '1';
                        // Get the model-viewer element and add error handling
                        const modelViewer = content.querySelector('model-viewer');
                        if (modelViewer) {
                            // Add load success handler
                            modelViewer.addEventListener('load', () => {
                                console.log('Model loaded successfully:', glbPath);
                                // Force update after load
                                setTimeout(() => {
                                    modelViewer.style.width = '100%';
                                    modelViewer.style.height = '100%';
                                    modelViewer.style.display = 'block';
                                }, 100);
                            });
                            
                            // Add error handler
                            modelViewer.addEventListener('error', (e) => {
                                console.error('Model loading error:', e);
                                console.error('Failed path:', glbPath);
                                const container = content.querySelector('.modelviewer-container');
                                if (container) {
                                    container.innerHTML = `
                                        <div style="display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: #d32f2f; text-align: center; padding: 20px;">
                                            <div>
                                                <div style="font-size: 16px; margin-bottom: 8px; font-weight: 600;">Failed to load model</div>
                                                <div style="font-size: 12px; color: #666; margin-bottom: 8px;">Path: ${glbPath}</div>
                                                <div style="font-size: 11px; color: #999;">Please check the file path and ensure the file exists</div>
                                            </div>
                                        </div>
                                    `;
                                }
                            });
                        } else {
                            console.error('model-viewer element not found after creation');
                        }
                    }, 100);
                }

                /**
                 * Close fullscreen window
                 */
                function closeGLBViewer() {
                    fullscreen.style.opacity = '0';
                    setTimeout(() => {
                        fullscreen.style.display = 'none';
                        content.innerHTML = '';
                    }, 250); // Match transition duration
                }

                // Add click handlers to all View GLB buttons
                document.addEventListener('click', function(e) {
                    const button = e.target.closest('.x-button');
                    if (button && button.textContent.trim() === 'View GLB') {
                        const glbPath = button.getAttribute('data-glb');
                        const prompt = button.getAttribute('data-prompt');
                        if (glbPath) {
                            openGLBViewer(glbPath, prompt);
                        }
                    }
                });

                // Close button handler
                closeBtn.addEventListener('click', closeGLBViewer);

                // Close on backdrop click
                fullscreen.addEventListener('click', function(e) {
                    if (e.target === fullscreen) {
                        closeGLBViewer();
                    }
                });

                // Close on Escape key
                document.addEventListener('keydown', function(e) {
                    if (e.key === 'Escape' && fullscreen.style.display === 'flex') {
                        closeGLBViewer();
                    }
                });
            })();
        </script>
    </body></html>

================================================
FILE: docs/index.html
================================================
<html lang="en"><head><style type="text/css">
.anticon {
  display: inline-block;
  color: inherit;
  font-style: normal;
  line-height: 0;
  text-align: center;
  text-transform: none;
  vertical-align: -0.125em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.anticon > * {
  line-height: 1;
}

.anticon svg {
  display: inline-block;
}

.anticon::before {
  display: none;
}

.anticon .anticon-icon {
  display: block;
}

.anticon[tabindex] {
  cursor: pointer;
}

.anticon-spin::before,
.anticon-spin {
  display: inline-block;
  -webkit-animation: loadingCircle 1s infinite linear;
  animation: loadingCircle 1s infinite linear;
}

@-webkit-keyframes loadingCircle {
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@keyframes loadingCircle {
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}
</style>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>UltraShape 1.0: High-Fidelity 3D Shape Generation via Scalable Geometric Refinement</title>
        <!-- TODO: Replace with UltraShape 1.0 favicon -->
        <link rel="icon" href="assets/favicon.png">
        <link rel="stylesheet" href="stylesheet.css">
        <link rel="stylesheet" href="style.css">
        <link rel="stylesheet" href="window.css">
        <link rel="stylesheet" href="carousel.css">
        <link rel="stylesheet" href="main.css">
        <link rel="stylesheet" href="pv.css">
        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
        <script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.3.0/model-viewer.min.js"></script>
        <script src="carousel.js" defer></script>
    </head>
    <body>
        <div class="animated-gradient hero-expandable" style="width: 100%; height: 90vh; position: relative; overflow: hidden;">
    
            <img 
                src="assets\images\teaser.png" 
                alt="Hero background" 
                style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.9;"
            >
            <div style="position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; color: #ffffff; padding: 80px 20px; text-align: center;">

                <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;700&family=Inter:wght@300;400&display=swap" rel="stylesheet">

                <div style="font-family: 'Outfit', sans-serif;">
                    
                    <div style="
                        font-size: 100px; 
                        font-weight: 700; 
                        margin-bottom: 24px; 
                        background: linear-gradient(135deg, #ffffff 0%, #c3ecff 100%);
                        -webkit-background-clip: text;
                        -webkit-text-fill-color: transparent;
                        letter-spacing: -2px; 
                        text-shadow: 0px 10px 30px rgba(0,0,0,0.3); 
                    ">
                        UltraShape 1.0
                    </div>

                    <div style="
                        font-family: 'Inter', sans-serif;
                        font-size: 60px; 
                        font-weight: 600; 
                        color: rgba(255, 255, 255, 0.9);
                        margin-bottom: 48px; 
                        max-width: 1200px; 
                        line-height: 1.6;
                        letter-spacing: 1px; 
                    ">
                        High-Fidelity 3D Shape Generation via Scalable Geometric Refinement
                    </div>

                </div>

                <div style="font-size: 22px; font-weight: 400; margin-bottom: 48px; max-width: 1200px; line-height: 1.8; opacity: 0.95;">
                    We introduce UltraShape-1.0, a scalable two-stage diffusion framework for high-quality 3D geometry generation, enhanced by an advanced data processing pipeline that ensures geometric details through watertight processing and quality filtering.
                </div>
                <div id="links" style="display: flex; gap: 16px; flex-wrap: wrap; justify-content: center;">
                    <div><a id="paper" href="https://arxiv.org/pdf/2512.21185">Tech Report</a></div>
                    <div><a id="code" href="https://github.com/PKU-YuanGroup/UltraShape-1.0">Code</a></div>
                    <div><a id="demo" href="#demo">Demo</a></div>
                </div>
            </div>
        </div>

        <div id="main" style="background: #faf9f7;">
            <div class="x-section-title" style="text-align: center; margin-top: 80px;">Main Pipeline</div>
            
            <div style="background: #f8f9fa; padding: 80px 20px;">
                <div style="max-width: 1200px; margin: 40px auto; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,0.15); position: relative; padding: 20px; background-color: #ffffff;">
                    
                    <img src="assets/images/pipeline.png?v=2" alt="Video cover" style="width: 100%; height: auto; display: block;">
                    
                    
                </div>
            </div>    

            <div class="x-section-title"  style="text-align: center; margin-top: 50px;">Image to 3D Shape Generation</div>
            <div id="results-gen">
                <div class="x-carousel-tags">
                    <!-- <div class="x-carousel-tag active" data-filter="all">All</div> -->
                    <!-- <div class="x-carousel-tag" data-filter="class1">Object</div> -->
                    <!-- <div class="x-carousel-tag" data-filter="class2">Multi-Object</div> -->
                    <!-- <div class="x-carousel-tag" data-filter="class3">Character</div> -->
                    <!-- <div class="x-carousel-tag" data-filter="class4">Car</div> -->
                </div>
                <div class="x-carousel-slider">
                    <!-- Item 1 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <div class="x-button" 
                                style="position: absolute; top: 10px; right: 85px; padding: 15px 30px; 
                                        font-size: 22px; font-weight: bold; z-index: 10; cursor: pointer;" 
                                data-glb="https://huggingface.co/datasets/infinith/ultrashape_page/resolve/main/1.glb"
                                data-prompt="assets/images/1.png">
                                View GLB
                            </div>
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px; padding: 12px 24px; font-size: 24px;" data-glb="assets/meshs/1.glb" data-prompt="assets/images/1.png">View GLB</div> -->
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/1.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/1.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 2 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/2.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div class="x-button" 
                                style="position: absolute; top: 10px; right: 85px; padding: 15px 30px; 
                                        font-size: 22px; font-weight: bold; z-index: 10; cursor: pointer;" 
                                data-glb="https://huggingface.co/datasets/infinith/ultrashape_page/resolve/main/2.glb"
                                data-prompt="assets/images/2.png">
                                View GLB
                            </div>
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/2.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/2.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 3 -->
                    <div class="x-carousel-slider-item" data-tag="class3" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/3.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div class="x-button" 
                                style="position: absolute; top: 10px; right: 85px; padding: 15px 30px; 
                                        font-size: 22px; font-weight: bold; z-index: 10; cursor: pointer;" 
                                data-glb="https://huggingface.co/datasets/infinith/ultrashape_page/resolve/main/3.glb"
                                data-prompt="assets/images/3.png">
                                View GLB
                            </div>
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/3.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/3.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 4 -->
                    <div class="x-carousel-slider-item" data-tag="class3" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/4.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div class="x-button" 
                                style="position: absolute; top: 10px; right: 85px; padding: 15px 30px; 
                                        font-size: 22px; font-weight: bold; z-index: 10; cursor: pointer;" 
                                data-glb="https://huggingface.co/datasets/infinith/ultrashape_page/resolve/main/4.glb"
                                data-prompt="assets/images/4.png">
                                View GLB
                            </div>
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/4.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/4.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 5 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/5.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div class="x-button" 
                                style="position: absolute; top: 10px; right: 85px; padding: 15px 30px; 
                                        font-size: 22px; font-weight: bold; z-index: 10; cursor: pointer;" 
                                data-glb="https://huggingface.co/datasets/infinith/ultrashape_page/resolve/main/5.glb"
                                data-prompt="assets/images/5.png">
                                View GLB
                            </div>
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/5.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/5.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 6 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/6.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div class="x-button" 
                                style="position: absolute; top: 10px; right: 85px; padding: 15px 30px; 
                                        font-size: 22px; font-weight: bold; z-index: 10; cursor: pointer;" 
                                data-glb="https://huggingface.co/datasets/infinith/ultrashape_page/resolve/main/6.glb"
                                data-prompt="assets/images/6.png">
                                View GLB
                            </div>
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/6.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/6.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 7 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/7.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div class="x-button" 
                                style="position: absolute; top: 10px; right: 85px; padding: 15px 30px; 
                                        font-size: 22px; font-weight: bold; z-index: 10; cursor: pointer;" 
                                data-glb="https://huggingface.co/datasets/infinith/ultrashape_page/resolve/main/7.glb"
                                data-prompt="assets/images/7.png">
                                View GLB
                            </div>
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/7.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/7.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 8 -->
                    <div class="x-carousel-slider-item" data-tag="class3" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/8.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div class="x-button" 
                                style="position: absolute; top: 10px; right: 85px; padding: 15px 30px; 
                                        font-size: 22px; font-weight: bold; z-index: 10; cursor: pointer;" 
                                data-glb="https://huggingface.co/datasets/infinith/ultrashape_page/resolve/main/8.glb"
                                data-prompt="assets/images/8.png">
                                View GLB
                            </div>
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/8.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/8.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 9 -->
                    <div class="x-carousel-slider-item" data-tag="class3" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/9.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div class="x-button" 
                                style="position: absolute; top: 10px; right: 85px; padding: 15px 30px; 
                                        font-size: 22px; font-weight: bold; z-index: 10; cursor: pointer;" 
                                data-glb="https://huggingface.co/datasets/infinith/ultrashape_page/resolve/main/9.glb"
                                data-prompt="assets/images/9.png">
                                View GLB
                            </div>
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/9.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/9.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 10 -->
                    <div class="x-carousel-slider-item" data-tag="class3" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/10.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div class="x-button" 
                                style="position: absolute; top: 10px; right: 85px; padding: 15px 30px; 
                                        font-size: 22px; font-weight: bold; z-index: 10; cursor: pointer;" 
                                data-glb="https://huggingface.co/datasets/infinith/ultrashape_page/resolve/main/10.glb"
                                data-prompt="assets/images/10.png">
                                View GLB
                            </div>
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/10.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/10.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 11 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/11.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div class="x-button" 
                                style="position: absolute; top: 10px; right: 85px; padding: 15px 30px; 
                                        font-size: 22px; font-weight: bold; z-index: 10; cursor: pointer;" 
                                data-glb="https://huggingface.co/datasets/infinith/ultrashape_page/resolve/main/11.glb"
                                data-prompt="assets/images/11.png">
                                View GLB
                            </div>
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/11.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/11.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 12 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/12.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div class="x-button" 
                                style="position: absolute; top: 10px; right: 85px; padding: 15px 30px; 
                                        font-size: 22px; font-weight: bold; z-index: 10; cursor: pointer;" 
                                data-glb="https://huggingface.co/datasets/infinith/ultrashape_page/resolve/main/12.glb"
                                data-prompt="assets/images/12.png">
                                View GLB
                            </div>
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/12.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/12.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                    <!-- Item 13 -->
                    <div class="x-carousel-slider-item" data-tag="class1" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 70vh;">
                            <!-- <div class="x-button" style="position: absolute; top: 10px; right: 10px" data-glb="assets/meshs/13.glb" data-prompt="Input Prompt 1">View GLB</div> -->
                            <div class="x-button" 
                                style="position: absolute; top: 10px; right: 85px; padding: 15px 30px; 
                                        font-size: 22px; font-weight: bold; z-index: 10; cursor: pointer;" 
                                data-glb="https://huggingface.co/datasets/infinith/ultrashape_page/resolve/main/13.glb"
                                data-prompt="assets/images/13.png">
                                View GLB
                            </div>
                            <div style="width: 85%; aspect-ratio: 1; background-color: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden;">
                                <video 
                                    autoplay 
                                    loop 
                                    muted 
                                    playsinline 
                                    style="width: 100%; height: 100%; object-fit: contain;">
                                    <source src="assets/videos/13.mp4" type="video/mp4">
                                </video>
                            </div>
                            <div style="width: 200px; aspect-ratio: 1; background-color: transparent; border-radius: 4px; overflow: hidden;">
                                <img 
                                    src="assets/images/13.png" 
                                    alt="Input Image"
                                    style="width: 100%; height: 100%; object-fit: contain; display: block;"
                                >
                            </div>
                        </div>
                    </div>
                </div>
                <div class="x-carousel-nav">
                    <div class="x-carousel-switch">&lt;</div>
                    <div class="x-carousel-pages">
                        <div class="x-carousel-page x-carousel-page-active"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                    </div>
                    <div class="x-carousel-switch">&gt;</div>
                </div>
            </div>

            <div class="x-section-title" style="text-align: center; margin-top: 150px;">Comparison of 3D Shape Generation</div>

            <div id="results-recon" style="max-width: 1200px; margin: 0 auto; padding: 0 20px;">
                <div class="x-carousel-slider">
                    
                    <!-- 第一张图 -->
                    <div class="x-carousel-slider-item" style="flex-basis: calc(100% / 1);">
                        <!-- 修改1:增加 display: flex; flex-direction: column; -->
                        <div class="x-card" style="height: 86vh; background-color: #faf9f7; border-radius: 4px; display: flex; flex-direction: column; padding: 0 0 40px 0;">
                            <div class="x-img-caption" style="padding: 10px; text-align: center; background: #faf9f7; font-size: 24px; color: #333; flex-shrink: 0;">
                                Comparison with Open-Source Models 1
                            </div>
                            <!-- 修改2:将图片高度改为 flex: 1 或 auto,去掉 height: 100% -->
                            <div style="flex: 1; min-height: 0; padding: 20px; background-color: #ffffff; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); margin: 0 20px 20px 20px; display: flex; align-items: center; justify-content: center;">
                                <img 
                                    src="assets/images/comp-open1.png" 
                                    alt="Comparison with Open-Source Models 1"
                                    style="max-width: 100%; max-height: 100%; width: auto; height: auto; display: block;"
                                >
                            </div>
                        </div>
                    </div>

                    <!-- 第二张图 -->
                    <div class="x-carousel-slider-item" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 86vh; background-color: #faf9f7; border-radius: 4px; display: flex; flex-direction: column; padding: 0 0 40px 0;">
                            <div class="x-img-caption" style="padding: 10px; text-align: center; background: #faf9f7; font-size: 24px; color: #333; flex-shrink: 0;">
                                Comparison with Open-Source Models 2
                            </div>
                            <div style="flex: 1; min-height: 0; padding: 20px; background-color: #ffffff; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); margin: 0 20px 20px 20px; display: flex; align-items: center; justify-content: center;">
                                <img 
                                    src="assets/images/comp-open2.png" 
                                    alt="Comparison with Open-Source Models 2"
                                    style="max-width: 100%; max-height: 100%; width: auto; height: auto; display: block;"
                                >
                            </div>
                            <!-- <div class="x-img-caption" style="padding: 10px; text-align: center; background: #faf9f7; font-size: 16px; color: #333;">
                                Comparison with Open-Source Models 2
                            </div> -->
                        </div>
                    </div>

                    <!-- 第三张图 -->
                    <div class="x-carousel-slider-item" style="flex-basis: calc(100% / 1);">
                        <div class="x-card" style="height: 86vh; background-color: #faf9f7; border-radius: 4px; display: flex; flex-direction: column; padding: 0 0 40px 0;">
                            <div class="x-img-caption" style="padding: 10px; text-align: center; background: #faf9f7; font-size: 24px; color: #333; flex-shrink: 0;">
                                Comparison with Commercial Models
                            </div>
                            <div style="flex: 1; min-height: 0; padding: 20px; background-color: #ffffff; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); margin: 0 20px 20px 20px; display: flex; align-items: center; justify-content: center;">
                                <img 
                                    src="assets/images/comp-close.png" 
                                    alt="Comparison with Close Models 1"
                                    style="max-width: 100%; max-height: 100%; width: auto; height: auto; display: block;"
                                >
                            </div>
                            <!-- <div class="x-img-caption" style="padding: 15px; text-align: center; background: #faf9f7; font-size: 16px; color: #333;">
                                Comparison with Close Models 1
                            </div> -->
                        </div>
                    </div>

                </div>
                
                <div class="x-carousel-nav">
                    <div class="x-carousel-switch">&lt;</div>
                    <div class="x-carousel-pages">
                        <div class="x-carousel-page x-carousel-page-active"></div>
                        <div class="x-carousel-page"></div>
                        <div class="x-carousel-page"></div>
                    </div>
                    <div class="x-carousel-switch">&gt;</div>
                </div>
            </div>

            </div>
            <div class="x-small-header" style="text-align: center; margin-top: -100px;">Citation</div>
            <div class="bibtex-entry" style="max-width: 800px; width: 90%; margin: 20px auto; box-sizing: border-box; background-color: #f5f5f5; padding: 15px; border-radius: 5px; overflow-x: auto;">
                <div class="line">
                    <span class="value">@article{jia2025ultrashape,</span>
                </div>
                <div class="line">
                    <span class="key">    title={</span>
                    <span class="value">UltraShape 1.0: High-Fidelity 3D Shape Generation via Scalable Geometric Refinement},</span>
                </div>
                <div class="line">
                    <span class="key">    author={</span>
                    <span class="value">Jia, Tanghui and Yan, Dongyu and Hao, Dehao and Li, Yang and Zhang, Kaiyi and He, Xianyi and Li, Lanjiong and Chen, Jinnan and Jiang, Lutao and Yin, Qishen and Quan, Long and Chen, Ying-Cong and Yuan, Li},</span>
                </div>
                <div class="line">
                    <span class="key">    journal={</span>
                    <span class="value">arxiv preprint arXiv:2512.21185},</span>
                </div>
                <div class="line">
                    <span class="key">    year={</span>
                    <span class="value">2025}</span>
                </div>
                <div class="line">}</div>
            </div>
            <div style="height: 100px;"> </div>

        </div>

        <footer style="text-align: center; padding: 20px 0; color: #666; font-size: 14px;">
            <p>
                The website template was borrowed from <a href="https://microsoft.github.io/TRELLIS.2/" target="_blank">TRELLIS.2</a>.
            </p>
        </footer>

        <!-- Scroll Down Indicator -->
        <div id="scroll-indicator" class="scroll-indicator">
            <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                <path d="M7 13l5 5 5-5"></path>
            </svg>
        </div>

    <div id="fullscreen">
        <div id="window">
            <div id="close">✕</div>
            <div id="content"></div>
        </div>
    </div>
        <script>
            // Mouse-following gradient effect
            document.addEventListener('DOMContentLoaded', function() {
                const gradientEl = document.querySelector('.animated-gradient');
                if (!gradientEl) return;

                gradientEl.addEventListener('mousemove', function(e) {
                    const rect = gradientEl.getBoundingClientRect();
                    const x = ((e.clientX - rect.left) / rect.width) * 100;
                    const y = ((e.clientY - rect.top) / rect.height) * 100;
                    
                    gradientEl.style.setProperty('--mouse-x', x + '%');
                    gradientEl.style.setProperty('--mouse-y', y + '%');
                });

                // Reset to center when mouse leaves
                gradientEl.addEventListener('mouseleave', function() {
                    gradientEl.style.setProperty('--mouse-x', '50%');
                    gradientEl.style.setProperty('--mouse-y', '50%');
                });
            });

            // Scroll expand effect - hero section expands on scroll
            (function() {
                const hero = document.querySelector('.hero-expandable');
                if (!hero) return;

                const windowHeight = window.innerHeight;
                const expandThreshold = windowHeight * 0.5; // Start expanding after scrolling 50vh
                
                function updateHero() {
                    const scrollY = window.scrollY;
                    
                    if (scrollY === 0) {
                        // Initial state - hero is 90vh (positioned lower, showing content below)
                        hero.style.height = '90vh';
                    } else if (scrollY <= expandThreshold) {
                        // Expanding phase - hero grows from 90vh to 100vh
                        const progress = scrollY / expandThreshold;
                        const newHeight = 90 + (10 * progress);
                        hero.style.height = newHeight + 'vh';
                    } else {
                        // Fully expanded - hero is 100vh
                        hero.style.height = '100vh';
                    }
                }

                // Initial state
                hero.style.height = '90vh';
                
                // Throttle scroll for better performance
                let ticking = false;
                window.addEventListener('scroll', function() {
                    if (!ticking) {
                        window.requestAnimationFrame(function() {
                            updateHero();
                            ticking = false;
                        });
                        ticking = true;
                    }
                }, { passive: true });
                
                // Handle initial load
                updateHero();
            })();

            // View GLB functionality
            (function() {
                const fullscreen = document.getElementById('fullscreen');
                const windowEl = document.getElementById('window');
                const closeBtn = document.getElementById('close');
                const content = document.getElementById('content');

                if (!fullscreen || !windowEl || !closeBtn || !content) return;

                /**
                 * Open fullscreen window with GLB model
                 * @param {string} glbPath - Path to GLB file
                 * @param {string} image - Input prompt image
                 */
                function openGLBViewer(glbPath, imagePath) {
                    const overlay = document.createElement('div');
                    overlay.style.cssText = `
                        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
                        background: rgba(0, 0, 0, 0.85); z-index: 9999;
                        display: flex; align-items: center; justify-content: center;
                        backdrop-filter: blur(5px);
                    `;

                    const container = document.createElement('div');
                    container.style.cssText = `
                        width: 80%; height: 80%; background: #fff; border-radius: 12px;
                        display: flex; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
                        position: relative;
                    `;

                    const imgContainer = document.createElement('div');
                    imgContainer.style.cssText = `
                        flex: 1; background: #f0f0f0; display: flex; 
                        align-items: center; justify-content: center; border-right: 1px solid #ddd;
                        flex-direction: column;
                    `;
                    const imgTitle = document.createElement('div');
                    imgTitle.innerText = "Input Image";
                    imgTitle.style.cssText = "margin-bottom: 10px; font-weight: bold; color: #555;";
                    const img = document.createElement('img');
                    img.src = imagePath;
                    img.style.cssText = "max-width: 90%; max-height: 80%; object-fit: contain; border-radius: 4px;";
                    imgContainer.appendChild(imgTitle);
                    imgContainer.appendChild(img);

                    const modelContainer = document.createElement('div');
                    modelContainer.style.cssText = `
                        flex: 1; background: #e0e0e0; display: flex; 
                        align-items: center; justify-content: center; flex-direction: column; position: relative;
                    `;
                    const modelTitle = document.createElement('div');
                    modelTitle.innerText = "Generated Mesh";
                    modelTitle.style.cssText = "position: absolute; top: 20px; font-weight: bold; color: #555; z-index: 10;";

                    const viewer = document.createElement('model-viewer');
                    viewer.src = glbPath;
                    viewer.setAttribute('auto-rotate', '');
                    viewer.setAttribute('camera-controls', '');
                    viewer.setAttribute('shadow-intensity', '1');
                    viewer.style.cssText = "width: 100%; height: 100%;";

                    viewer.addEventListener('load', () => {
                        if (viewer.model && viewer.model.materials.length > 0) {
                            const material = viewer.model.materials[0];
                            
                            // [Red, Green, Blue, Alpha] (0.0 - 1.0)
                            material.pbrMetallicRoughness.setBaseColorFactor([0.8, 0.35, 0.2, 1.0]); 
                            material.pbrMetallicRoughness.setBaseColorFactor([0.203, 0.374, 0.637, 1.0]); 
                            // const r = Math.random();
                            // const g = Math.random();
                            // const b = Math.random();
                            // material.pbrMetallicRoughness.setBaseColorFactor([r, g, b, 1.0]);

                            material.pbrMetallicRoughness.setMetallicFactor(0.1); 
                            material.pbrMetallicRoughness.setRoughnessFactor(0.7);
                        }
                    });

                    modelContainer.appendChild(modelTitle);
                    modelContainer.appendChild(viewer);

                    const closeBtn = document.createElement('button');
                    closeBtn.innerHTML = "&times;";
                    closeBtn.style.cssText = `
                        position: absolute; top: 15px; right: 20px; 
                        background: none; border: none; color: #333; font-size: 30px; 
                        cursor: pointer; z-index: 100; line-height: 1;
                    `;
                    closeBtn.onclick = () => document.body.removeChild(overlay);
                    overlay.onclick = (e) => { if (e.target === overlay) document.body.removeChild(overlay); };

                    container.appendChild(imgContainer);
                    container.appendChild(modelContainer);
                    container.appendChild(closeBtn);
                    overlay.appendChild(container);
                    document.body.appendChild(overlay);
                }

                /**
                 * Close fullscreen window
                 */
                function closeGLBViewer() {
                    fullscreen.style.opacity = '0';
                    setTimeout(() => {
                        fullscreen.style.display = 'none';
                        content.innerHTML = '';
                    }, 250); // Match transition duration
                }

                // Add click handlers to all View GLB buttons
                document.addEventListener('click', function(e) {
                    const button = e.target.closest('.x-button');
                    if (button && button.textContent.trim() === 'View GLB') {
                        const glbPath = button.getAttribute('data-glb');
                        const prompt = button.getAttribute('data-prompt');
                        if (glbPath) {
                            openGLBViewer(glbPath, prompt);
                        }
                    }
                });

                // Close button handler
                closeBtn.addEventListener('click', closeGLBViewer);

                // Close on backdrop click
                fullscreen.addEventListener('click', function(e) {
                    if (e.target === fullscreen) {
                        closeGLBViewer();
                    }
                });

                // Close on Escape key
                document.addEventListener('keydown', function(e) {
                    if (e.key === 'Escape' && fullscreen.style.display === 'flex') {
                        closeGLBViewer();
                    }
                });
            })();
        </script>
    </body></html>

================================================
FILE: docs/main.css
================================================
* {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

a {
    color: #5b6acf;
    text-decoration: none;
}
  
a.link:focus, a.link:hover {
    color: #8b5cf6;
    text-decoration: none;
}

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
}

body {
    background: #faf9f7;
    position: relative;
    margin: 0px;
    padding: 0px;
    color: #2a2a2a;
    overflow-x: hidden;
}

p {
    position: relative;
    margin: 16px;
    font-size: 16px;
    font-weight: 300;
    text-align: justify;
}

p span {
    font-weight: 500;
}

.x-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
}

.x-column {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    flex-direction: column;
}

.x-center-text {
    margin: 16px 32px;
    text-align: center;
}

.x-left-align {
    display: flex;
    align-items: center;
    justify-content: left;
    flex-wrap: nowrap;
}

.x-right-align {
    display: flex;
    align-items: center;
    justify-content: right;
    flex-wrap: nowrap;
}

.x-flex-spacer {
    flex: 1;
}

.x-labels {
    position: absolute;
    top: 8px;
    right: 6px;
    display: flex;
    align-items: center;
    justify-content: left;
    flex-direction: row-reverse;
}

.x-label {
    height: 20px;
    padding: 0px 6px;
    margin: 0px 2px;
    color: #2a2a2a;
    font-size: 12px;
    font-weight: 600;
    background: rgba(45, 45, 45, 0.1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.x-button {
    height: 36px;
    padding: 0px 14px;
    background: rgba(45, 45, 45, 0.08);
    color: #2a2a2a;
    border-radius: 50px;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 16px;
    font-weight: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.x-button.small {
    height: 32px;
    padding: 0px 12px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
}

.x-button:hover {
    background: rgba(45, 45, 45, 0.15);
    transform: translateY(-2px);
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.15);
}

.x-button.disabled {
    background: rgba(45, 45, 45, 0.05);
    color: rgba(42, 42, 42, 0.4);
    cursor: default;
}

.x-button.disabled:hover {
    background: rgba(45, 45, 45, 0.05);
    transform: none;
}

.x-gradient-font {
    background: linear-gradient(270deg, #845ade 0%, #2e6ed6 25%, #ff7d4b 75%, #ec9b0b 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.x-gradient-block {
    color: #3f3f3f;
    background: linear-gradient(270deg, #845ade2f 0%, #2e6ed62f 25%, #ff7d4b2f 75%, #ec9b0b2f 100%);
    border-radius: 16px;
}

.x-gradient-border {
    position: relative;
    padding: 1px;
    margin: 3px;
    border: 3px;
    background: white;
    background-clip: padding-box;
    border: solid border transparent;
    border-radius: 16px;
}

.x-gradient-border::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: -1;
    margin: -3px;
    border-radius: 16px;
    background: linear-gradient(270deg, #845ade 0%, #2e6ed6 25%, #ff7d4b 75%, #ec9b0b 100%);
}

.x-section-title {
    text-align: center;
    margin: 100px 0px 48px 0px;
    font-size: 36px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #333;
    position: relative;
    padding-bottom: 20px;
}

.x-section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.x-note {
    color: rgba(42, 42, 42, 0.7);
    font-size: 14px;
    font-weight: 300;
}

.x-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.x-card .caption {
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #2a2a2a;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
}

.x-handwriting {
    width: 100%;
    font-family: 'Segoe Print';
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    color: black;
    text-align: justify;
}

.x-image-prompt {
    position: relative;
    height: calc(100% - 2px);
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.x-image-prompt img {
    max-width: 100%;
    max-height: 100%;
}

.x-small-header {
    text-align: center;
    margin-top: 64px;
    margin-bottom: 24px;
    margin-left: 4px;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #666;
}

.x-dot-card {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.08);
}

.x-dot-card-title {
    margin-top: 0;
    margin-bottom: 0px;
    font-size: 20px; 
    color: #2a2a2a;
    display: flex;
    align-items: center;
    gap: 10px;
}

#main {
    max-width: 1000px;
    margin: 0px auto;
    padding-bottom: 200px;
}

.author-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 32px;
    padding: 8px;
}

.author-link {
    color: #2a2a2a;
    text-decoration: none;
    font-weight: 500;
}
  
.author-link:focus, .author-link:hover {
    text-decoration: underline;
}

.affiliation-link {
    font-size: 14px;
    color: rgba(42, 42, 42, 0.7);
    text-decoration: none;
    font-weight: 300;
}

#links {
    margin: 16px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

#links div {
    margin: 4px 8px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#links a {
    height: 20px;
    padding: 8px 16px;
    color: #2a2a2a;
    font-size: 16px;
    font-weight: 300;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50px;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#links a:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.15);
}

#links a.disabled {
    background-color: rgba(200, 200, 200, 0.5);
    color: rgba(42, 42, 42, 0.5);
}

#links a.disabled:hover {
    background-color: rgba(200, 200, 200, 0.5);
}

#links a::before {
    /* Material Icons */
    font-family: 'Material Icons' !important;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;

    /* Better Font Rendering =========== */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'liga';

    margin-right: 8px;
    font-size: 20px;
}

#links #paper::before {
    content: "description";
}

#links #arxiv::before {
    content: "article";
}

#links #code::before {
    content: "code";
}

#links #poster::before {
    content: "picture_as_pdf";
}

#links #video::before {
    content: "play_circle";
}

#links #demo::before {
    content: "rocket_launch";
}

.feature-container {
    max-width: 1000px;
    margin: 32px auto;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.feature-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.feature-tab {
    aspect-ratio: 1 / 1;
    background-color: rgba(255, 255, 255, 0.8);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #666;
    padding: 10px;
    text-align: center;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.08);
}

.feature-tab:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.12);
}

.feature-tab.active-yellow { border-color: #facd5c; color: #facd5c; background-color: rgba(251, 191, 36, 0.1); }
.feature-tab.active-red    { border-color: #d17969; color: #d17969; background-color: rgba(209, 121, 105, 0.1); }
.feature-tab.active-blue   { border-color: #60a5fa; color: #60a5fa; background-color: rgba(96, 165, 250, 0.1); }
.feature-tab.active-purple { border-color: #b7a5ff; color: #b7a5ff; background-color: rgba(167, 139, 250, 0.1); }

.feature-tab svg {
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
    fill: currentColor;
}

.feature-tab span {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.2;
}

.feature-panel {
    display: none;
    padding: 32px;
    animation: fadeIn 0.4s ease;
}

.feature-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
    .feature-tabs {
        grid-template-columns: repeat(2, 1fr);
    }
    .feature-panel {
        padding: 16px;
    }
}

.bibtex-entry {
    margin: 32px auto;
    max-width: 900px;
    padding: 0px 24px;
    color: #2a2a2a;
    font-family: consolas, monospace;
    white-space: pre;
    text-wrap: wrap;
    font-size: 14px;
    font-weight: 300;
    display: flex;
    flex-direction: column;
    align-items: left;
    justify-content: center;
}

.line {
    display: grid;
    grid-template-columns: max-content 1fr; 
    gap: 0; 
}

.key {
    font-family: consolas, monospace;
    text-align: right;
    padding-right: 0; 
}

.value {
    font-family: consolas, monospace;
    word-break: break-word; 
}

#bottombar {
    position: absolute;
    bottom: 0px;
    height: 100px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    user-select: none;
}

#bottombar .row {
    width: 90%;
    padding: 0px 5%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

#bottombar div {
    color: rgba(42, 42, 42, 0.7);
    font-size: 12px;
    font-weight: 500;
}

#bottombar div a {
    color: rgba(42, 42, 42, 0.7);
    font-size: 12px;
    font-weight: 500;
}

#bottombar div a:hover {
    color: rgba(42, 42, 42, 1);
    font-size: 12px;
}

#bottombar div span {
    font-weight: 700;
}

.scroll-indicator {
    position: fixed;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #666;
    cursor: pointer;
    z-index: 1000;
    
    animation: scroll-bounce 2s infinite;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.scroll-indicator.hidden {
    opacity: 0;
    visibility: hidden;
}

@keyframes scroll-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* Animated Gradient Background with Mouse Follow */
.animated-gradient {
    --mouse-x: 50%;
    --mouse-y: 50%;
    background: 
        radial-gradient(circle at var(--mouse-x) var(--mouse-y), rgba(102, 126, 234, 0.8) 0%, transparent 50%),
        radial-gradient(circle at calc(100% - var(--mouse-x)) calc(100% - var(--mouse-y)), rgba(118, 75, 162, 0.8) 0%, transparent 50%),
        radial-gradient(circle at var(--mouse-x) calc(100% - var(--mouse-y)), rgba(240, 147, 251, 0.6) 0%, transparent 50%),
        linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 200%;
    animation: gradient-shift 20s ease infinite;
    transition: background 0.1s ease-out;
}

/* Hero expandable effect */
.hero-expandable {
    position: sticky;
    top: 0;
    z-index: 10;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 0;
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

================================================
FILE: docs/pv.css
================================================
.pv-video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0 auto;
    background-color: #2a2a2a;
    overflow: hidden;
    border-radius: 8px;
}

.pv-video-element {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.pv-poster-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    background-size: cover;
    background-position: center;
    transition: opacity 0.3s ease;
}

.pv-play-btn {
    width: 64px;
    height: 64px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 2px solid #2a2a2a;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s ease, background-color 0.2s;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
}

.pv-play-btn::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 16px solid #2a2a2a;
    margin-left: 4px;
}

.pv-poster-overlay:hover .pv-play-btn {
    transform: scale(1.1);
    background-color: rgba(255, 255, 255, 1);
}

.pv-video-wrapper.is-playing .pv-poster-overlay {
    opacity: 0;
    pointer-events: none;
}

================================================
FILE: docs/style.css
================================================
/* Icomoon font removed - now using Material Icons via CDN */
/* Material Icons are loaded in index.html via Google Fonts CDN */


================================================
FILE: docs/stylesheet.css
================================================
/* Font definitions removed - using system Segoe UI font */
/* All font-face declarations for Avenir Next Cyr have been removed */
/* The site now uses 'Segoe UI' as defined in main.css and style.css */


================================================
FILE: docs/window.css
================================================
#fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: transparent;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    user-select: none;
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

#fullscreen #window {
    position: relative;
    min-width: 25vw;
    min-height: 25vh;
    max-width: 100vw;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.2);
    padding: 8px;
    
}

#fullscreen #window #close {
    position: absolute;
    top: 0px;
    right: 0px;
    width: 31px;
    height: 30px;
    padding: 0px 0px 2px 1px;
    color: black;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 100;
}

#fullscreen #window #close {
    color: #2a2a2a;
}

#fullscreen #window #close:hover {
    color: #d32f2f;
}

#fullscreen #window #content {
    max-width: calc(100vw - 16px);
    max-height: calc(90vh - 16px);
    overflow-x: hidden;
    overflow-y: auto;
}

.modelviewer-container {
    width: 500px;
    height: 500px;
    margin: 8px;
    border-radius: 8px;
    background: white;
    box-shadow: inset 0px 0px 4px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    position: relative;
}

.modelviewer-container model-viewer {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    background-color: #f5f5f5;
}

.modelviewer-container model-viewer button {
    height: 16px;
    padding: 0px 6px;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 50px;
    box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25);
    border: none;
    font-size: 12px;
    font-weight: 300;
    display: none;
    opacity: 0;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.modelviewer-panel {
    width: 300px;
    margin: 8px;
    margin-top: 0px;
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: start;
}

.modelviewer-panel-desc {
    width: 100%;
}

.modelviewer-panel-desc div {
    font-size: 16px;
    font-weight: 500;
    margin: 4px;
}

.modelviewer-panel-prompt {
    width: calc(100% - 16px);
    height: 250px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 8px;
    box-shadow: inset 0px 0px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: start;
    justify-content: center;
    overflow-y: auto;
    user-select: text;
}

.modelviewer-panel-button {
    height: 40px;
    margin: 4px 4px;
    padding: 0px 14px;
    background: rgba(45, 45, 45, 0.08);
    color: #2a2a2a;
    border-radius: 50px;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 16px;
    font-weight: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modelviewer-panel-button.small {
    height: 32px;
    padding: 0px 12px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 300;
}

.modelviewer-panel-button.tiny {
    height: 24px;
    padding: 0px 10px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 300;
}

.modelviewer-panel-button:hover {
    background: rgba(45, 45, 45, 0.15);
    transform: translateY(-2px);
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.15);
}

.modelviewer-panel-button.checked {
    border: 2px solid #2a2a2a;
    background: rgba(45, 45, 45, 0.1);
    color: #2a2a2a;
}


================================================
FILE: inputs/coarse_mesh/1.glb
================================================
[File too large to display: 25.1 MB]

================================================
FILE: main.py
================================================
# ==============================================================================
# Original work Copyright (c) 2025 Tencent.
# Modified work Copyright (c) 2025 UltraShape Team.
# 
# Modified by UltraShape on 2025.12.25
# ==============================================================================

# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT
# except for the third-party components listed below.
# Hunyuan 3D does not impose any additional limitations beyond what is outlined
# in the repsective licenses of these third-party components.
# Users must comply with all terms and conditions of original licenses of these third-party
# components and must ensure that the usage of the third party components adheres to
# all relevant laws and regulations.

# For avoidance of doubts, Hunyuan 3D means the large language models and
# their software and algorithms, including trained model weights, parameters (including
# optimizer states), machine-learning model code, inference-enabling code, training-enabling code,
# fine-tuning enabling code and other elements of the foregoing made publicly available
# by Tencent in accordance with TENCENT HUNYUAN COMMUNITY LICENSE AGREEMENT.


# import warnings
# warnings.filterwarnings("ignore")

import os
import torch
import argparse
from pathlib import Path
from typing import Tuple, List
from omegaconf import OmegaConf, DictConfig
from einops._torch_specific import allow_ops_in_compiled_graph  # requires einops>=0.6.1
allow_ops_in_compiled_graph()

import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint, Callback
from pytorch_lightning.strategies import DDPStrategy, DeepSpeedStrategy
from pytorch_lightning.loggers import Logger, TensorBoardLogger
from pytorch_lightning.utilities import rank_zero_info

from ultrashape.utils import get_config_from_file, instantiate_from_config


class SetupCallback(Callback):
    def __init__(self, config: DictConfig, basedir: Path, logdir: str = "log", ckptdir: str = "ckpt") -> None:
        super().__init__()
        self.logdir = basedir / logdir
        self.ckptdir = basedir / ckptdir
        self.config = config

    def on_fit_start(self, trainer: pl.trainer.Trainer, pl_module: pl.LightningModule) -> None:
        if trainer.global_rank == 0:
            os.makedirs(self.logdir, exist_ok=True)
            os.makedirs(self.ckptdir, exist_ok=True)


def setup_callbacks(config: DictConfig) -> Tuple[List[Callback], Logger]:
    training_cfg = config.training
    basedir = Path(training_cfg.output_dir)
    os.makedirs(basedir, exist_ok=True)
    all_callbacks = []

    setup_callback = SetupCallback(config, basedir)
    all_callbacks.append(setup_callback)
    
    checkpoint_callback = ModelCheckpoint(
        dirpath=setup_callback.ckptdir,
        filename="ckpt-{step:08d}",
        save_top_k=-1,
        verbose=False,
        every_n_train_steps=training_cfg.every_n_train_steps)
    all_callbacks.append(checkpoint_callback)

    if "callbacks" in config:
        for key, value in config['callbacks'].items():
            custom_callback = instantiate_from_config(value)
            all_callbacks.append(custom_callback)

    logger = TensorBoardLogger(save_dir=str(setup_callback.logdir), name="tensorboard")

    return all_callbacks, logger


def merge_cfg(cfg, arg_cfg):
    for key in arg_cfg.keys():
        if key in cfg.training:
            arg_cfg[key] = cfg.training[key]
    cfg.training = DictConfig(arg_cfg)
    return cfg


def get_args():
    parser = argparse.ArgumentParser()
    parser.add_argument("--fast", action='store_true')
    parser.add_argument("-c", "--config", type=str, required=True)
    parser.add_argument("-s", "--seed", type=int, default=0)
    parser.add_argument("-nn", "--num_nodes", type=int, default=1)
    parser.add_argument("-ng", "--num_gpus", type=int, default=1)
    parser.add_argument("-u", "--update_every", type=int, default=1)
    parser.add_argument("-st", "--steps", type=int, default=50000000)
    parser.add_argument("-lr", "--base_lr", type=float, default=4.5e-6)
    parser.add_argument("-a", "--use_amp", default=False, action="store_true")
    parser.add_argument("--amp_type", type=str, default="16")
    parser.add_argument("--gradient_clip_val", type=float, default=None)
    parser.add_argument("--gradient_clip_algorithm", type=str, default=None)
    parser.add_argument("--every_n_train_steps", type=int, default=50000)
    parser.add_argument("--log_every_n_steps", type=int, default=50)
    parser.add_argument("--val_check_interval", type=int, default=1024)
    parser.add_argument("--limit_val_batches", type=int, default=64)
    parser.add_argument("--monitor", type=str, default="val/total_loss")
    parser.add_argument("--output_dir", type=str, help="the output directory to save everything.")
    parser.add_argument("--ckpt_path", type=str, default="", help="the restore checkpoints.")
    parser.add_argument("--deepspeed", default=False, action="store_true")
    parser.add_argument("--deepspeed2", default=False, action="store_true")
    parser.add_argument("--scale_lr", type=bool, nargs="?", const=True, default=False,
                        help="scale base-lr by ngpu * batch_size * n_accumulate")
    return parser.parse_args()
    

if __name__ == "__main__":
    
    args = get_args()
    
    if args.fast:
        torch.backends.cudnn.allow_tf32 = True
        torch.backends.cuda.matmul.allow_tf32 = True
        torch.set_float32_matmul_precision('medium')
        torch.utils.data._utils.MP_STATUS_CHECK_INTERVAL = 0.05

    # Set random seed
    pl.seed_everything(args.seed, workers=True)

    # Load configuration
    config = get_config_from_file(args.config)
    config = merge_cfg(config, vars(args))
    training_cfg = config.training

    # print config
    rank_zero_info("Begin to print configuration ...")
    rank_zero_info(OmegaConf.to_yaml(config))
    rank_zero_info("Finish print ...")

    # Setup callbacks
    callbacks, loggers = setup_callbacks(config)

    # Build data modules
    data: pl.LightningDataModule = instantiate_from_config(config.dataset)

    # Build model
    model: pl.LightningModule = instantiate_from_config(config.model)
    
    nodes = args.num_nodes
    ngpus = args.num_gpus
    base_lr = training_cfg.base_lr
    accumulate_grad_batches = training_cfg.update_every
    batch_size = config.dataset.params.batch_size

    if 'NNODES' in os.environ:
        nodes = int(os.environ['NNODES'])
        training_cfg.num_nodes = nodes
        args.num_nodes = nodes

    if args.scale_lr:
        model.learning_rate = accumulate_grad_batches * nodes * ngpus * batch_size * base_lr
        info = f"Setting learning rate to {model.learning_rate:.2e} = {accumulate_grad_batches} (accumulate)"
        info += f" * {nodes} (nodes) * {ngpus} (num_gpus) * {batch_size} (batchsize) * {base_lr:.2e} (base_lr)"
        rank_zero_info(info)
    else:
        model.learning_rate = base_lr
        rank_zero_info("++++ NOT USING LR SCALING ++++")
        rank_zero_info(f"Setting learning rate to {model.learning_rate:.2e}")

    # Build trainer
    if args.num_nodes > 1 or args.num_gpus > 1:
        if args.deepspeed:
            ddp_strategy = DeepSpeedStrategy(stage=1)
        elif args.deepspeed2:
            ddp_strategy = 'deepspeed_stage_2'
        else:
            ddp_strategy = DDPStrategy(find_unused_parameters=False, bucket_cap_mb=1500)
    else:
        ddp_strategy = 'ddp'

    rank_zero_info(f'*' * 100)
    if training_cfg.use_amp:
        amp_type = training_cfg.amp_type
        assert amp_type in ['bf16', '16', '32'], f"Invalid amp_type: {amp_type}"
        rank_zero_info(f'Using {amp_type} precision')
    else:
        amp_type = 32
        rank_zero_info(f'Using 32 bit precision')
    rank_zero_info(f'*' * 100)

    trainer = pl.Trainer(
        max_steps=training_cfg.steps,
        precision=amp_type,
        callbacks=callbacks,
        accelerator="gpu",
        devices=args.num_gpus,
        num_nodes=training_cfg.num_nodes,
        strategy=ddp_strategy,
        gradient_clip_val=training_cfg.get('gradient_clip_val'),
        gradient_clip_algorithm=training_cfg.get('gradient_clip_algorithm'),
        accumulate_grad_batches=args.update_every,
        logger=loggers,
        log_every_n_steps=training_cfg.log_every_n_steps,
        val_check_interval=training_cfg.val_check_interval,
        limit_val_batches=training_cfg.limit_val_batches,
        check_val_every_n_epoch=None
    )

    # Train
    if training_cfg.ckpt_path == '': 
        training_cfg.ckpt_path = None
    trainer.fit(model, datamodule=data, ckpt_path=training_cfg.ckpt_path)


================================================
FILE: requirements.txt
================================================
accelerate==1.1.1
diffusers==0.30.0
deepspeed
diso==0.1.4
einops==0.8.1
flash_attn==2.8.3
huggingface_hub==0.36.0
imageio==2.36.0
ipywidgets==8.1.7
jaxtyping==0.3.4
matplotlib==3.10.8
numpy==1.24.4
omegaconf==2.3.0
opencv_python==4.10.0.84
opencv_python_headless==4.11.0.86
pandas==2.3.3
Pillow==12.0.0
pymeshlab==2022.2.post3
pythreejs==2.4.2
pytorch_lightning==1.9.5
PyYAML==6.0.2
safetensors==0.7.0
sageattention==1.0.6
scikit-image==0.24.0
onnxruntime
rembg
tensorboard
timm==1.0.22
torchdiffeq==0.2.5
tqdm==4.66.5
transformers==4.37.2
trimesh==4.4.7
typeguard==4.3.0
wandb==0.23.1


================================================
FILE: scripts/gradio_app.py
================================================
import argparse
import gc
import os
import sys

import gradio as gr
import torch
from omegaconf import OmegaConf

# Add project root to path
sys.path.append(os.getcwd())

from ultrashape.rembg import BackgroundRemover
from ultrashape.utils.misc import instantiate_from_config
from ultrashape.surface_loaders import SharpEdgeSurfaceLoader
from ultrashape.utils import voxelize_from_point
from ultrashape.pipelines import UltraShapePipeline

# Global variables to cache the model
MODEL_CACHE = {}


def get_pipeline_cached(config_path, ckpt_path, device='cuda', low_vram=False):
    # Check if we have a valid cached pipeline for this checkpoint
    if "pipeline" in MODEL_CACHE and MODEL_CACHE.get("ckpt_path") == ckpt_path:
        print("Using cached pipeline...")
        return MODEL_CACHE["pipeline"], MODEL_CACHE["config"]

    # Clear old cache if it exists (e.g. different checkpoint)
    if MODEL_CACHE:
        print("Clearing old model cache...")
        MODEL_CACHE.clear()
        gc.collect()
        torch.cuda.empty_cache()

    print(f"Loading config from {config_path}...")
    config = OmegaConf.load(config_path)

    print("Instantiating VAE...")
    vae = instantiate_from_config(config.model.params.vae_config)

    print("Instantiating DiT...")
    dit = instantiate_from_config(config.model.params.dit_cfg)

    print("Instantiating Conditioner...")
    conditioner = instantiate_from_config(config.model.params.conditioner_config)

    print("Instantiating Scheduler & Processor...")
    scheduler = instantiate_from_config(config.model.params.scheduler_cfg)
    image_processor = instantiate_from_config(config.model.params.image_processor_cfg)

    print(f"Loading weights from {ckpt_path}...")
    weights = torch.load(ckpt_path, map_location='cpu')

    vae.load_state_dict(weights['vae'], strict=True)
    dit.load_state_dict(weights['dit'], strict=True)
    conditioner.load_state_dict(weights['conditioner'], strict=True)

    vae.eval().to(device)
    dit.eval().to(device)
    conditioner.eval().to(device)

    if hasattr(vae, 'enable_flashvdm_decoder'):
        vae.enable_flashvdm_decoder()

    print("Creating Pipeline...")
    pipeline = UltraShapePipeline(
        vae=vae,
        model=dit,
        scheduler=scheduler,
        conditioner=conditioner,
        image_processor=image_processor
    )

    if low_vram:
        pipeline.enable_model_cpu_offload()

    MODEL_CACHE["pipeline"] = pipeline
    MODEL_CACHE["config"] = config
    MODEL_CACHE["ckpt_path"] = ckpt_path

    return pipeline, config


def predict(
        image_input,
        mesh_input,
        steps,
        scale,
        octree_res,
        num_latents,
        chunk_size,
        seed,
        remove_bg,
        ckpt_path,
        low_vram
):
    # Aggressive memory cleanup at start
    gc.collect()
    torch.cuda.empty_cache()

    try:
        device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
        config_path = "configs/infer_dit_refine.yaml"

        if not os.path.exists(config_path):
            raise FileNotFoundError(f"Config not found at {config_path}")

        pipeline, config = get_pipeline_cached(config_path, ckpt_path, device, low_vram)

        voxel_res = config.model.params.vae_config.params.voxel_query_res

        print(f"Initializing Surface Loader (Token Num: {num_latents})...")
        loader = SharpEdgeSurfaceLoader(
            num_sharp_points=204800,
            num_uniform_points=204800,
        )

        print(f"Processing inputs...")
        if image_input is None:
            raise ValueError("Image input is required")
        if mesh_input is None:
            raise ValueError("Mesh input is required")

        # Handle image input
        if isinstance(image_input, dict):
            # In newer gradio versions Image component might return a dict for mask etc, but usually just PIL/numpy
            # if type='pil' it is PIL.Image
            pass

        image = image_input.convert("RGBA")

        if remove_bg or image.mode != 'RGBA':
            rembg = BackgroundRemover()
            image = rembg(image)

        # Handle mesh input - Gradio Model3D returns path to file
        surface = loader(mesh_input, normalize_scale=scale).to(device, dtype=torch.float16)
        pc = surface[:, :, :3]  # [B, N, 3]

        # Voxelize
        _, voxel_idx = voxelize_from_point(pc, num_latents, resolution=voxel_res)

        print("Running diffusion process...")
        gen_device = "cpu" if low_vram else device
        generator = torch.Generator(gen_device).manual_seed(int(seed))

        with torch.autocast(device_type="cuda", dtype=torch.bfloat16):
            mesh_out_list, _ = pipeline(
                image=image,
                voxel_cond=voxel_idx,
                generator=generator,
                box_v=1.0,
                mc_level=0.0,
                octree_resolution=int(octree_res),
                num_chunks=int(chunk_size),
                num_inference_steps=int(steps)
            )

        # Save output
        output_dir = "outputs_gradio"
        os.makedirs(output_dir, exist_ok=True)
        base_name = "output"
        save_path = os.path.join(output_dir, f"{base_name}_refined.glb")

        mesh_out = mesh_out_list[0]
        mesh_out.export(save_path)
        print(f"Successfully saved to {save_path}")

        return save_path

    finally:
        # Aggressive memory cleanup at end
        gc.collect()
        torch.cuda.empty_cache()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="UltraShape Gradio App")
    parser.add_argument("--ckpt", type=str, required=True, help="Path to split checkpoint (.pt)")
    parser.add_argument("--share", action="store_true", help="Share the gradio app")
    parser.add_argument("--low_vram", action="store_true", help="Optimize for low VRAM usage")

    args = parser.parse_args()

    # Define Gradio Interface
    with gr.Blocks(title="UltraShape Inference") as demo:
        gr.Markdown("# UltraShape Inference: Mesh & Image Refinement")

        with gr.Row():
            with gr.Column():
                image_input = gr.Image(type="pil", label="Input Image", image_mode="RGBA")
                mesh_input = gr.Model3D(label="Input Coarse Mesh (.glb, .obj)")

                with gr.Accordion("Advanced Parameters", open=True):
                    steps = gr.Slider(minimum=1, maximum=200, value=50, step=1, label="Inference Steps")
                    scale = gr.Slider(minimum=0.1, maximum=2.0, value=0.99, label="Mesh Normalization Scale")
                    octree_res = gr.Slider(minimum=64, maximum=2048, value=1024, step=64, label="Octree Resolution")
                    num_latents = gr.Slider(minimum=1024, maximum=32768, value=32768, step=128,
                                            label="Number of Latent Tokens (Use 8192 if OOM)")
                    chunk_size = gr.Slider(minimum=512, maximum=10000, value=2048, step=512,
                                           label="Chunk Size (Use 2000 if OOM)")
                    seed = gr.Number(value=42, label="Random Seed")
                    remove_bg = gr.Checkbox(label="Remove Background", value=False)

                run_btn = gr.Button("Run Inference", variant="primary")

            with gr.Column():
                output_model = gr.Model3D(label="Refined Output Mesh")

        run_btn.click(
            fn=lambda img, mesh, s, sc, oct, nml, chk, sd, rm: predict(img, mesh, s, sc, oct, nml, chk, sd, rm, args.ckpt,
                                                                      args.low_vram),
            inputs=[image_input, mesh_input, steps, scale, octree_res, num_latents, chunk_size, seed, remove_bg],
            outputs=[output_model]
        )

    demo.launch(share=args.share, server_name='0.0.0.0', server_port=7860)


================================================
FILE: scripts/infer_dit_refine.py
================================================
import os
import sys
import argparse
import torch
import numpy as np
from PIL import Image
from omegaconf import OmegaConf

# project_root = '[your_project_root_path]'  # Replace with your project root path
# sys.path.insert(0, project_root)

from ultrashape.rembg import BackgroundRemover
from ultrashape.utils.misc import instantiate_from_config
from ultrashape.surface_loaders import SharpEdgeSurfaceLoader
from ultrashape.utils import voxelize_from_point
from ultrashape.pipelines import UltraShapePipeline 

def load_models(config_path, ckpt_path, device='cuda'):

    print(f"Loading config from {config_path}...")
    config = OmegaConf.load(config_path)
    
    print("Instantiating VAE...")
    vae = instantiate_from_config(config.model.params.vae_config)
    
    print("Instantiating DiT...")
    dit = instantiate_from_config(config.model.params.dit_cfg)
    
    print("Instantiating Conditioner...")
    conditioner = instantiate_from_config(config.model.params.conditioner_config)
    
    print("Instantiating Scheduler & Processor...")
    scheduler = instantiate_from_config(config.model.params.scheduler_cfg)
    image_processor = instantiate_from_config(config.model.params.image_processor_cfg)
    
    print(f"Loading weights from {ckpt_path}...")
    weights = torch.load(ckpt_path, map_location='cpu')
    
    vae.load_state_dict(weights['vae'], strict=True)
    dit.load_state_dict(weights['dit'], strict=True)
    conditioner.load_state_dict(weights['conditioner'], strict=True)
    
    vae.eval().to(device)
    dit.eval().to(device)
    conditioner.eval().to(device)
    
    if hasattr(vae, 'enable_flashvdm_decoder'):
        vae.enable_flashvdm_decoder()

    components = {
        "vae": vae,
        "dit": dit,
        "conditioner": conditioner,
        "scheduler": scheduler,
        "image_processor": image_processor,
    }
    
    return components, config

def run_inference(args):
    device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

    components, config = load_models(args.config, args.ckpt, device)
    
    pipeline = UltraShapePipeline(
        vae=components['vae'],
        model=components['dit'],
        scheduler=components['scheduler'],
        conditioner=components['conditioner'],
        image_processor=components['image_processor']
    )

    if args.low_vram:
        pipeline.enable_model_cpu_offload()

    token_num = args.num_latents
    voxel_res = config.model.params.vae_config.params.voxel_query_res
    
    print(f"Initializing Surface Loader (Token Num: {token_num})...")
    loader = SharpEdgeSurfaceLoader(
        num_sharp_points=204800,
        num_uniform_points=204800,
    )

    print(f"Processing inputs: {args.image} & {args.mesh}")
    image = Image.open(args.image)
    
    if args.remove_bg or image.mode != 'RGBA':
        rembg = BackgroundRemover()
        image = rembg(image)
    
    surface = loader(args.mesh, normalize_scale=args.scale).to(device, dtype=torch.float16)
    pc = surface[:, :, :3] # [B, N, 3]
    
    # Voxelize
    _, voxel_idx = voxelize_from_point(pc, token_num, resolution=voxel_res)
    
    print("Running diffusion process...")
    generator = torch.Generator(device).manual_seed(args.seed)
    
    with torch.autocast(device_type="cuda", dtype=torch.bfloat16):
        mesh, _ = pipeline(
            image=image,
            voxel_cond=voxel_idx,
            generator=generator,
            box_v=1.0,
            mc_level=0.0,
            octree_resolution=args.octree_res,
            num_inference_steps=args.steps,
            num_chunks=args.chunk_size,
        )
    
    os.makedirs(args.output_dir, exist_ok=True)
    base_name = os.path.splitext(os.path.basename(args.image))[0]
    save_path = os.path.join(args.output_dir, f"{base_name}_refined.glb")
    
    mesh = mesh[0]
    mesh.export(save_path)
    print(f"Successfully saved to {save_path}")

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="UltraShape Inference Script")
    
    parser.add_argument("--config", type=str, default="configs/infer_dit2.yaml", help="Path to inference config")
    parser.add_argument("--ckpt", type=str, required=True, help="Path to split checkpoint (.pt)")
    parser.add_argument("--low_vram", action="store_true", help="Optimize for low VRAM usage")
    
    parser.add_argument("--image", type=str, required=True, help="Input image path")
    parser.add_argument("--mesh", type=str, required=True, help="Input coarse mesh (.glb/.obj)")
    parser.add_argument("--output_dir", type=str, default="outputs", help="Output directory")
    
    parser.add_argument("--steps
Download .txt
gitextract_8lwu3ua4/

├── .gitignore
├── LICENSE
├── Notice.txt
├── README.md
├── configs/
│   ├── infer_dit_refine.yaml
│   ├── train_dit_refine.yaml
│   └── train_vae_refine.yaml
├── docs/
│   ├── carousel.css
│   ├── carousel.js
│   ├── index copy.html
│   ├── index.html
│   ├── main.css
│   ├── pv.css
│   ├── style.css
│   ├── stylesheet.css
│   └── window.css
├── inputs/
│   └── coarse_mesh/
│       └── 1.glb
├── main.py
├── requirements.txt
├── scripts/
│   ├── gradio_app.py
│   ├── infer_dit_refine.py
│   ├── install_env.sh
│   ├── run.sh
│   ├── sampling.py
│   └── train_deepspeed.sh
├── train.sh
└── ultrashape/
    ├── __init__.py
    ├── data/
    │   ├── objaverse_dit.py
    │   ├── objaverse_vae.py
    │   └── utils.py
    ├── models/
    │   ├── __init__.py
    │   ├── autoencoders/
    │   │   ├── __init__.py
    │   │   ├── attention_blocks.py
    │   │   ├── attention_processors.py
    │   │   ├── model.py
    │   │   ├── surface_extractors.py
    │   │   ├── vae_trainer.py
    │   │   └── volume_decoders.py
    │   ├── conditioner_mask.py
    │   ├── denoisers/
    │   │   ├── __init__.py
    │   │   ├── dit_mask.py
    │   │   └── moe_layers.py
    │   └── diffusion/
    │       ├── flow_matching_dit_trainer.py
    │       └── transport/
    │           ├── __init__.py
    │           ├── integrators.py
    │           ├── path.py
    │           ├── transport.py
    │           └── utils.py
    ├── pipelines.py
    ├── postprocessors.py
    ├── preprocessors.py
    ├── rembg.py
    ├── schedulers.py
    ├── surface_loaders.py
    └── utils/
        ├── __init__.py
        ├── ema.py
        ├── misc.py
        ├── trainings/
        │   ├── __init__.py
        │   ├── callback.py
        │   ├── lr_scheduler.py
        │   ├── mesh.py
        │   ├── mesh_log_callback.py
        │   └── peft.py
        ├── typing.py
        ├── utils.py
        ├── visualizers/
        │   ├── __init__.py
        │   ├── color_util.py
        │   ├── html_util.py
        │   └── pythreejs_viewer.py
        └── voxelize.py
Download .txt
SYMBOL INDEX (502 symbols across 41 files)

FILE: docs/carousel.js
  function initCarousel (line 13) | function initCarousel(carouselId) {

FILE: main.py
  class SetupCallback (line 44) | class SetupCallback(Callback):
    method __init__ (line 45) | def __init__(self, config: DictConfig, basedir: Path, logdir: str = "l...
    method on_fit_start (line 51) | def on_fit_start(self, trainer: pl.trainer.Trainer, pl_module: pl.Ligh...
  function setup_callbacks (line 57) | def setup_callbacks(config: DictConfig) -> Tuple[List[Callback], Logger]:
  function merge_cfg (line 84) | def merge_cfg(cfg, arg_cfg):
  function get_args (line 92) | def get_args():

FILE: scripts/gradio_app.py
  function get_pipeline_cached (line 23) | def get_pipeline_cached(config_path, ckpt_path, device='cuda', low_vram=...
  function predict (line 85) | def predict(

FILE: scripts/infer_dit_refine.py
  function load_models (line 18) | def load_models(config_path, ckpt_path, device='cuda'):
  function run_inference (line 60) | def run_inference(args):

FILE: scripts/sampling.py
  function load_mesh (line 21) | def load_mesh(mesh_path: str, device: str = "cuda") -> Tuple[torch.Tenso...
  function compute_mesh_features (line 33) | def compute_mesh_features(vertices: torch.Tensor, faces: torch.Tensor) -...
  function sample_uniform_points (line 78) | def sample_uniform_points(
  function sample_surface_points (line 94) | def sample_surface_points(
  function normalize_points_and_mesh (line 195) | def normalize_points_and_mesh(vertices: torch.Tensor, points: torch.Tens...
  function add_gaussian_noise (line 210) | def add_gaussian_noise(uniform_surface_points: torch.Tensor, curvature_s...
  function compute_points_value_bvh (line 250) | def compute_points_value_bvh(
  function save_point_cloud (line 269) | def save_point_cloud(
  function sample_points_in_bbox (line 306) | def sample_points_in_bbox(
  function process_single_mesh (line 317) | def process_single_mesh(
  class MeshDataset (line 422) | class MeshDataset(Dataset):
    method __init__ (line 423) | def __init__(self, mesh_json: str):
    method __len__ (line 428) | def __len__(self) -> int:
    method __getitem__ (line 430) | def __getitem__(self, idx: int) -> dict:
  class MeshProcessor (line 439) | class MeshProcessor(pl.LightningModule):
    method __init__ (line 440) | def __init__(
    method predict_step (line 456) | def predict_step(self, batch: Any, batch_idx: int, dataloader_idx: int...
    method predict_dataloader (line 497) | def predict_dataloader(self) -> DataLoader:
  function process_mesh_directory (line 508) | def process_mesh_directory(

FILE: ultrashape/data/objaverse_dit.py
  function padding (line 44) | def padding(image, mask, center=True, padding_ratio_range=[1.15, 1.15]):
  class ObjaverseDataset (line 88) | class ObjaverseDataset(Dataset):
    method __init__ (line 89) | def __init__(
    method __len__ (line 127) | def __len__(self):
    method _load_shape (line 130) | def _load_shape(self, index: int) -> Dict[str, Any]:
    method _load_image (line 182) | def _load_image(self, index: int) -> Dict[str, Any]:
    method get_data (line 223) | def get_data(self, index):
    method __getitem__ (line 228) | def __getitem__(self, index):
    method collate (line 235) | def collate(self, batch):
  class ObjaverseDataModule (line 240) | class ObjaverseDataModule(pl.LightningDataModule):
    method __init__ (line 241) | def __init__(
    method train_dataloader (line 289) | def train_dataloader(self):
    method val_dataloader (line 311) | def val_dataloader(self):

FILE: ultrashape/data/objaverse_vae.py
  class ObjaverseDataset (line 45) | class ObjaverseDataset(Dataset):
    method __init__ (line 46) | def __init__(
    method __len__ (line 87) | def __len__(self):
    method _load_shape (line 90) | def _load_shape(self, index: int) -> Dict[str, Any]:
    method _clip_to_tsdf (line 166) | def _clip_to_tsdf(self, sdf: np.array):
    method get_data (line 172) | def get_data(self, index):
    method __getitem__ (line 176) | def __getitem__(self, index):
    method collate (line 179) | def collate(self, batch):
  class ObjaverseDataModule (line 184) | class ObjaverseDataModule(pl.LightningDataModule):
    method __init__ (line 185) | def __init__(
    method train_dataloader (line 220) | def train_dataloader(self):
    method val_dataloader (line 242) | def val_dataloader(self):

FILE: ultrashape/data/utils.py
  function make_seed (line 27) | def make_seed(*args):
  class PipelineStage (line 34) | class PipelineStage:
    method invoke (line 35) | def invoke(self, *args, **kw):
  function identity (line 39) | def identity(x: Any) -> Any:
  function safe_eval (line 44) | def safe_eval(s: str, expr: str = "{}"):
  function lookup_sym (line 51) | def lookup_sym(sym: str, modules: list):
  function repeatedly0 (line 61) | def repeatedly0(
  function guess_batchsize (line 69) | def guess_batchsize(batch: Union[tuple, list]):
  function repeatedly (line 74) | def repeatedly(
  function pytorch_worker_info (line 100) | def pytorch_worker_info(group=None):  # sourcery skip: use-contextlib-su...
  function pytorch_worker_seed (line 136) | def pytorch_worker_seed(group=None):
  function worker_init_fn (line 141) | def worker_init_fn(_):
  function collation_fn (line 155) | def collation_fn(samples, combine_tensors=True, combine_scalars=True):

FILE: ultrashape/models/autoencoders/attention_blocks.py
  class FourierEmbedder (line 55) | class FourierEmbedder(nn.Module):
    method __init__ (line 58) | def __init__(self,
    method get_dims (line 89) | def get_dims(self, input_dim):
    method forward (line 95) | def forward(self, x: torch.Tensor) -> torch.Tensor:
  class DropPath (line 116) | class DropPath(nn.Module):
    method __init__ (line 120) | def __init__(self, drop_prob: float = 0., scale_by_keep: bool = True):
    method forward (line 125) | def forward(self, x):
    method extra_repr (line 144) | def extra_repr(self):
  class MLP (line 148) | class MLP(nn.Module):
    method __init__ (line 149) | def __init__(
    method forward (line 163) | def forward(self, x):
  class QKVMultiheadCrossAttention (line 167) | class QKVMultiheadCrossAttention(nn.Module):
    method __init__ (line 168) | def __init__(
    method forward (line 185) | def forward(self, q, kv):
  class MultiheadCrossAttention (line 201) | class MultiheadCrossAttention(nn.Module):
    method __init__ (line 202) | def __init__(
    method forward (line 232) | def forward(self, x, data):
  class ResidualCrossAttentionBlock (line 246) | class ResidualCrossAttentionBlock(nn.Module):
    method __init__ (line 247) | def __init__(
    method forward (line 278) | def forward(self, x: torch.Tensor, data: torch.Tensor):
  class QKVMultiheadAttention (line 284) | class QKVMultiheadAttention(nn.Module):
    method __init__ (line 285) | def __init__(
    method forward (line 300) | def forward(self, qkv):
  class MultiheadAttention (line 314) | class MultiheadAttention(nn.Module):
    method __init__ (line 315) | def __init__(
    method forward (line 341) | def forward(self, x):
  class ResidualAttentionBlock (line 348) | class ResidualAttentionBlock(nn.Module):
    method __init__ (line 349) | def __init__(
    method forward (line 374) | def forward(self, x: torch.Tensor):
  class Transformer (line 380) | class Transformer(nn.Module):
    method __init__ (line 381) | def __init__(
    method forward (line 412) | def forward(self, x: torch.Tensor):
  class CrossAttentionDecoder (line 418) | class CrossAttentionDecoder(nn.Module):
    method __init__ (line 420) | def __init__(
    method set_cross_attention_processor (line 460) | def set_cross_attention_processor(self, processor):
    method set_default_cross_attention_processor (line 463) | def set_default_cross_attention_processor(self):
    method forward (line 466) | def forward(self, queries=None, query_embeddings=None, latents=None):
  function fps (line 479) | def fps(
  class PointCrossAttentionEncoder (line 493) | class PointCrossAttentionEncoder(nn.Module):
    method __init__ (line 495) | def __init__(
    method sample_points_and_latents (line 567) | def sample_points_and_latents(self, pc: torch.FloatTensor, feats: Opti...
    method forward (line 681) | def forward(self, pc, feats):

FILE: ultrashape/models/autoencoders/attention_processors.py
  class CrossAttentionProcessor (line 36) | class CrossAttentionProcessor:
    method __call__ (line 37) | def __call__(self, attn, q, k, v):
  class FlashVDMCrossAttentionProcessor (line 42) | class FlashVDMCrossAttentionProcessor:
    method __init__ (line 43) | def __init__(self, topk=None):
    method __call__ (line 46) | def __call__(self, attn, q, k, v):
    method select_topkv (line 80) | def select_topkv(self, q_chunk, k, v, topk):
  class FlashVDMTopMCrossAttentionProcessor (line 91) | class FlashVDMTopMCrossAttentionProcessor(FlashVDMCrossAttentionProcessor):
    method select_topkv (line 92) | def select_topkv(self, q_chunk, k, v, topk):

FILE: ultrashape/models/autoencoders/model.py
  class DiagonalGaussianDistribution (line 46) | class DiagonalGaussianDistribution(object):
    method __init__ (line 47) | def __init__(self, parameters: Union[torch.Tensor, List[torch.Tensor]]...
    method sample (line 75) | def sample(self):
    method kl (line 85) | def kl(self, other=None, dims=(1, 2)):
    method nll (line 110) | def nll(self, sample, dims=(1, 2, 3)):
    method mode (line 118) | def mode(self):
  class VectsetVAE (line 122) | class VectsetVAE(nn.Module):
    method from_single_file (line 126) | def from_single_file(
    method from_pretrained (line 166) | def from_pretrained(
    method init_from_ckpt (line 194) | def init_from_ckpt(self, path, ignore_keys=()):
    method __init__ (line 209) | def __init__(
    method latents2mesh (line 222) | def latents2mesh(self, latents: torch.FloatTensor, **kwargs):
    method enable_flashvdm_decoder (line 229) | def enable_flashvdm_decoder(
  class ShapeVAE (line 249) | class ShapeVAE(VectsetVAE):
    method __init__ (line 250) | def __init__(
    method forward (line 340) | def forward(self, latents):
    method encode (line 345) | def encode(self, surface, sample_posterior=True, need_kl=False, need_v...
    method decode (line 361) | def decode(self, latents, voxel_idx=None):
    method query (line 366) | def query(self, latents, queries, voxel_idx=None):

FILE: ultrashape/models/autoencoders/surface_extractors.py
  class Latent2MeshOutput (line 30) | class Latent2MeshOutput:
    method __init__ (line 31) | def __init__(self, mesh_v=None, mesh_f=None):
  function center_vertices (line 36) | def center_vertices(vertices):
  class SurfaceExtractor (line 44) | class SurfaceExtractor:
    method _compute_box_stat (line 45) | def _compute_box_stat(self, bounds: Union[Tuple[float], List[float], f...
    method run (line 70) | def run(self, *args, **kwargs):
    method __call__ (line 81) | def __call__(self, grid_logits, **kwargs):
  function get_sparse_valid_voxels (line 109) | def get_sparse_valid_voxels(grid_logit: torch.Tensor):
  class MCSurfaceExtractor (line 196) | class MCSurfaceExtractor(SurfaceExtractor):
    method run (line 197) | def run(self, grid_logit, *, mc_level, bounds, octree_resolution, **kw...
  class DMCSurfaceExtractor (line 229) | class DMCSurfaceExtractor(SurfaceExtractor):
    method run (line 230) | def run(self, grid_logit, *, octree_resolution, **kwargs):

FILE: ultrashape/models/autoencoders/vae_trainer.py
  function export_to_trimesh (line 16) | def export_to_trimesh(mesh_output):
  class VAETrainer (line 32) | class VAETrainer(pl.LightningModule):
    method __init__ (line 33) | def __init__(
    method init_from_ckpt (line 68) | def init_from_ckpt(self, path, ignore_keys=()):
    method configure_optimizers (line 125) | def configure_optimizers(self) -> Tuple[List, List]:
    method on_train_epoch_start (line 151) | def on_train_epoch_start(self) -> None:
    method forward (line 154) | def forward(self, batch):
    method training_step (line 183) | def training_step(self, batch, batch_idx, optimizer_idx=0):
    method validation_step (line 196) | def validation_step(self, batch, batch_idx, optimizer_idx=0):

FILE: ultrashape/models/autoencoders/volume_decoders.py
  function extract_near_surface_volume_fn (line 36) | def extract_near_surface_volume_fn(input_tensor: torch.Tensor, alpha: fl...
  function generate_dense_grid_points (line 93) | def generate_dense_grid_points(
  class VanillaVolumeDecoder (line 112) | class VanillaVolumeDecoder:
    method __call__ (line 114) | def __call__(
  class HierarchicalVolumeDecoding (line 156) | class HierarchicalVolumeDecoding:
    method __call__ (line 158) | def __call__(
  class FlashVDMVolumeDecoding (line 259) | class FlashVDMVolumeDecoding:
    method __init__ (line 260) | def __init__(self, topk_mode='mean'):
    method __call__ (line 270) | def __call__(

FILE: ultrashape/models/conditioner_mask.py
  function get_1d_sincos_pos_embed_from_grid (line 45) | def get_1d_sincos_pos_embed_from_grid(embed_dim, pos):
  class ImageEncoder (line 65) | class ImageEncoder(nn.Module):
    method __init__ (line 66) | def __init__(
    method forward (line 107) | def forward(self, image, mask=None, value_range=(-1, 1), **kwargs):
    method unconditional_embedding (line 168) | def unconditional_embedding(self, batch_size, **kwargs):
  class CLIPImageEncoder (line 185) | class CLIPImageEncoder(ImageEncoder):
  class DinoImageEncoder (line 192) | class DinoImageEncoder(ImageEncoder):
  class DinoImageEncoderMV (line 198) | class DinoImageEncoderMV(DinoImageEncoder):
    method __init__ (line 199) | def __init__(
    method forward (line 218) | def forward(self, image, mask=None, value_range=(-1, 1), view_idxs=None):
    method unconditional_embedding (line 254) | def unconditional_embedding(self, batch_size, view_idxs=None, **kwargs):
  function build_image_encoder (line 267) | def build_image_encoder(config):
  class DualImageEncoder (line 278) | class DualImageEncoder(nn.Module):
    method __init__ (line 279) | def __init__(
    method forward (line 288) | def forward(self, image, mask=None, **kwargs):
    method unconditional_embedding (line 295) | def unconditional_embedding(self, batch_size, **kwargs):
  class SingleImageEncoder (line 303) | class SingleImageEncoder(nn.Module):
    method __init__ (line 304) | def __init__(
    method forward (line 314) | def forward(self, image, disable_drop=True, mask=None, **kwargs):
    method unconditional_embedding (line 333) | def unconditional_embedding(self, batch_size, **kwargs):

FILE: ultrashape/models/denoisers/dit_mask.py
  function modulate (line 48) | def modulate(x, shift, scale):
  class Timesteps (line 52) | class Timesteps(nn.Module):
    method __init__ (line 53) | def __init__(self,
    method forward (line 65) | def forward(self, timesteps):
  class TimestepEmbedder (line 81) | class TimestepEmbedder(nn.Module):
    method __init__ (line 86) | def __init__(self, hidden_size, frequency_embedding_size=256, cond_pro...
    method forward (line 102) | def forward(self, t, condition):
  class MLP (line 115) | class MLP(nn.Module):
    method __init__ (line 116) | def __init__(self, *, width: int):
    method forward (line 123) | def forward(self, x):
  class CrossAttention (line 127) | class CrossAttention(nn.Module):
    method __init__ (line 128) | def __init__(
    method forward (line 157) | def forward(self, x, y):
  class Attention (line 246) | class Attention(nn.Module):
    method __init__ (line 251) | def __init__(
    method forward (line 276) | def forward(self, x, rotary_cos=None, rotary_sin=None):
  class DiTBlock (line 313) | class DiTBlock(nn.Module):
    method __init__ (line 314) | def __init__(
    method forward (line 380) | def forward(self, x, c=None, text_states=None, skip_value=None, rotary...
  class AttentionPool (line 410) | class AttentionPool(nn.Module):
    method __init__ (line 411) | def __init__(self, spacial_dim: int, embed_dim: int, num_heads: int, o...
    method forward (line 420) | def forward(self, x, attention_mask=None):
  class FinalLayer (line 452) | class FinalLayer(nn.Module):
    method __init__ (line 457) | def __init__(self, final_hidden_size, out_channels):
    method forward (line 463) | def forward(self, x):
  class RefineDiT (line 470) | class RefineDiT(nn.Module):
    method from_single_file (line 474) | def from_single_file(
    method from_pretrained (line 514) | def from_pretrained(
    method __init__ (line 540) | def __init__(
    method forward (line 602) | def forward(self, x, t, contexts, **kwargs):
  function apply_rotary_emb (line 639) | def apply_rotary_emb(x, cos, sin):
  function precompute_freqs_cis_3d (line 655) | def precompute_freqs_cis_3d(dim: int, grid_indices: torch.Tensor, theta:...
  function precompute_freqs_cis_3d_interpolated (line 682) | def precompute_freqs_cis_3d_interpolated(

FILE: ultrashape/models/denoisers/moe_layers.py
  class AddAuxiliaryLoss (line 24) | class AddAuxiliaryLoss(torch.autograd.Function):
    method forward (line 30) | def forward(ctx, x, loss):
    method backward (line 37) | def backward(ctx, grad_output):
  class MoEGate (line 43) | class MoEGate(nn.Module):
    method __init__ (line 44) | def __init__(self, embed_dim, num_experts=16, num_experts_per_tok=2, a...
    method reset_parameters (line 59) | def reset_parameters(self) -> None:
    method forward (line 63) | def forward(self, hidden_states):
  class MoEBlock (line 112) | class MoEBlock(nn.Module):
    method __init__ (line 113) | def __init__(self, dim, num_experts=8, moe_top_k=2,
    method initialize_weight (line 131) | def initialize_weight(self):
    method forward (line 134) | def forward(self, hidden_states):
    method moe_infer (line 157) | def moe_infer(self, x, flat_expert_indices, flat_expert_weights):

FILE: ultrashape/models/diffusion/flow_matching_dit_trainer.py
  class Diffuser (line 18) | class Diffuser(pl.LightningModule):
    method __init__ (line 19) | def __init__(
    method ema_scope (line 122) | def ema_scope(self, context=None):
    method init_from_ckpt (line 136) | def init_from_ckpt(self, path, ignore_keys=()):
    method on_load_checkpoint (line 160) | def on_load_checkpoint(self, checkpoint):
    method configure_optimizers (line 176) | def configure_optimizers(self) -> Tuple[List, List]:
    method on_train_batch_end (line 231) | def on_train_batch_end(self, *args, **kwargs):
    method on_train_epoch_start (line 235) | def on_train_epoch_start(self) -> None:
    method forward (line 238) | def forward(self, batch, disable_drop):
    method training_step (line 254) | def training_step(self, batch, batch_idx, optimizer_idx=0):
    method validation_step (line 265) | def validation_step(self, batch, batch_idx, optimizer_idx=0):
    method sample (line 277) | def sample(self, batch, output_type='trimesh', **kwargs):

FILE: ultrashape/models/diffusion/transport/__init__.py
  function create_transport (line 29) | def create_transport(

FILE: ultrashape/models/diffusion/transport/integrators.py
  class sde (line 33) | class sde:
    method __init__ (line 35) | def __init__(
    method __Euler_Maruyama_step (line 54) | def __Euler_Maruyama_step(self, x, mean_x, t, model, **model_kwargs):
    method __Heun_step (line 64) | def __Heun_step(self, x, _, t, model, **model_kwargs):
    method __forward_fn (line 75) | def __forward_fn(self):
    method sample (line 89) | def sample(self, init, model, **model_kwargs):
  class ode (line 102) | class ode:
    method __init__ (line 104) | def __init__(
    method sample (line 123) | def sample(self, x, model, **model_kwargs):

FILE: ultrashape/models/diffusion/transport/path.py
  function expand_t_like_x (line 30) | def expand_t_like_x(t, x):
  class ICPlan (line 43) | class ICPlan:
    method __init__ (line 45) | def __init__(self, sigma=0.0):
    method compute_alpha_t (line 48) | def compute_alpha_t(self, t):
    method compute_sigma_t (line 52) | def compute_sigma_t(self, t):
    method compute_d_alpha_alpha_ratio_t (line 56) | def compute_d_alpha_alpha_ratio_t(self, t):
    method compute_drift (line 60) | def compute_drift(self, x, t):
    method compute_diffusion (line 70) | def compute_diffusion(self, x, t, form="constant", norm=1.0):
    method get_score_from_velocity (line 95) | def get_score_from_velocity(self, velocity, x, t):
    method get_noise_from_velocity (line 111) | def get_noise_from_velocity(self, velocity, x, t):
    method get_velocity_from_score (line 127) | def get_velocity_from_score(self, score, x, t):
    method compute_mu_t (line 139) | def compute_mu_t(self, t, x0, x1):
    method compute_xt (line 147) | def compute_xt(self, t, x0, x1):
    method compute_ut (line 152) | def compute_ut(self, t, x0, x1, xt):
    method plan (line 159) | def plan(self, t, x0, x1):
  class VPCPlan (line 165) | class VPCPlan(ICPlan):
    method __init__ (line 168) | def __init__(self, sigma_min=0.1, sigma_max=20.0):
    method compute_alpha_t (line 177) | def compute_alpha_t(self, t):
    method compute_sigma_t (line 184) | def compute_sigma_t(self, t):
    method compute_d_alpha_alpha_ratio_t (line 191) | def compute_d_alpha_alpha_ratio_t(self, t):
    method compute_drift (line 195) | def compute_drift(self, x, t):
  class GVPCPlan (line 202) | class GVPCPlan(ICPlan):
    method __init__ (line 203) | def __init__(self, sigma=0.0):
    method compute_alpha_t (line 206) | def compute_alpha_t(self, t):
    method compute_sigma_t (line 212) | def compute_sigma_t(self, t):
    method compute_d_alpha_alpha_ratio_t (line 218) | def compute_d_alpha_alpha_ratio_t(self, t):

FILE: ultrashape/models/diffusion/transport/transport.py
  class ModelType (line 37) | class ModelType(enum.Enum):
  class PathType (line 47) | class PathType(enum.Enum):
  class WeightType (line 57) | class WeightType(enum.Enum):
  class Transport (line 67) | class Transport:
    method __init__ (line 69) | def __init__(
    method prior_logp (line 98) | def prior_logp(self, z):
    method check_interval (line 108) | def check_interval(
    method sample (line 138) | def sample(self, x1):
    method training_losses (line 158) | def training_losses(
    method get_drift (line 202) | def get_drift(
    method get_score (line 237) | def get_score(
  class Sampler (line 256) | class Sampler:
    method __init__ (line 259) | def __init__(
    method __get_sde_diffusion_and_drift (line 272) | def __get_sde_diffusion_and_drift(
    method __get_last_step (line 291) | def __get_last_step(
    method sample_sde (line 324) | def sample_sde(
    method sample_ode (line 385) | def sample_ode(
    method sample_ode_intermediate (line 430) | def sample_ode_intermediate(
    method sample_ode_likelihood (line 476) | def sample_ode_likelihood(

FILE: ultrashape/models/diffusion/transport/utils.py
  class EasyDict (line 28) | class EasyDict:
    method __init__ (line 30) | def __init__(self, sub_dict):
    method __getitem__ (line 34) | def __getitem__(self, key):
  function mean_flat (line 37) | def mean_flat(x):
  function log_state (line 43) | def log_state(state):

FILE: ultrashape/pipelines.py
  function retrieve_timesteps (line 42) | def retrieve_timesteps(
  function export_to_trimesh (line 102) | def export_to_trimesh(mesh_output):
  function get_obj_from_str (line 119) | def get_obj_from_str(string, reload=False):
  function instantiate_from_config (line 127) | def instantiate_from_config(config, **kwargs):
  class DiTPipeline (line 137) | class DiTPipeline:
    method from_single_file (line 143) | def from_single_file(
    method from_pretrained (line 203) | def from_pretrained(
    method __init__ (line 236) | def __init__(
    method compile (line 268) | def compile(self):
    method enable_flashvdm (line 273) | def enable_flashvdm(
    method to (line 291) | def to(self, device=None, dtype=None):
    method _execution_device (line 304) | def _execution_device(self):
    method enable_model_cpu_offload (line 325) | def enable_model_cpu_offload(self, gpu_id: Optional[int] = None, devic...
    method maybe_free_model_hooks (line 399) | def maybe_free_model_hooks(self):
    method encode_cond (line 419) | def encode_cond(self, image, additional_cond_inputs, do_classifier_fre...
    method prepare_extra_step_kwargs (line 453) | def prepare_extra_step_kwargs(self, generator, eta):
    method prepare_latents (line 470) | def prepare_latents(self, batch_size, dtype, device, generator, latent...
    method prepare_image (line 490) | def prepare_image(self, image, mask=None) -> dict:
    method get_guidance_scale_embedding (line 519) | def get_guidance_scale_embedding(self, w, embedding_dim=512, dtype=tor...
    method set_surface_extractor (line 547) | def set_surface_extractor(self, mc_algo):
    method __call__ (line 559) | def __call__(
    method _export (line 659) | def _export(
  class UltraShapePipeline (line 691) | class UltraShapePipeline(DiTPipeline):
    method __call__ (line 694) | def __call__(

FILE: ultrashape/postprocessors.py
  function load_mesh (line 35) | def load_mesh(path):
  function reduce_face (line 44) | def reduce_face(mesh: pymeshlab.MeshSet, max_facenum: int = 200000):
  function remove_floater (line 61) | def remove_floater(mesh: pymeshlab.MeshSet):
  function pymeshlab2trimesh (line 69) | def pymeshlab2trimesh(mesh: pymeshlab.MeshSet):
  function trimesh2pymeshlab (line 83) | def trimesh2pymeshlab(mesh: trimesh.Trimesh):
  function export_mesh (line 98) | def export_mesh(input, output):
  function import_mesh (line 111) | def import_mesh(mesh: Union[pymeshlab.MeshSet, trimesh.Trimesh, Latent2M...
  class FaceReducer (line 125) | class FaceReducer:
    method __call__ (line 127) | def __call__(
  class FloaterRemover (line 138) | class FloaterRemover:
    method __call__ (line 140) | def __call__(
  class DegenerateFaceRemover (line 150) | class DegenerateFaceRemover:
    method __call__ (line 152) | def __call__(
  function mesh_normalize (line 167) | def mesh_normalize(mesh):
  class MeshSimplifier (line 186) | class MeshSimplifier:
    method __init__ (line 187) | def __init__(self, executable: str = None):
    method __call__ (line 194) | def __call__(

FILE: ultrashape/preprocessors.py
  function array_to_tensor (line 22) | def array_to_tensor(np_array):
  class ImageProcessorV2 (line 30) | class ImageProcessorV2:
    method __init__ (line 31) | def __init__(self, size=512, border_ratio=None):
    method recenter (line 36) | def recenter(image, border_ratio: float = 0.2):
    method load_image (line 90) | def load_image(self, image, border_ratio=0.15, to_tensor=True):
    method __call__ (line 109) | def __call__(self, image, border_ratio=0.15, to_tensor=True, **kwargs):
  class MVImageProcessorV2 (line 120) | class MVImageProcessorV2(ImageProcessorV2):
    method __init__ (line 126) | def __init__(self, size=512, border_ratio=None):
    method __call__ (line 135) | def __call__(self, image_dict, border_ratio=0.15, to_tensor=True, **kw...

FILE: ultrashape/rembg.py
  class BackgroundRemover (line 26) | class BackgroundRemover():
    method __init__ (line 27) | def __init__(self):
    method __call__ (line 30) | def __call__(self, image: Image.Image):

FILE: ultrashape/schedulers.py
  class FlowMatchEulerDiscreteSchedulerOutput (line 43) | class FlowMatchEulerDiscreteSchedulerOutput(BaseOutput):
  class FlowMatchEulerDiscreteScheduler (line 56) | class FlowMatchEulerDiscreteScheduler(SchedulerMixin, ConfigMixin):
    method __init__ (line 79) | def __init__(
    method step_index (line 103) | def step_index(self):
    method begin_index (line 110) | def begin_index(self):
    method set_begin_index (line 117) | def set_begin_index(self, begin_index: int = 0):
    method scale_noise (line 127) | def scale_noise(
    method _sigma_to_t (line 175) | def _sigma_to_t(self, sigma):
    method time_shift (line 178) | def time_shift(self, mu: float, sigma: float, t: torch.Tensor):
    method set_timesteps (line 181) | def set_timesteps(
    method index_for_timestep (line 223) | def index_for_timestep(self, timestep, schedule_timesteps=None):
    method _init_step_index (line 237) | def _init_step_index(self, timestep):
    method step (line 245) | def step(
    method __len__ (line 320) | def __len__(self):
  class ConsistencyFlowMatchEulerDiscreteSchedulerOutput (line 325) | class ConsistencyFlowMatchEulerDiscreteSchedulerOutput(BaseOutput):
  class ConsistencyFlowMatchEulerDiscreteScheduler (line 330) | class ConsistencyFlowMatchEulerDiscreteScheduler(SchedulerMixin, ConfigM...
    method __init__ (line 335) | def __init__(
    method step_index (line 355) | def step_index(self):
    method begin_index (line 362) | def begin_index(self):
    method set_begin_index (line 369) | def set_begin_index(self, begin_index: int = 0):
    method _sigma_to_t (line 379) | def _sigma_to_t(self, sigma):
    method set_timesteps (line 382) | def set_timesteps(
    method index_for_timestep (line 414) | def index_for_timestep(self, timestep, schedule_timesteps=None):
    method _init_step_index (line 428) | def _init_step_index(self, timestep):
    method step (line 436) | def step(
    method __len__ (line 479) | def __len__(self):

FILE: ultrashape/surface_loaders.py
  function normalize_mesh (line 20) | def normalize_mesh(mesh, scale=0.9999):
  function sample_pointcloud (line 44) | def sample_pointcloud(mesh, num=200000):
  function load_surface (line 64) | def load_surface(mesh, num_points=8192):
  function sharp_sample_pointcloud (line 92) | def sharp_sample_pointcloud(mesh, num=16384):
  function load_surface_sharpegde (line 141) | def load_surface_sharpegde(mesh, num_points=4096, num_sharp_points=4096,...
  class SurfaceLoader (line 186) | class SurfaceLoader:
    method __init__ (line 187) | def __init__(self, num_points=8192):
    method __call__ (line 190) | def __call__(self, mesh_or_mesh_path, num_points=None):
  class SharpEdgeSurfaceLoader (line 208) | class SharpEdgeSurfaceLoader:
    method __init__ (line 209) | def __init__(self, num_uniform_points=8192, num_sharp_points=8192, **k...
    method __call__ (line 214) | def __call__(self, mesh_or_mesh_path, num_uniform_points=None,

FILE: ultrashape/utils/ema.py
  class LitEma (line 5) | class LitEma(nn.Module):
    method __init__ (line 6) | def __init__(self, model, decay=0.9999, use_num_updates=True):
    method forward (line 25) | def forward(self, model):
    method copy_to (line 46) | def copy_to(self, model):
    method store (line 55) | def store(self, model):
    method restore (line 64) | def restore(self, model):

FILE: ultrashape/utils/misc.py
  function get_config_from_file (line 13) | def get_config_from_file(config_file: str) -> Union[DictConfig, ListConf...
  function get_obj_from_str (line 32) | def get_obj_from_str(string, reload=False):
  function get_obj_from_config (line 40) | def get_obj_from_config(config):
  function instantiate_from_config (line 47) | def instantiate_from_config(config, **kwargs):
  function instantiate_vae_from_config (line 68) | def instantiate_vae_from_config(config, **kwargs):
  function instantiate_vae_from_config_local (line 87) | def instantiate_vae_from_config_local(config, **kwargs):
  function disabled_train (line 123) | def disabled_train(self, mode=True):
  function instantiate_non_trainable_model (line 129) | def instantiate_non_trainable_model(config):
  function instantiate_vae_model (line 139) | def instantiate_vae_model(config, requires_grad=False):
  function instantiate_vae_model_local (line 148) | def instantiate_vae_model_local(config, requires_grad=False):
  function is_dist_avail_and_initialized (line 157) | def is_dist_avail_and_initialized():
  function get_rank (line 165) | def get_rank():
  function get_world_size (line 171) | def get_world_size():
  function all_gather_batch (line 177) | def all_gather_batch(tensors):

FILE: ultrashape/utils/trainings/callback.py
  function node_zero_only (line 27) | def node_zero_only(fn: Callable) -> Callable:
  function node_zero_experiment (line 37) | def node_zero_experiment(fn: Callable) -> Callable:
  class MyWandbLogger (line 48) | class MyWandbLogger(WandbLogger):
    method experiment (line 51) | def experiment(self):
  class SetupCallback (line 54) | class SetupCallback(Callback):
    method __init__ (line 55) | def __init__(self, config: DictConfig, exp_config: DictConfig,
    method on_fit_start (line 75) | def on_fit_start(self, trainer: pl.trainer.Trainer, pl_module: pl.Ligh...
  class ImageLogger (line 88) | class ImageLogger(Callback):
    method __init__ (line 89) | def __init__(self, batch_frequency: int, max_images: int, clamp: bool ...
    method _wandb (line 105) | def _wandb(self, pl_module, images, batch_idx, split):
    method _testtube (line 114) | def _testtube(self, pl_module, images, batch_idx, split):
    method log_local (line 125) | def log_local(self, save_dir: str, split: str, images: Dict,
    method log_img (line 144) | def log_img(self, pl_module: pl.LightningModule, batch: Tuple[torch.Lo...
    method check_frequency (line 174) | def check_frequency(self, batch_idx: int) -> bool:
    method on_train_batch_end (line 183) | def on_train_batch_end(self, trainer: pl.trainer.Trainer, pl_module: p...
    method on_validation_batch_end (line 187) | def on_validation_batch_end(self, trainer: pl.trainer.Trainer, pl_modu...
  class CUDACallback (line 193) | class CUDACallback(Callback):
    method on_train_epoch_start (line 195) | def on_train_epoch_start(self, trainer, pl_module):
    method on_train_epoch_end (line 201) | def on_train_epoch_end(self, trainer, pl_module, outputs):

FILE: ultrashape/utils/trainings/lr_scheduler.py
  class BaseScheduler (line 18) | class BaseScheduler(object):
    method schedule (line 20) | def schedule(self, n, **kwargs):
  class LambdaWarmUpCosineFactorScheduler (line 24) | class LambdaWarmUpCosineFactorScheduler(BaseScheduler):
    method __init__ (line 28) | def __init__(self, warm_up_steps, f_min, f_max, f_start, max_decay_ste...
    method schedule (line 37) | def schedule(self, n, **kwargs):
    method __call__ (line 52) | def __call__(self, n, **kwargs):

FILE: ultrashape/utils/trainings/mesh.py
  function save_obj (line 26) | def save_obj(pointnp_px3, facenp_fx3, fname):
  function savemeshtes2 (line 41) | def savemeshtes2(pointnp_px3, tcoords_px2, facenp_fx3, facetex_fx3, tex_...
  class MeshOutput (line 81) | class MeshOutput(object):
    method __init__ (line 83) | def __init__(self,
    method contain_uv_texture (line 98) | def contain_uv_texture(self):
    method contain_vertex_colors (line 101) | def contain_vertex_colors(self):
    method export (line 104) | def export(self, fname):

FILE: ultrashape/utils/trainings/mesh_log_callback.py
  class ImageConditionalASLDiffuserLogger (line 37) | class ImageConditionalASLDiffuserLogger(Callback):
    method __init__ (line 38) | def __init__(self,
    method _wandb (line 68) | def _wandb(self, pl_module, images, batch_idx, split):
    method log_local (line 76) | def log_local(self,
    method log_sample (line 144) | def log_sample(self,
    method make_grid (line 211) | def make_grid(self, images):  # return (3,h,w) in (0,1) ...
    method check_frequency (line 224) | def check_frequency(self, step: int) -> bool:
    method on_train_batch_end (line 229) | def on_train_batch_end(self, trainer: pl.trainer.Trainer, pl_module: p...
    method on_validation_batch_end (line 239) | def on_validation_batch_end(self, trainer: pl.trainer.Trainer, pl_modu...
    method denormalize_image (line 247) | def denormalize_image(self, image):
  class ImageConditionalFixASLDiffuserLogger (line 270) | class ImageConditionalFixASLDiffuserLogger(Callback):
    method __init__ (line 271) | def __init__(
    method on_train_batch_end (line 293) | def on_train_batch_end(

FILE: ultrashape/utils/trainings/peft.py
  class PeftSaveCallback (line 21) | class PeftSaveCallback(Callback):
    method __init__ (line 22) | def __init__(self, peft_model, save_dir: str, save_every_n_steps: int ...
    method recursive_convert (line 29) | def recursive_convert(self, obj):
    method _convert_peft_config (line 61) | def _convert_peft_config(self):
    method on_train_epoch_end (line 65) | def on_train_epoch_end(self, trainer, pl_module):
    method on_train_batch_end (line 71) | def on_train_batch_end(self, trainer, pl_module, outputs, batch, batch...

FILE: ultrashape/utils/utils.py
  function get_logger (line 22) | def get_logger(name):
  class synchronize_timer (line 38) | class synchronize_timer:
    method __init__ (line 57) | def __init__(self, name=None):
    method __enter__ (line 60) | def __enter__(self):
    method __exit__ (line 68) | def __exit__(self, exc_type, exc_value, exc_tb):
    method __call__ (line 77) | def __call__(self, func):
  function smart_load_model (line 89) | def smart_load_model(

FILE: ultrashape/utils/visualizers/color_util.py
  function get_colors (line 20) | def get_colors(inp, colormap="viridis", normalize=True, vmin=None, vmax=...
  function gen_checkers (line 30) | def gen_checkers(n_checkers_x, n_checkers_y, width=256, height=256):
  function gen_circle (line 48) | def gen_circle(width=256, height=256):

FILE: ultrashape/utils/visualizers/html_util.py
  function to_html_frame (line 23) | def to_html_frame(content):
  function to_single_row_table (line 36) | def to_single_row_table(caption: str, content: str):
  function to_image_embed_tag (line 50) | def to_image_embed_tag(image: np.ndarray):

FILE: ultrashape/utils/visualizers/pythreejs_viewer.py
  class PyThreeJSViewer (line 27) | class PyThreeJSViewer(object):
    method __init__ (line 29) | def __init__(self, settings, render_mode="WEBSITE"):
    method jupyter_mode (line 45) | def jupyter_mode(self):
    method offline (line 48) | def offline(self):
    method website (line 51) | def website(self):
    method __get_shading (line 54) | def __get_shading(self, shading):
    method __update_settings (line 66) | def __update_settings(self, settings={}):
    method __add_object (line 73) | def __add_object(self, obj, parent=None):
    method __add_line_geometry (line 88) | def __add_line_geometry(self, lines, shading, obj=None):
    method __update_view (line 105) | def __update_view(self):
    method __get_bbox (line 126) | def __get_bbox(self, v):
    method __get_colors (line 138) | def __get_colors(self, v, f, c, sh):
    method __get_point_colors (line 186) | def __get_point_colors(self, v, c, sh):
    method add_mesh (line 222) | def add_mesh(self, v, f, c=None, uv=None, n=None, shading={}, texture_...
    method add_lines (line 322) | def add_lines(self, beginning, ending, shading={}, obj=None, **kwargs):
    method add_edges (line 344) | def add_edges(self, vertices, edges, shading={}, obj=None, **kwargs):
    method add_points (line 358) | def add_points(self, points, c=None, shading={}, obj=None, **kwargs):
    method remove_object (line 402) | def remove_object(self, obj_id):
    method reset (line 410) | def reset(self):
    method update_object (line 416) | def update_object(self, oid=0, vertices=None, colors=None, faces=None):
    method add_text (line 462) | def add_text(self, text, shading={}, **kwargs):
    method to_html (line 486) | def to_html(self, imports=True, html_frame=True):
    method save (line 541) | def save(self, filename=""):

FILE: ultrashape/utils/voxelize.py
  function voxelize_from_point (line 3) | def voxelize_from_point(pc, num_latents, resolution=128):
Condensed preview — 70 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (615K chars).
[
  {
    "path": ".gitignore",
    "chars": 3441,
    "preview": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packagi"
  },
  {
    "path": "LICENSE",
    "chars": 15801,
    "preview": "TENCENT HUNYUAN 3D 2.1 COMMUNITY LICENSE AGREEMENT\nTencent Hunyuan 3D 2.1 Release Date: June 13, 2025\nTHIS LICENSE AGREE"
  },
  {
    "path": "Notice.txt",
    "chars": 16641,
    "preview": "Usage and Legal Notices:\n\nTencent is pleased to support the open source community by making Hunyuan 3D 2.1 available.\n\nC"
  },
  {
    "path": "README.md",
    "chars": 6402,
    "preview": "<div align=\"center\">\n\n<h1>UltraShape 1.0: High-Fidelity 3D Shape Generation via Scalable Geometric Refinement</h1>\n\n<a h"
  },
  {
    "path": "configs/infer_dit_refine.yaml",
    "chars": 2022,
    "preview": "model:\n  target: ultrashape.pipelines.UltraShapePipeline\n  params:\n    # 1. VAE Config\n    vae_config:\n      target: ult"
  },
  {
    "path": "configs/train_dit_refine.yaml",
    "chars": 3580,
    "preview": "name: \"UltraShape Refine DiT\"\n\ntraining:\n  # ckpt_path:\n  steps: 10_0000_0000\n  use_amp: true\n  amp_type: \"bf16\"\n  base_"
  },
  {
    "path": "configs/train_vae_refine.yaml",
    "chars": 2138,
    "preview": "name: \"UltraShape Refine VAE\"\n\ntraining:\n  # ckpt_path: \n  steps: 10_0000_0000\n  use_amp: true\n  amp_type: \"bf16\"\n  base"
  },
  {
    "path": "docs/carousel.css",
    "chars": 2119,
    "preview": ".x-carousel-tags {\n    width: 100%;\n    display: flex;\n    align-items: center;\n    justify-content: left;\n    flex-wrap"
  },
  {
    "path": "docs/carousel.js",
    "chars": 8410,
    "preview": "/**\n * Carousel functionality for research project page\n * Handles navigation, filtering, and page indicators for carous"
  },
  {
    "path": "docs/index copy.html",
    "chars": 45204,
    "preview": "<html lang=\"en\"><head><style type=\"text/css\">\n.anticon {\n  display: inline-block;\n  color: inherit;\n  font-style: normal"
  },
  {
    "path": "docs/index.html",
    "chars": 51966,
    "preview": "<html lang=\"en\"><head><style type=\"text/css\">\n.anticon {\n  display: inline-block;\n  color: inherit;\n  font-style: normal"
  },
  {
    "path": "docs/main.css",
    "chars": 12547,
    "preview": "* {\n    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n}\n\na {\n    color: #5b6acf;\n    text-decoration: no"
  },
  {
    "path": "docs/pv.css",
    "chars": 1384,
    "preview": ".pv-video-wrapper {\n    position: relative;\n    width: 100%;\n    aspect-ratio: 16 / 9;\n    margin: 0 auto;\n    backgroun"
  },
  {
    "path": "docs/style.css",
    "chars": 129,
    "preview": "/* Icomoon font removed - now using Material Icons via CDN */\n/* Material Icons are loaded in index.html via Google Font"
  },
  {
    "path": "docs/stylesheet.css",
    "chars": 203,
    "preview": "/* Font definitions removed - using system Segoe UI font */\n/* All font-face declarations for Avenir Next Cyr have been "
  },
  {
    "path": "docs/window.css",
    "chars": 3581,
    "preview": "#fullscreen {\n    position: fixed;\n    top: 0;\n    left: 0;\n    width: 100vw;\n    height: 100vh;\n    background: transpa"
  },
  {
    "path": "main.py",
    "chars": 8708,
    "preview": "# ==============================================================================\n# Original work Copyright (c) 2025 Tenc"
  },
  {
    "path": "requirements.txt",
    "chars": 586,
    "preview": "accelerate==1.1.1\ndiffusers==0.30.0\ndeepspeed\ndiso==0.1.4\neinops==0.8.1\nflash_attn==2.8.3\nhuggingface_hub==0.36.0\nimagei"
  },
  {
    "path": "scripts/gradio_app.py",
    "chars": 7848,
    "preview": "import argparse\nimport gc\nimport os\nimport sys\n\nimport gradio as gr\nimport torch\nfrom omegaconf import OmegaConf\n\n# Add "
  },
  {
    "path": "scripts/infer_dit_refine.py",
    "chars": 5310,
    "preview": "import os\nimport sys\nimport argparse\nimport torch\nimport numpy as np\nfrom PIL import Image\nfrom omegaconf import OmegaCo"
  },
  {
    "path": "scripts/install_env.sh",
    "chars": 498,
    "preview": "conda create -n ultrashape python=3.10\nconda activate ultrashape \npip install torch==2.5.1 torchvision==0.20.1 torchaudi"
  },
  {
    "path": "scripts/run.sh",
    "chars": 349,
    "preview": "# sampling \n# python scripts/sampling.py \\\n#     --mesh_json data/mesh_paths.json \\\n#     --output_dir data/sample\n\n# in"
  },
  {
    "path": "scripts/sampling.py",
    "chars": 22933,
    "preview": "import os\nimport trimesh\nimport numpy as np\nfrom typing import List, Optional, Any, Tuple, Union\nimport pytorch_lightnin"
  },
  {
    "path": "scripts/train_deepspeed.sh",
    "chars": 1488,
    "preview": "\nexport NCCL_IB_TIMEOUT=24\nexport NCCL_NVLS_ENABLE=0\nNET_TYPE=\"high\"\nif [[ \"${NET_TYPE}\" = \"low\" ]]; then\n    export NCC"
  },
  {
    "path": "train.sh",
    "chars": 633,
    "preview": "export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7\nexport num_gpu_per_node=8\n\nexport node_num=1\nexport node_rank=$1\nexport mast"
  },
  {
    "path": "ultrashape/__init__.py",
    "chars": 1145,
    "preview": "# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT\n# except for the third-party compone"
  },
  {
    "path": "ultrashape/data/objaverse_dit.py",
    "chars": 12672,
    "preview": "# -*- coding: utf-8 -*-\n\n# ==============================================================================\n# Original wor"
  },
  {
    "path": "ultrashape/data/objaverse_vae.py",
    "chars": 10746,
    "preview": "# -*- coding: utf-8 -*-\n\n# ==============================================================================\n# Original wor"
  },
  {
    "path": "ultrashape/data/utils.py",
    "chars": 5641,
    "preview": "# -*- coding: utf-8 -*-\n\n# ==============================================================================\n# Original wor"
  },
  {
    "path": "ultrashape/models/__init__.py",
    "chars": 1666,
    "preview": "# Open Source Model Licensed under the Apache License Version 2.0\n# and Other Licenses of the Third-Party Components the"
  },
  {
    "path": "ultrashape/models/autoencoders/__init__.py",
    "chars": 1396,
    "preview": "# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT\n# except for the third-party compone"
  },
  {
    "path": "ultrashape/models/autoencoders/attention_blocks.py",
    "chars": 26683,
    "preview": "# ==============================================================================\n# Original work Copyright (c) 2025 Tenc"
  },
  {
    "path": "ultrashape/models/autoencoders/attention_processors.py",
    "chars": 4214,
    "preview": "# ==============================================================================\n# Original work Copyright (c) 2025 Tenc"
  },
  {
    "path": "ultrashape/models/autoencoders/model.py",
    "chars": 13750,
    "preview": "# ==============================================================================\n# Original work Copyright (c) 2025 Tenc"
  },
  {
    "path": "ultrashape/models/autoencoders/surface_extractors.py",
    "chars": 10887,
    "preview": "# ==============================================================================\n# Original work Copyright (c) 2025 Tenc"
  },
  {
    "path": "ultrashape/models/autoencoders/vae_trainer.py",
    "chars": 8957,
    "preview": "import os\nfrom contextlib import contextmanager\nfrom typing import List, Tuple, Optional, Union\n\nimport torch\nimport tor"
  },
  {
    "path": "ultrashape/models/autoencoders/volume_decoders.py",
    "chars": 18629,
    "preview": "# ==============================================================================\n# Original work Copyright (c) 2025 Tenc"
  },
  {
    "path": "ultrashape/models/conditioner_mask.py",
    "chars": 12798,
    "preview": "# ==============================================================================\n# Original work Copyright (c) 2025 Tenc"
  },
  {
    "path": "ultrashape/models/denoisers/__init__.py",
    "chars": 1255,
    "preview": "# ==============================================================================\n# Original work Copyright (c) 2025 Tenc"
  },
  {
    "path": "ultrashape/models/denoisers/dit_mask.py",
    "chars": 25967,
    "preview": "# ==============================================================================\n# Original work Copyright (c) 2025 Tenc"
  },
  {
    "path": "ultrashape/models/denoisers/moe_layers.py",
    "chars": 7833,
    "preview": "# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT\n# except for the third-party compone"
  },
  {
    "path": "ultrashape/models/diffusion/flow_matching_dit_trainer.py",
    "chars": 13487,
    "preview": "\nimport os\nfrom contextlib import contextmanager\nfrom typing import List, Tuple, Optional, Union\n\nimport torch\nimport to"
  },
  {
    "path": "ultrashape/models/diffusion/transport/__init__.py",
    "chars": 3462,
    "preview": "# This file includes code derived from the SiT project (https://github.com/willisma/SiT),\n# which is licensed under the "
  },
  {
    "path": "ultrashape/models/diffusion/transport/integrators.py",
    "chars": 4810,
    "preview": "# This file includes code derived from the SiT project (https://github.com/willisma/SiT),\n# which is licensed under the "
  },
  {
    "path": "ultrashape/models/diffusion/transport/path.py",
    "chars": 8325,
    "preview": "# This file includes code derived from the SiT project (https://github.com/willisma/SiT),\n# which is licensed under the "
  },
  {
    "path": "ultrashape/models/diffusion/transport/transport.py",
    "chars": 18017,
    "preview": "# This file includes code derived from the SiT project (https://github.com/willisma/SiT),\n# which is licensed under the "
  },
  {
    "path": "ultrashape/models/diffusion/transport/utils.py",
    "chars": 2025,
    "preview": "# This file includes code derived from the SiT project (https://github.com/willisma/SiT),\n# which is licensed under the "
  },
  {
    "path": "ultrashape/pipelines.py",
    "chars": 32435,
    "preview": "# ==============================================================================\n# Original work Copyright (c) 2025 Tenc"
  },
  {
    "path": "ultrashape/postprocessors.py",
    "chars": 7319,
    "preview": "# ==============================================================================\n# Original work Copyright (c) 2025 Tenc"
  },
  {
    "path": "ultrashape/preprocessors.py",
    "chars": 5992,
    "preview": "# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT\n# except for the third-party compone"
  },
  {
    "path": "ultrashape/rembg.py",
    "chars": 1521,
    "preview": "# ==============================================================================\n# Original work Copyright (c) 2025 Tenc"
  },
  {
    "path": "ultrashape/schedulers.py",
    "chars": 19141,
    "preview": "# Copyright 2024 Stability AI, Katherine Crowson and The HuggingFace Team. All rights reserved.\n#\n# Licensed under the A"
  },
  {
    "path": "ultrashape/surface_loaders.py",
    "chars": 9403,
    "preview": "# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT\n# except for the third-party compone"
  },
  {
    "path": "ultrashape/utils/__init__.py",
    "chars": 223,
    "preview": "# -*- coding: utf-8 -*-\n\nfrom .misc import get_config_from_file\nfrom .misc import instantiate_from_config\nfrom .utils im"
  },
  {
    "path": "ultrashape/utils/ema.py",
    "chars": 2982,
    "preview": "import torch\nfrom torch import nn\n\n\nclass LitEma(nn.Module):\n    def __init__(self, model, decay=0.9999, use_num_updates"
  },
  {
    "path": "ultrashape/utils/misc.py",
    "chars": 5810,
    "preview": "# -*- coding: utf-8 -*-\n\nimport importlib\nfrom omegaconf import OmegaConf, DictConfig, ListConfig\n\nimport torch\nimport t"
  },
  {
    "path": "ultrashape/utils/trainings/__init__.py",
    "chars": 24,
    "preview": "# -*- coding: utf-8 -*-\n"
  },
  {
    "path": "ultrashape/utils/trainings/callback.py",
    "chars": 8407,
    "preview": "# ------------------------------------------------------------------------------------\n# Modified from Taming Transforme"
  },
  {
    "path": "ultrashape/utils/trainings/lr_scheduler.py",
    "chars": 2268,
    "preview": "# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT\n# except for the third-party compone"
  },
  {
    "path": "ultrashape/utils/trainings/mesh.py",
    "chars": 3928,
    "preview": "# -*- coding: utf-8 -*-\n\n# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT\n# except fo"
  },
  {
    "path": "ultrashape/utils/trainings/mesh_log_callback.py",
    "chars": 13049,
    "preview": "# -*- coding: utf-8 -*-\n\n# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT\n# except fo"
  },
  {
    "path": "ultrashape/utils/trainings/peft.py",
    "chars": 3669,
    "preview": "# -*- coding: utf-8 -*-\n\n# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT\n# except fo"
  },
  {
    "path": "ultrashape/utils/typing.py",
    "chars": 1095,
    "preview": "\"\"\"\nThis module contains type annotations for the project, using\n1. Python type hints (https://docs.python.org/3/library"
  },
  {
    "path": "ultrashape/utils/utils.py",
    "chars": 4572,
    "preview": "# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT\n# except for the third-party compone"
  },
  {
    "path": "ultrashape/utils/visualizers/__init__.py",
    "chars": 24,
    "preview": "# -*- coding: utf-8 -*-\n"
  },
  {
    "path": "ultrashape/utils/visualizers/color_util.py",
    "chars": 2215,
    "preview": "# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT\n# except for the third-party compone"
  },
  {
    "path": "ultrashape/utils/visualizers/html_util.py",
    "chars": 1809,
    "preview": "# -*- coding: utf-8 -*-\n\n# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT\n# except fo"
  },
  {
    "path": "ultrashape/utils/visualizers/pythreejs_viewer.py",
    "chars": 24165,
    "preview": "# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT\n# except for the third-party compone"
  },
  {
    "path": "ultrashape/utils/voxelize.py",
    "chars": 3123,
    "preview": "import torch\n\ndef voxelize_from_point(pc, num_latents, resolution=128):\n\n    B, N, D = pc.shape\n    device = pc.device\n "
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the PKU-YuanGroup/UltraShape-1.0 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 70 files (25.7 MB), approximately 139.8k tokens, and a symbol index with 502 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!