/MeshAnythingV2

From anything to mesh like human artists. Official impl. of "MeshAnything V2: Artist-Created Mesh Generation With Adjacent Mesh Tokenization"

Primary LanguagePythonMIT LicenseMIT

MeshAnything V2:
Artist-Created Mesh Generation
With Adjacent Mesh Tokenization

Yiwen Chen1, Yikai Wang2*, Yihao Luo3, Zhengyi Wang2,
Zilong Chen2, Jun Zhu2, Chi Zhang4*, Guosheng Lin1*
*Corresponding authors.
1Nanyang Technological University, 2Tsinghua University,
3Imperial College London, 4Westlake University

              

Demo GIF

Contents

Installation

Our environment has been tested on Ubuntu 22, CUDA 11.8 with A800.

  1. Clone our repo and create conda environment
git clone https://github.com/buaacyw/MeshAnythingV2.git && cd MeshAnythingV2
conda create -n MeshAnythingV2 python==3.10.13 -y
conda activate MeshAnythingV2
pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt
pip install flash-attn --no-build-isolation
pip install -U gradio

Usage

Local Gradio Demo

python app.py

Mesh Command line inference

# folder input
python main.py --input_dir examples --out_dir mesh_output --input_type mesh

# single file input
python main.py --input_path examples/wand.obj --out_dir mesh_output --input_type mesh

# Preprocess with Marching Cubes first
python main.py --input_dir examples --out_dir mesh_output --input_type mesh --mc

Point Cloud Command line inference

# Note: if you want to use your own point cloud, please make sure the normal is included.
# The file format should be a .npy file with shape (N, 6), where N is the number of points. The first 3 columns are the coordinates, and the last 3 columns are the normal.

# inference for folder
python main.py --input_dir pc_examples --out_dir pc_output --input_type pc_normal

# inference for single file
python main.py --input_path pc_examples/mouse.npy --out_dir pc_output --input_type pc_normal

Important Notes

  • It takes about 8GB and 45s to generate a mesh on an A6000 GPU (depending on the face number of the generated mesh).
  • We suggest using Rodin to first achieve text or image to dense mesh. And then use MeshAnything to obtain Artist-Created Mesh from dense mesh.
  • The input mesh will be normalized to a unit bounding box. The up vector of the input mesh should be +Y for better results.
  • Limited by computational resources, MeshAnything is trained on meshes with fewer than 1600 faces and cannot generate meshes with more than 1600 faces. The shape of the input mesh should be sharp enough; otherwise, it will be challenging to represent it with only 1600 faces. Thus, feed-forward 3D generation methods may often produce bad results due to insufficient shape quality. We suggest using results from 3D reconstruction, scanning, SDS-based method (like DreamCraft3D) or Rodin as the input of MeshAnything.
  • Please refer to https://huggingface.co/spaces/Yiwen-ntu/MeshAnything/tree/main/examples for more examples.

Acknowledgement

Our code is based on these wonderful repos:

BibTeX

@misc{chen2024meshanythingv2artistcreatedmesh,
      title={MeshAnything V2: Artist-Created Mesh Generation With Adjacent Mesh Tokenization}, 
      author={Yiwen Chen and Yikai Wang and Yihao Luo and Zhengyi Wang and Zilong Chen and Jun Zhu and Chi Zhang and Guosheng Lin},
      year={2024},
      eprint={2408.02555},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2408.02555}, 
}