Mesh Generation

[논문 리뷰] MeshAnything: Artist-Created Mesh Generation with Autoregressive Transformers

Justin4AI 2024. 7. 7. 19:30

 

✨MeshAnyting : 어떠한 3D shape information을 받더라도 Artist-Created Meshes(AMs)로 만들어주는 autoregressive transformer.✨

 

Chen, Yiwen, et al. "MeshAnything: Artist-Created Mesh Generation with Autoregressive Transformers." 
arXiv preprint arXiv:2406.10163 (2024). [paper]

 

 

Abstract

3D 산업에서 활용되기 위해서는, 3D assets는 mesh의 형태로 변환되어야만 한다. 그런데 기존의 mesh extraction들은 dense faces에 의존하고 기하학적 특성을 무시하기 때문에, 효율성이 떨어져서 Artist-Created Meshes (AMs)보다 훨씬 품질이 떨어진다. 그래서 MeshAnything은 mesh extraction 문제를 generation으로 바꾸어, VQ-VAE를 이용해 shape information을 condition으로 받아 mesh를 생성해낸다.

 

Introduction

MeshAnything의 Method는 사실상 Introduction chapter에서 대부분 설명되고 있으므로, 유의해서 읽는 것이 좋다.

 

Abstract에서 언급했듯이, mesh extraction으로 얻은 결과는 AMs보다 topology quality가 좋지 않다. 왜냐하면 dense face로부터 reconstruct하는 과정에서 물체의 기하학적 특성을 버리기 때문이다. 또, dense한 정보를 처리하는 것은 효율 면에서도 좋지 않다.

 그러다보니 위의 Marching CubesRemesh라는 것을 이용해서 reconstruction 방식으로 mesh를 추출한 결과가 MeshAnything과 비교했을 때 기하학적 특성의 반영과 topology가 떨어짐을 확인할 수 있다.

 

그래서 3D mesh generation task로 생각하자는 것이 MeshAnything의 아이디어(최초는 아니다). Training set으로 가능한 다양한 3D representation 중에서 explicity, continuosity, ease of derivation from 3D representations 그리고 mature point cloud encoders를 근거로 point clouds를 골랐다.

 

ObjaverseShapeNet을 써서 고품질 AMs만 골라내는데, 여기에 바로 point clouds extraction을 하면 excessive precision을 갖게 된다. 그런데 자동 생성되는 3D assets는 그렇게 좋은 품질의 point clouds를 가질 수는 없으므로, training과 inference 사이에서 domain gap이 생긴다.

 

따라서, 일부러 AMs에서 추출된 mesh를 coarser mesh로 corrupt한 다음, 거기에서 point clouds를 샘플링한다.

 

 

 

또 VQ-VAE를 사용하는데, shape information을 condition으로 줘야하니 M(multimodal)LLM과 같은 방식을 사용한다.

 

- VQ-VAE로 얻은 mesh token을 LLM에서의 language token으로 취급한다.

- Point clouds를 pre-trained encoder를 통해 mesh token space의 shape feature로 변환한다.

 

이 shape tokens는 mesh token sequence의 맨 앞에 붙어서, 다음 토큰 예측의 condition으로 작용한다.

 

BEiT, ViLT, ALIGN과 같은 ViT-based MLLM에 대해서 알고 있다면 쉽게 상상할 수 있다. 추후 여유가 된다면 리뷰 포스트를 작성할 예정이다.

 

Shape condition은 VQ-VAE decoder에 auxiliary information으로 들어가고 fine-tuning되는데, 이 때 noise를 mesh token sequence에 추가한 뒤 진행되므로 robustness도 얻을 수 있다.

 

Related Works

1. Mesh Extraction

Scalar function의 level set을 표현하는 polygonal mesh를 추출하는 1) Isosurface Extraction과, 특정 loss function에서 gradient에 대한 optimization을 진행하는 2) Gradient-Based Mesh Optimization 두 종류의 연구가 있다. 하지만 이들 모두 shape의 특성을 무시하고, 효율적인 topology를 가진 mesh를 생산할 수는 없다.

 

2. 3D Mesh Generations

이전 mesh extraction과 비슷하게 1) dense meshes를 생성하는 연구와, 2) AMs를 생성하는 연구가 있다. 전자의 연구는 direct 방식 or 3D assets를 생성한 뒤 mesh extraction하는 indirect 방식 두 가지가 있지만, 모두 dense meshes (low-quality topology)로 인해 실제 3D 산업에서 쓰이기 어렵다.

 

AMs를 생성하는 것 또한 복잡한 분포를 학습해야하기 때문에 어려우나, shape conditioning을 참고하기 때문에 효율적인 topology를 구성할 수 있게 된다. 사실 MeshGPT라는 모델은 ShapeNet만 사용하지만 MeshAnything은 Objaverse도 사용하여 generalization이 좋다는 차이 정도만 있다.

 

Shape-Conditioned AM Generation

*최초로 Shape-Conditioned AM Generation의 공식화를 도입한다.

M을 AM, S를 3D shape information(M과 매칭되어야하는), C를 image, text 혹은 empty set과 같은 conditions라고 하자.

아주 중요한 개념이므로, 꼭 알고 넘어가야 한다. 이 chapter에서의 공식을 이해하는 것을 넘어서, 단순한 mesh generation과 어떤 차이가 있는 것인지를 잘 이해할 수 있게 된다.

 

 

그렇다면 Shape-Conditioned AM Generation은 S에 조건부로 M을 생성하므로, 다음과 같이 표현될 수 있다.

 

