# Supplementary Code (CVPR Submission)

This repository contains the supplementary code for our CVPR submission.

The project consists of:

- **Stage1** – generating Inflated Priors from 2D inputs  
- **Stage2** – final demo based on the Inflated Priors (using the `Hunyuan3D-2.1` baseline)  
- **metric** – metric computation script  
- **demo** – example images and meshes  

---

## 1. Setup

From the repository root:

```bash
# 1) Download baseline code and patch it with our modifications
bash setting.sh

# 2) Create/prepare the conda environment and install all dependencies
bash install.sh
```

The scripts assume:

- `conda` is available  
- Python version in the environment is **3.10**  
- The conda environment name is **`revive3d`**

**Note**: install.sh installs PyTorch CUDA 12.4 wheels
(torch==2.5.1, torchvision==0.20.1, torchaudio==2.5.1 with cu124).
If your system uses a different CUDA version (or CPU-only), please edit the
corresponding pip install torch ... line in install.sh accordingly.

To activate the environment later:

```bash
conda activate revive3d
```

---

## 2. Stage1: Inflated Prior Demo

Before running Stage1, download the SAM2 checkpoint `sam2.1_hiera_large.pt` from the official SAM2 repository (see: https://github.com/facebookresearch/sam2) and set the `sam2_checkpoint` path in the `inflate.py` code to the location where you saved the file, for example:

```python
sam2_checkpoint = "/path/to/sam2.1_hiera_large.pt"
```

From the repository root:

```bash
conda activate revive3d
cd Stage1
python stage1.py
```

Inflated priors are saved under:

```text
demo/outputs
```

Precomputed results for the demo are stored under:

```text
demo/objs
```

---

## 3. Stage2: Final Demo

From the repository root:

```bash
conda activate revive3d
cd Stage2
python demo_one.py
```

This uses:

- our code in `Stage2`, and  
- the `hy3dshape` folder prepared by `setting.sh`.
- the demo inputs under `demo/imgs` and `demo/objs`.

The resulting meshes are saved under:
```text
demo/outputs
```

---

## 4. References

- **Hunyuan3D 2.1**  
  *Hunyuan3D 2.1: From Images to High-Fidelity 3D Assets with Production-Ready PBR Material*  
  Tencent Hunyuan3D Team, 2025.

- **SAM 2**  
  *SAM 2: Segment Anything in Images and Videos*  
  Nikhila Ravi et al., 2024.

- **Monster Mash**  
  *Monster Mash: A Single-View Approach to Casual 3D Modeling and Animation*  
  Marek Dvorožňák et al., 2020.