huggingface / gsplat.js

JavaScript Gaussian Splatting library.
MIT License
1.26k stars 78 forks source link

Scripts for convert `.ply` file into `.splat` file #43

Closed Srameo closed 6 months ago

Srameo commented 6 months ago

Hello, thank you for your excellent work!

However, I would like to know if there is a Python or shell script that can quickly convert .ply files to .splat files?

oseiskar commented 6 months ago

You could try our Python tools https://github.com/SpectacularAI/point-cloud-tools (disclaimer: I represent Spectacular AI and we are not connected to this repository in any way):

# --- Install
git clone https://github.com/SpectacularAI/point-cloud-tools
cd point-cloud-tools
# optional but recommended: activate a virtual environment at this point
pip install -r requirements.txt

# --- Convert
python convert.py \
    /PATH/TO/bonsai/point_cloud/iteration_30000/point_cloud.ply \
    /OUT/PATH/bonsai.splat \
   --ply_input_format=inria

Note that the Gaussian Splatting community is yet to agree how the color data is stored in the PLY file. Therefore you need to specify that manually. See the README for more info.

Extra tip / advertisement: You can also our tools to create the PLY files using your phone and Nerfstudio, without uploading your data to a cloud of any kind. See here for more info.

Srameo commented 6 months ago

Thank you for your reply, this script is very effective!

kungfooman commented 5 months ago

Anyone knows how to go the opposite way, splat to ply? E.g. this tool only outputs splat: https://huggingface.co/spaces/VAST-AI/TriplaneGaussian

dylanebert commented 5 months ago

I can add that!

kungfooman commented 5 months ago

I can add that!

That would be a great relief! There are so many formats and every tool wants something else... compressed, uncompressed, special-this, special-that, ply, splat etc. :see_no_evil:

oseiskar commented 5 months ago

Note that the PLY files created by Inria code or Nerfstudio typically contain more information than .splat, in particular, the full spherical harmonic coefficients that capture the direction dependencies in lighting. The current .splat format only has flat colors. So the conversion PLY -> splat -> PLY loses information (which may or may not be relevant to your use case)

showpixelVR commented 5 months ago

What if i do import a ply first, wouldnt it keep the sh on plyexport?

dylanebert commented 5 months ago

Done! #52