그런데, C에 조건화되어 M을 생성할 수도 있다. 그런데 그 분포를 추정하는 것은 S와 같은 기저 정보를 이해하는 것 또한 요구하므로, 다음과 같은 가정을 만들 수 있다:

 

Chain rule에 따라서, 다음과 같이 분해할 수 있다:

 

그런데 SC 중에서, SC보다 더욱 직접적이고 강한 영향을 가진 condition이므로, C를 제거하면 다음과 같은 가정을 만들 수 있다:

 

 

따라서 2, 3, 4번째 수식을 합치면 다음과 같은 결론을 내릴 수 있다.

 

분해되어 생긴 두 개의 term 중 첫 번째가 Shape-Conditioned AM Generation(= MeshAnything)이다. 두 번째 term에 해당하는 task는 이미 많은 연구들이 높은 정확도를 보이고 있으므로, 이 두 가지를 연결한다면 C-conditioned mesh generation task의 복잡도를 상당히 줄일 수 있게 되는 것이다.

 

결국은 point clouds와  C-conditioned mesh generation에도 간접적인 contribution이 된다는 사실을 formulation으로 제시한 것이다.

 

 

Method

Shape Encoding for Conditional Generation

*Introduction과 중복되는 내용이 다수이므로 압축적으로 요약.

 

결국 Shape-Conditioned AM Generation은 S에 조건부로 M을 모델링하는 다음과 같은 분포를 추정한다:

 

따라서 training 시에 SM의 paired dataset이 필요한데, S가 inference시 추출되는 domain과 맞추기 위해(lower quality) 일부러 AMs로부터 coarser S를 추출한다. 과정은 다음과 같다: Marching Cubes와 같은 모델로 M으로부터 추출된 signed distance function을 coarser mesh로 변환할 수 있다. 거기에서 point clouds를 추출하면, coarser S를 얻게 된다.

 

사실 Marching Cubes는 대부분의 3D assets로부터 coarse mesh를 추출할 수 있기 때문에, 실제 inference 시에는 shape condition으로 point clouds가 아닌 3D assets (e.g. NeRF, dense mesh, image)를 input으로 넣어도 coarser S로 얼마든지 변환할 수 있게 되는 것이다! → Mesh 'Anything'

 

 

VQ-VAE with Noise-Resistant Decoder

🔔 이 다음 chapter와 함께 정말 중요한 부분인데, paper 내 텍스트/그림 설명이 헷갈리게 되어있으므로 유의하자. 설명이 생략된 부분도 많고, paper만으로 이해하기는 어려울 수 있다.

 

 

 

MeshGPT처럼 VQ-VAE를 먼저 train하는데, encoder와 deocder를 각각 graph convolutional networks와 ResNet을 사용한 MeshGPT와 달리 둘 모두에 동일한 transformers 구조를 사용한다.

 

*즉, 중간에 (mesh) autoregressive transformer까지 있으므로 총 세 개의 transformer가 있는 것이다.

 

 

 

🚨 VQ-VAE의 training을 마치고 inference를 해보면 imperfect results가 나타나므로, 다음과 같이 noise-resistant decoder를 고안했다(VQ-VAE의 decoder).

 

- 0) VQ-VAE의 training을 마친다.

- 1) VQ-VAE의 decoder에도 auxiliary information으로 shape condition(S)를 주입해준다. 

- 2) Inference 시의 autoregressive transformer의 imperfect token sequence generation을 모방하기 위해, codebook sampling logits에 random Gumbel noise를 추가한다.

- 3) Fine-tune을 하면, imperfect token sequences에 대해서도 well-refine된 mesh를 얻도록 조정할 수 있게 된다.

 

VQ-VAE는 conditioning과 관계 없이 mesh reconstruction과 codebook learning을 위해서 학습된다.

따라서 conditioning은 codebook sampling가 input인 autoregressive transformer에 함께 들어가는 것이고, 그것의 output인 token sequence가 불완전한 상황에 대비하기 위해 noise-resistant 'VQ-VAE' decoder를 고안한 것이다.

 

Shape-Conditioned Autoregressive Transformer

이제는 VQ-VAE의 bottleneck인 quantized codebook space로부터, autoregressive transformer가 shape condition을 고려해 token sequence generation을 하면 된다. 

 

Point cloud encoder인 P를 거친 shape feature P(S)를, VQ-VAE로부터의 embedding sequence T와 concatenation한 T'이 autoregressive transformer의 training input이 된다:

 

Introduction에서 언급한대로 shape tokens(features)는 mesh token(embedding) sequence의 맨 앞에 붙기 때문에, <bos>와 <eos>는 각각 shape tokens의 끝과 mesh token sequence의 끝에 붙어 3D mesh 정보를 구별해준다.

 

T'에 대한 autoregerssive transformer의 output을 T_hat으로 표기하면, noise-resistant decoder를 거쳐 최종 생성되는 AM은 다음과 같다:

 

 

 

 

 

 

 

아주 흥미로운 논문이고 3D industry에서의 applicability까지 잘 고려한 것 같은데 VQ-VAE의 encoder/decoder에도 transformers를 사용한 것에 대한 justification이 없어서 아쉬웠다. Attention으로 인한 computional cost를 조금 더 줄일 수 있을 것 같고, 여러가지 아이디어가 있어서 training code만 공개되면 바로 연구에 착수해보고 싶어 기다려보아야겠다 ㅎㅎ