{"id":20945657,"url":"https://github.com/pierotofy/opensplat","last_synced_at":"2025-04-05T01:03:09.072Z","repository":{"id":218804768,"uuid":"747402960","full_name":"pierotofy/OpenSplat","owner":"pierotofy","description":"Production-grade 3D gaussian splatting with CPU/GPU support for Windows, Mac and Linux 🚀","archived":false,"fork":false,"pushed_at":"2024-04-26T06:27:12.000Z","size":963,"stargazers_count":557,"open_issues_count":25,"forks_count":41,"subscribers_count":18,"default_branch":"main","last_synced_at":"2024-05-01T21:08:21.693Z","etag":null,"topics":["3d","gaussian","radiance-field","splats","splatting"],"latest_commit_sha":null,"homepage":"https://antimatter15.com/splat/?url=https://splat.uav4geo.com/banana.splat","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pierotofy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-23T21:21:07.000Z","updated_at":"2024-08-22T13:00:12.657Z","dependencies_parsed_at":"2024-04-15T01:51:46.104Z","dependency_job_id":"39db205e-891f-4669-b5d2-280cca429628","html_url":"https://github.com/pierotofy/OpenSplat","commit_stats":null,"previous_names":["pierotofy/opensplat"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierotofy%2FOpenSplat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierotofy%2FOpenSplat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierotofy%2FOpenSplat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierotofy%2FOpenSplat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pierotofy","download_url":"https://codeload.github.com/pierotofy/OpenSplat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247271514,"owners_count":20911587,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d","gaussian","radiance-field","splats","splatting"],"created_at":"2024-11-18T23:49:13.075Z","updated_at":"2025-04-05T01:03:09.051Z","avatar_url":"https://github.com/pierotofy.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 💦 OpenSplat\n\nA free and open source implementation of 3D [gaussian splatting](https://www.youtube.com/watch?v=HVv_IQKlafQ) written in C++, focused on being portable, lean and fast.\n\n\u003cimg src=\"https://github.com/pierotofy/OpenSplat/assets/1951843/c9327c7c-31ad-402d-a5a5-04f7602ca5f5\" width=\"49%\" /\u003e\n\u003cimg src=\"https://github.com/pierotofy/OpenSplat/assets/1951843/eba4ae75-2c88-4c9e-a66b-608b574d085f\" width=\"49%\" /\u003e\n\nOpenSplat takes camera poses + sparse points in [COLMAP](https://colmap.github.io/), [OpenSfM](https://github.com/mapillary/OpenSfM), [ODM](https://github.com/OpenDroneMap/ODM),  [OpenMVG](https://github.com/OpenMVG/OpenMVG) or [nerfstudio](https://docs.nerf.studio/quickstart/custom_dataset.html) project format and computes a [scene file](https://drive.google.com/file/d/12lmvVWpFlFPL6nxl2e2d-4u4a31RCSKT/view?usp=sharing) (.ply or .splat) that can be later imported for [viewing](https://antimatter15.com/splat/?url=https://splat.uav4geo.com/banana.splat), editing and rendering in other [software](https://github.com/MrNeRF/awesome-3D-gaussian-splatting?tab=readme-ov-file#open-source-implementations).\n\nGraphics card recommended, but not required! OpenSplat runs the fastest on NVIDIA, AMD and Apple (Metal) GPUs, but can also run entirely on the CPU (~100x slower).\n\nCommercial use allowed and encouraged under the terms of the [AGPLv3](https://www.tldrlegal.com/license/gnu-affero-general-public-license-v3-agpl-3-0). ✅\n\nWe even have a [song](https://youtu.be/1bma7XJkoDM) 🎵\n\n## Getting Started\n\nIf you're on Windows, you can [buy](http://sites.fastspring.com/masseranolabs/product/opensplatforwindows) the pre-built program. This saves you time and helps support the project ❤️. Then jump directly to the [run](#run) section. As an alternative, check the [build](#build) section below.\n\nIf you're on macOS or Linux check the [build](#build) section below. \n\n## Build\n\nYou can build OpenSplat with or without GPU support.\n\nRequirements for all builds:\n\n * **OpenCV**: `sudo apt install libopencv-dev` should do it.\n * **libtorch**: See instructions below.\n\n### CPU\n\nFor libtorch visit https://pytorch.org/get-started/locally/ and select your OS, for package select \"LibTorch\". For compute platform you can select \"CPU\".\n\n Then:\n\n ```bash\n git clone https://github.com/pierotofy/OpenSplat OpenSplat\n cd OpenSplat\n mkdir build \u0026\u0026 cd build\n cmake -DCMAKE_PREFIX_PATH=/path/to/libtorch/ .. \u0026\u0026 make -j$(nproc)\n ```\n\n### CUDA\n\nAdditional requirement:\n\n * **CUDA**: Make sure you have the CUDA compiler (`nvcc`) in your PATH and that `nvidia-smi` is working. https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html \n \n For libtorch visit https://pytorch.org/get-started/locally/ and select your OS, for package select \"LibTorch\". Make sure to match your version of CUDA if you want to leverage GPU support in libtorch.\n \n Then:\n\n ```bash\n git clone https://github.com/pierotofy/OpenSplat OpenSplat\n cd OpenSplat\n mkdir build \u0026\u0026 cd build\n cmake -DCMAKE_PREFIX_PATH=/path/to/libtorch/ .. \u0026\u0026 make -j$(nproc)\n ```\n\n### ROCm via HIP\n\nAdditional requirement:\n\n* **ROCm**: Make sure you have the ROCm installed at /opt/rocm. https://rocm.docs.amd.com/projects/install-on-linux/en/latest/tutorial/quick-start.html\n\nFor libtorch visit https://pytorch.org/get-started/locally/ and select your OS, for package select \"LibTorch\". Make sure to match your version of ROCm (5.7) if you want to leverage AMD GPU support in libtorch.\n\nThen:\n\n ```bash\n git clone https://github.com/pierotofy/OpenSplat OpenSplat\n cd OpenSplat\n mkdir build \u0026\u0026 cd build\n export PYTORCH_ROCM_ARCH=gfx906\n cmake -DCMAKE_PREFIX_PATH=/path/to/libtorch/ -DGPU_RUNTIME=\"HIP\" -DHIP_ROOT_DIR=/opt/rocm -DOPENSPLAT_BUILD_SIMPLE_TRAINER=ON ..\n make\n ```\n\nIn addition, you can leverage Jinja to build the project\n\n```bash\ncmake -GNinja -DCMAKE_PREFIX_PATH=/path/to/libtorch/ -DGPU_RUNTIME=\"HIP\" -DHIP_ROOT_DIR=/opt/rocm -DOPENSPLAT_BUILD_SIMPLE_TRAINER=ON ..\njinja\n```\n\n### Windows\n\nThere's several ways to build on Windows, but this particular configuration has been confirmed to work:\n\n* Visual Studio 2022 C++\n* https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-windows-x86_64.msi\n* https://developer.download.nvidia.com/compute/cuda/11.8.0/network_installers/cuda_11.8.0_windows_network.exe\n* https://download.pytorch.org/libtorch/cu118/libtorch-win-shared-with-deps-2.1.2%2Bcu118.zip\n* https://github.com/opencv/opencv/releases/download/4.9.0/opencv-4.9.0-windows.exe\n\nThen run:\n\n```console\n\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat\"\ngit clone https://github.com/pierotofy/OpenSplat OpenSplat\ncd OpenSplat\nmd build\ncd build\ncmake -DCMAKE_PREFIX_PATH=C:/path_to/libtorch_2.1.2_cu11.8/libtorch -DOPENCV_DIR=C:/path_to/OpenCV_4.9.0/build -DCMAKE_BUILD_TYPE=Release ..\ncmake --build . --config Release\n```\n\nOptional: Edit cuda target (only if required) before `cmake --build .`\n\nC:/path_to/OpenSplat/build/gsplat.vcxproj\nfor example: arch=compute_75,code=sm_75\n\n### macOS\n\nIf you're using [Homebrew](https://brew.sh), you can install Cmake/OpenCV/Pytorch by running:\n\n```bash\nbrew install cmake\nbrew install opencv\nbrew install pytorch\n```\n\nYou will also need to install Xcode and the Xcode command line tools to compile with metal support (otherwise, OpenSplat will build with CPU acceleration only):\n1. Install Xcode from the Apple App Store.\n2. Install the command line tools with `xcode-select --install`. This might do nothing on your machine.\n3. If `xcode-select --print-path` prints `/Library/Developer/CommandLineTools`,then run `sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer`.\n\nThen run:\n\n```\ngit clone https://github.com/pierotofy/OpenSplat OpenSplat\ncd OpenSplat\nmkdir build \u0026\u0026 cd build\ncmake -DCMAKE_PREFIX_PATH=/path/to/libtorch/ -DGPU_RUNTIME=MPS .. \u0026\u0026 make -j$(sysctl -n hw.logicalcpu)\n./opensplat\n```\n\nIf building CPU-only, remove `-DGPU_RUNTIME=MPS`.\n\n:warning: You will probably get a *libc10.dylib can’t be opened because Apple cannot check it for malicious software* error on first run. Open **System Settings** and go to **Privacy \u0026 Security** and find the **Allow** button. You might need to repeat this several times until all torch libraries are loaded.\n\n:warning: If you get a *Library not loaded: @rpath/libomp.dylib* error, try running `brew link libomp --force` before running OpenSplat.\n\n## Docker Build\n\n### CUDA\n\nNavigate to the root directory of OpenSplat repo that has Dockerfile and run the following command to build the Docker image:\n\n```bash\ndocker build -t opensplat .\n```\n\nThe `-t` flag and other `--build-arg` let you tag and further customize your image across different ubuntu versions, CUDA/libtorch stacks, and hardware accelerators. \nFor example, to build an image with Ubuntu 22.04, CUDA 12.1.1, libtorch 2.2.1, and support for CUDA architectures 7.0 and 7.5, run the following command:\n\n```bash\ndocker build \\\n  -t opensplat:ubuntu-22.04-cuda-12.1.1-torch-2.2.1 \\\n  --build-arg UBUNTU_VERSION=22.04 \\\n  --build-arg CUDA_VERSION=12.1.1 \\\n  --build-arg TORCH_VERSION=2.2.1 \\\n  --build-arg CMAKE_CUDA_ARCHITECTURES=\"70;75;80\" \\\n  --build-arg CMAKE_BUILD_TYPE=Release .\n```\n\n### ROCm via HIP\n\nNavigate to the root directory of OpenSplat repo that has Dockerfile and run the following command to build the Docker image:\n```bash\ndocker build \\\n  -t opensplat \\\n  -f Dockerfile.rocm .\n```\n\nThe `-t` flag and other `--build-arg` let you tag and further customize your image across different ubuntu versions, CUDA/libtorch stacks, and hardware accelerators.\nFor example, to build an image with Ubuntu 22.04, CUDA 12.1.1, libtorch 2.2.1, ROCm 5.7.1, and support for ROCm architectures gfx906, run the following command:\n\n```bash\ndocker build \\\n  -t opensplat:ubuntu-22.04-cuda-12.1.1-libtorch-2.2.1-rocm-5.7.1-llvm-16 \\\n  --build-arg UBUNTU_VERSION=22.04 \\\n  --build-arg CUDA_VERSION=12.1.1 \\\n  --build-arg TORCH_VERSION=2.2.1 \\\n  --build-arg ROCM_VERSION=5.7.1 \\\n  --build-arg PYTORCH_ROCM_ARCH=\"gfx906\" \\\n  --build-arg CMAKE_BUILD_TYPE=Release .\n```\nNote: If you want to use ROCm 6.x, you need to switch to AMD version of pytorch docker as a base layer to build:\n```bash\ndocker build \\\n  -t opensplat:ubuntu-22.04-libtorch-2.1.2-rocm-6.0.2 \\\n  -f Dockerfile.rocm6 .\n```\n\n## Run\n\nTo get started, download a dataset and extract it to a folder: [ [banana](https://drive.google.com/file/d/1mUUZFDo2swd6CE5vwPPkjN63Hyf4XyEv/view?usp=sharing) ]  [ [train](https://drive.google.com/file/d/1-X741ecDczTRoMc3YenJLSFC9ulWXeNc/view?usp=sharing) ]  [ [truck](https://drive.google.com/file/d/1WWXo-GKo6d-yf-K1T1CswIdkdZrBNZ_e/view?usp=sharing) ] \n\nThen run from a command line prompt:\n\n### Windows\n\n```bash\ncd c:\\path\\to\\opensplat\nopensplat.exe c:\\path\\to\\banana -n 2000\n```\n\n### macOS / Linux\n\n```bash\ncd build\n./opensplat /path/to/banana -n 2000\n```\n\nThe program will generate an output `splat.ply` file which can then be dragged and dropped in one of the many [viewers](https://github.com/MrNeRF/awesome-3D-gaussian-splatting?tab=readme-ov-file#viewers) such as  https://playcanvas.com/viewer. You can also edit/cleanup the scene using https://playcanvas.com/supersplat/editor. The program will also output a `cameras.json` file in the same directory which can be used by some viewers.\n\nTo run on your own data, choose the path to an existing [COLMAP](https://colmap.github.io/), [OpenSfM](https://github.com/mapillary/OpenSfM), [ODM](https://github.com/OpenDroneMap/ODM) or [nerfstudio](https://docs.nerf.studio/quickstart/custom_dataset.html) project. The project must have sparse points included (random initialization is not supported, see https://github.com/pierotofy/OpenSplat/issues/7).\n\nThere's several parameters you can tune. To view the full list:\n\n\n```bash\n./opensplat --help\n```\n\n### Compression\n\nTo generate compressed splats (.splat files), use the `-o` option:\n\n```bash\n./opensplat /path/to/banana -o banana.splat\n```\n\n### Resume\n\nYou can resume training of a .PLY file by using the `--resume` option:\n\n```bash\n./opensplat /path/to/banana --resume ./splat.ply\n```\n\n### AMD GPU Notes\n\nTo train a model with AMD GPU using docker container, you can use the following command as a reference:\n1. Launch the docker container with the following command:\n```bash\ndocker run -it -v ~/data:/data --device=/dev/kfd --device=/dev/dri opensplat:ubuntu-22.04-libtorch-2.1.2-rocm-6.0.2 bash\n```\n2. Inside the docker container, run the following command to train the model:\n```bash\nexport HIP_VISIBLE_DEVICES=0\nexport HSA_OVERRIDE_GFX_VERSION=10.3.0  # AMD RX 6700 XT workaround \ncd /code/build\n./opensplat /data/banana -n 2000\n```\n## Project Goals\n\nWe recently released OpenSplat, so there's lots of work to do.\n\n * Support for running on AMD cards (more testing needed)\n * Improve speed / reduce memory usage\n * Distributed computation using multiple machines\n * Real-time training viewer output\n * Automatic filtering\n * Your ideas?\n\n https://github.com/pierotofy/OpenSplat/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement\n\n## Contributing\n\nWe welcome contributions! Pull requests are welcome.\n\n## GPU Memory Notes\n\nA single gaussian takes ~2000 bytes of memory, so currenly you need ~2GB of GPU memory for each million gaussians.\n\n## Credits\n\nThe methods used in OpenSplat are originally based on [splatfacto](https://docs.nerf.studio/nerfology/methods/splat.html).\n\n## License\n\nThe code in this repository, unless otherwise noted, is licensed under the AGPLv3.\n\nThe code from [splatfacto](https://docs.nerf.studio/nerfology/methods/splat.html) is originally licensed under the Apache 2.0 license and is © 2023 The Nerfstudio Team.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierotofy%2Fopensplat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpierotofy%2Fopensplat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierotofy%2Fopensplat/lists"}