4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-10 18:17:31 +08:00
nerfstudio/docs/quickstart/export_geometry.md
Ethan Weber 1052fccec2
Mesh export (#809)
* start of mesh PR

* point cloud export mvp

* start of mesh PR

* point cloud export mvp

* Save out mesh. Poor quality atm

* reorganized mesh algorithms and specified CLI

* CLI reorg

* tsdf algorithm in progress

* debugging

* tsdf functional but camera distortion params not in

* playing with distortion params

* TSDF works but texture looks bad

* added trimesh

* moved to exporter

* removed files

* saving progress

* save texture image

* seems to work w/o barycentric

* barycentric start

* gap between triangles

* blocking out diagonal

* new barcentric and scaling

* meshing working. need to remove extra rows

* fixed triangle packing

* gitignore changes

* removed package

* fix Literal import

* comments

* update .mtl file

* poisson mesh with model output normals & resolved some PR comments on git

* starting docs. breaking up big function. todo: add xatlas

* xatlas and nvdiffrast working

* triangle_id

* progress on expensive texture coordinates method

* pytorch meshing works

* removing nvdiffrast

* remove trimesh

* cleanup

* few changes

* pred normals by default and add minimum additions to viewer

* fix cli in viewer

* add xatlas as dependency

* make point cloud more dense

* reverted viewer changes

* turn off normals by default

* fix docs

* finished todos on github

* remove xatlas

* xatlas

* black

Co-authored-by: Matt Tancik <tancik@berkeley.edu>
2022-12-02 10:49:19 -08:00

2.1 KiB

Export geometry

Here we document how to export point clouds and meshes from nerfstudio. The main command you'll be working with is ns-export. Our point clouds are exported as .ply files and the textured meshes are exported as .obj files.

Exporting a mesh

1. TSDF Fusion

TSDF (truncated signed distance function) Fusion is a meshing algorithm that uses depth maps to extract a surface as a mesh. This method works for all models.

```python
ns-export tsdf --load-config CONFIG.yml --output-dir OUTPUT_DIR
```

2. Poisson surface reconstruction

Poisson surface reconstruction gives the highest quality meshes. See the steps below to use Poisson surface reconstruction in our repo.

:::{admonition} Note
:class: info

This will only work with a Model that computes or predicts normals, e.g., nerfacto.
:::

1. Train nerfacto with network settings that predict normals.

```bash
ns-train nerfacto --pipeline.model.predict-normals True
```

2. Export a mesh with the Poisson meshing algorithm.

```bash
ns-export poisson --load-config CONFIG.yml --output-dir OUTPUT_DIR
```

Exporting a point cloud

ns-export pointcloud --help

Other exporting methods

Run the folowing command to see other export methods that may exist.

ns-export --help

Texturing an existing mesh with NeRF

Say you want to simplify and/or smooth a mesh offline, and then you want to texture it with NeRF. You can do that with the following command. It will work for any mesh filetypes that PyMeshLab can support, for example a .ply.

python scripts/texture.py --load-config CONFIG.yml --input-mesh-filename FILENAME --output-dir OUTPUT_DIR

Dependencies

Our dependencies are shipped with the pip package in the pyproject.toml file. These are the following: