Threefiner
An interface for text-guided mesh refinement.
https://github.com/3DTopia/threefiner/assets/25863658/a4abe725-b542-4a4a-a6d4-e4c4821f7d96
Features
- Mesh in, mesh out: we support
plywith vertex colors,obj, and single objectglb/gltfwith textures! - Easy to use: both a CLI and a GUI is available.
- Performant: Refine your texture in 1 minute with Deepfloyd-IF-II.
Install
We rely on torch and several CUDA extensions, please make sure you install them correctly first!
# tiny-cuda-nn
pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
# nvdiffrast
pip install git+https://github.com/NVlabs/nvdiffrast
# [optional, will use pysdf if unavailable] cubvh:
pip install git+https://github.com/ashawkey/cubvh
To use Deepfloyd-IF models, please log in to your huggingface and accept the license.
To install this package:
# install from pypi
pip install threefiner
# install from github
pip install git+https://github.com/3DTopia/threefiner
# local install
git clone https://github.com/3DTopia/threefiner
cd threefiner
pip install .
Usage
### command line interface
threefiner --help
# this is short for
python -m threefiner.cli --help
### refine a coarse mesh ('input.obj') using Stable-diffusion and save to 'logs/hamburger.glb'
threefiner sd --mesh input.obj --prompt 'a hamburger' --outdir logs --save hamburger.glb
### if the initial texture is good, we recommend using IF2 for refinement.
# by default, it will save to './name_fine.glb'
threefiner if2 --mesh name.glb --prompt 'description'
### if the initial texture is not good, we recommend using SD or IF first.
threefiner sd --mesh name.glb --prompt 'description'
threefiner if --mesh name.glb --prompt 'description'
### if the initial geometry is good, you can fix the geometry.
threefiner sd_fixgeo --mesh name.glb --prompt 'description'
threefiner if_fixgeo --mesh name.glb --prompt 'description'
threefiner if2_fixgeo --mesh name.glb --prompt 'description'
### advanced
# directional text prompt (append front/side/back view in text prompt)
# you need to know the mesh's front facing direction and specify it by '--front_dir'
# we use the OpenGL coordinate system, i.e., +x is right, +y is up, +z is front (more details: https://kit.kiui.moe/camera/)
# clock-wise rotation can be specified per 90 degree, e.g., +z1, -y2
threefiner if2 --mesh input.glb --prompt 'description' --text_dir --front_dir='+z'
# adjust training iterations
threefiner if2 --mesh input.glb --prompt 'description' --iters 1000
# explicitly fix the geometry and only refine texture
threefiner if2 --fix-geo --geom_mode mesh --mesh input.glb --prompt 'description' # equals if2_fixgeo
# open a GUI to visualize the training progress (needs a desktop)
threefiner if2 --mesh input.glb --prompt 'description' --gui
Gradio demo:
# requires gradio 4
python gradio_app.py if2
For more examples, please see scripts.
Q&A
-
How to make sure
--front_dirfor your model?You may first visualize it in a 3D viewer that follows OpenGL coordinate system:
The chair is facing down the Y axis (Green), so we can use `--front_dir="-y"` to rectify it to face +Z axis (Blue). -
fatal error: EGL/egl.h: No such file or directory
By default, we use the OpenGL rasterizer. This error means there is no OpenGL installation, which is often the case for headless servers. It's recommended to install OpenGL (along with NVIDIA driver) as it brings better performance. Otherwise, you can append
--force_cuda_rastto use the CUDA rasterizer instead.
Acknowledgement
This work is built on many amazing research works and open-source projects, thanks a lot to all the authors for sharing!
- SDS
guidanceclasses are based on diffusers. diffmcgeometry is based on diso.meshgeometry is based on nerf2mesh.- Texture encoding is based on tinycudann.
- Mesh renderer is based on nvdiffrast.
- GUI is based on dearpygui.
- The coarse models used in demo are generated by Genie and 3DTopia.
Metadata
Release files for threefiner 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| threefiner-0.1.2.tar.gz | 1.1 MB | Without provenance | Details for threefiner-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| threefiner-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for threefiner-0.1.2-py3-none-any.whl |
Total release size: 2.3 MB
Release files / threefiner-0.1.2.tar.gz
| Download URL | threefiner-0.1.2.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1fb73f2b6ecc888133ab34668cef873312b8988f1d638e52e2d035d06a9b1dc2
|
|
BLAKE2b-256 checksum How to use checksums |
116792efd4bea693e126b6638a1a26a19b89b10f6fc98c3f5a0793c1f3bf07ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / threefiner-0.1.2-py3-none-any.whl
| Download URL | threefiner-0.1.2-py3-none-any.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
58a7183ae9dd2b562da4acb6bc1873fb183888b1c15d4758a6eb9a81513fb62d
|
|
BLAKE2b-256 checksum How to use checksums |
6550a8a7f7325dc84d89bfc641ef453c8515a09db139916f929b654992bd3c6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for threefiner 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.