diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..805f835 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,13 @@ +# alternatively, `export CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=wasm-server-runner` + +[target.wasm32-unknown-unknown] +runner = "wasm-server-runner" +rustflags = ["--cfg=web_sys_unstable_apis"] + + +# fix spurious network error on windows +# [source.crates-io] +# registry = "https://github.com/rust-lang/crates.io-index" + +[http] +proxy = "" diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..725c1cb --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,20 @@ +FROM mcr.microsoft.com/devcontainers/rust:0-1 + +WORKDIR /workspace + +RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y \ + build-essential \ + libpulse-dev \ + libdbus-1-dev \ + libudev-dev \ + libssl-dev \ + xorg \ + openbox \ + alsa-tools \ + librust-alsa-sys-dev \ + && rm -rf /var/lib/apt/lists/* + +RUN rustup target install wasm32-unknown-unknown + +RUN cargo install flamegraph +RUN cargo install wasm-server-runner diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..3a1380e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,33 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/rust +{ + "dockerComposeFile": ["docker-compose.yaml"], + "workspaceFolder": "/workspace", + "remoteUser": "vscode", + "shutdownAction": "stopCompose", + "service": "devcontainer", + + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": "true", + "username": "vscode", + "userUid": "1000", + "userGid": "1000", + "upgradePackages": "true" + }, + "ghcr.io/devcontainers/features/rust:1": "latest", + "ghcr.io/devcontainers-contrib/features/zsh-plugins:0": { + "plugins": "history history-substring-search" + } + }, + "customizations": { + "vscode": { + "settings": {}, + "extensions": [ + "rust-lang.rust-analyzer", + "serayuzgur.crates", + "vadimcn.vscode-lldb" + ] + } + } +} diff --git a/.devcontainer/docker-compose.yaml b/.devcontainer/docker-compose.yaml new file mode 100644 index 0000000..18b700b --- /dev/null +++ b/.devcontainer/docker-compose.yaml @@ -0,0 +1,10 @@ +services: + devcontainer: + build: + context: . + dockerfile: ./Dockerfile + volumes: + - type: bind + source: .. + target: /workspace + command: sleep infinity diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..43fc914 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +* text=auto eol=lf +*.{cmd,[cC][mM][dD]} text eol=crlf +*.{bat,[bB][aA][tT]} text eol=crlf +*.sh text eol=lf +*.conf text eol=lf + +*.ply binary +*.splat binary diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5755d69 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "cargo" + directory: "/" + schedule: + interval: "weekly" + ignore: + # These are peer deps of Cargo and should not be automatically bumped + - dependency-name: "semver" + - dependency-name: "crates-io" + rebase-strategy: "disabled" diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml new file mode 100644 index 0000000..fa4ab25 --- /dev/null +++ b/.github/workflows/bench.yml @@ -0,0 +1,41 @@ +name: bench + +on: + pull_request: + types: [ labeled, synchronize ] + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: 1 + +jobs: + bench: + if: contains(github.event.pull_request.labels.*.name, 'bench') + + strategy: + fail-fast: false + matrix: + os: [windows-latest, macos-latest] + + runs-on: ${{ matrix.os }} + timeout-minutes: 120 + + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml') }} + + - name: io benchmark + uses: boa-dev/criterion-compare-action@v3.2.4 + with: + benchName: "io" + branchName: ${{ github.base_ref }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..327db30 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,46 @@ +name: test + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: 1 + +jobs: + build: + + strategy: + fail-fast: false + matrix: + os: [windows-latest, macos-latest] + + runs-on: ${{ matrix.os }} + timeout-minutes: 120 + + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml') }} + + - name: check + run: cargo check + + - name: build + run: cargo build + + - name: lint + run: cargo clippy + + - name: test + run: cargo test diff --git a/.github/workflows/todo_tracker.yml b/.github/workflows/todo_tracker.yml new file mode 100644 index 0000000..a3b1eb6 --- /dev/null +++ b/.github/workflows/todo_tracker.yml @@ -0,0 +1,24 @@ + +name: 'todo tracker' + +on: + push: + branches: [ main ] + +jobs: + build: + permissions: + issues: write + + name: todo_tracker + runs-on: [ubuntu-latest] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: "TODO to Issue" + uses: "alstr/todo-to-issue-action@v4" + id: "todo" + with: + AUTO_ASSIGN: true diff --git a/.gitignore b/.gitignore index 6985cf1..45d282a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,12 @@ -# Generated by Cargo -# will have compiled files and executables debug/ target/ - -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html Cargo.lock - -# These are backup files generated by rustfmt **/*.rs.bk - -# MSVC Windows builds of rustc generate these, which store debugging information *.pdb + +*.py + +*.ply +*.gcloud + +.DS_Store diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3c81a84 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,73 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'burn_gaussian_splatting'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=burn_gaussian_splatting" + ], + "filter": { + "name": "burn_gaussian_splatting", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}", + "env": { + "CARGO_MANIFEST_DIR": "${workspaceFolder}", + } + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug executable 'viewer'", + "cargo": { + "args": [ + "build", + "--bin=viewer", + "--package=burn_gaussian_splatting" + ], + "filter": { + "name": "viewer", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}", + "env": { + "CARGO_MANIFEST_DIR": "${workspaceFolder}", + } + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in executable 'viewer'", + "cargo": { + "args": [ + "test", + "--no-run", + "--bin=viewer", + "--package=burn_gaussian_splatting" + ], + "filter": { + "name": "viewer", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}", + "env": { + "CARGO_MANIFEST_DIR": "${workspaceFolder}", + } + } + ] +} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..1fa910f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,33 @@ +# contributing to burn_gaussian_splatting + +![alt text](docs/notferris2.webp) + +thank you for your interest in contributing to `burn_gaussian_splatting`! contributions of all forms are welcome and appreciated. this includes code contributions, bug reports, documentation, or any other form of support. + +## getting started + +as `burn_gaussian_splatting` is a smaller project, the contribution process is more informal. feel free to contribute in a way that aligns with your interests and expertise. if you have any questions or need guidance, don't hesitate to reach out. + +## ways to contribute + +1. **code contributions**: if you have improvements or new features in mind, feel free to open a pull request. for larger changes, it's a good idea to discuss them first through a github issue. + +2. **bug reports**: if you find any bugs, please open an issue describing the problem, including any relevant details that could help in resolving it. + +3. **documentation**: improvements or additions to documentation are always welcome. this can include both inline code comments and updates to readme or other markdown files. + +4. **ideas and suggestions**: have ideas for new features or ways to improve the project? open an issue to discuss your suggestions! + +## pull request process + +1. ensure that any new code complies with the existing code style and structure. +2. update the readme.md or other documentation with details of changes, if applicable. +3. open a pull request with a clear description of the changes. + +## questions? + +if you're unsure about something or need help, feel free to open an issue asking for guidance. as the project grows, we aim to make contributing as accessible and straightforward as possible. + +## code of conduct + +while we don't have a formal code of conduct, we expect contributors to be respectful, open-minded, and collaborative. let's work together to maintain a welcoming and inclusive environment. diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..356ea92 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,55 @@ +[package] +name = "burn_gaussian_splatting" +description = "burn gaussian splatting render pipeline plugin" +version = "0.1.0" +edition = "2021" +authors = ["mosure "] +license = "MIT" +keywords = ["burn", "gaussian-splatting", "render-pipeline", "ply"] +categories = ["computer-vision", "graphics", "rendering", "rendering::data-formats"] +homepage = "https://github.com/mosure/burn_gaussian_splatting" +repository = "https://github.com/mosure/burn_gaussian_splatting" +readme = "README.md" +exclude = [".devcontainer", ".github", "docs", "dist", "build", "assets", "credits"] + + +[target.'cfg(target_arch = "wasm32")'.dependencies] +console_error_panic_hook = "0.1" +wasm-bindgen = "0.2" + + +[dependencies.web-sys] +version = "0.3.4" +features = [ + 'Document', + 'Element', + 'HtmlElement', + 'Node', + 'Window', +] + + +[dev-dependencies] +criterion = { version = "0.5", features = ["html_reports"] } + + +[profile.dev.package."*"] +opt-level = 3 + +[profile.dev] +opt-level = 1 + +[profile.release] +lto = "thin" +codegen-units = 1 +opt-level = 3 + +[profile.wasm-release] +inherits = "release" +opt-level = "z" +lto = "fat" +codegen-units = 1 + + +[lib] +path = "src/lib.rs" diff --git a/README.md b/README.md index 714b168..69fd692 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,31 @@ -# burn_gaussian_splatting +# burn_gaussian_splatting 🌌 + +[![test](https://github.com/mosure/burn_gaussian_splatting/workflows/test/badge.svg)](https://github.com/Mosure/burn_gaussian_splatting/actions?query=workflow%3Atest) +[![GitHub License](https://img.shields.io/github/license/mosure/burn_gaussian_splatting)](https://raw.githubusercontent.com/mosure/burn_gaussian_splatting/main/LICENSE) +[![GitHub Last Commit](https://img.shields.io/github/last-commit/mosure/burn_gaussian_splatting)](https://github.com/mosure/burn_gaussian_splatting) +[![GitHub Releases](https://img.shields.io/github/v/release/mosure/burn_gaussian_splatting?include_prereleases&sort=semver)](https://github.com/mosure/burn_gaussian_splatting/releases) +[![GitHub Issues](https://img.shields.io/github/issues/mosure/burn_gaussian_splatting)](https://github.com/mosure/burn_gaussian_splatting/issues) +[![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/mosure/burn_gaussian_splatting.svg)](http://isitmaintained.com/project/mosure/burn_gaussian_splatting) +[![crates.io](https://img.shields.io/crates/v/burn_gaussian_splatting.svg)](https://crates.io/crates/burn_gaussian_splatting) + burn gaussian splatting differentiable render and training pipeline + +![Alt text](docs/notferris.png) + +`cargo run -- scenes/person.gcloud` + +## capabilities + +- [ ] gaussian splatting person reconstruction + +## usage + +```rust +``` + +## wasm support + +to build wasm run: +- `cargo build --target wasm32-unknown-unknown --release` +- `wasm-bindgen --out-dir ./out/ --target web ./target/` + diff --git a/assets/fonts/Caveat-Bold.ttf b/assets/fonts/Caveat-Bold.ttf new file mode 100644 index 0000000..5b05296 Binary files /dev/null and b/assets/fonts/Caveat-Bold.ttf differ diff --git a/assets/fonts/Caveat-Medium.ttf b/assets/fonts/Caveat-Medium.ttf new file mode 100644 index 0000000..ec96174 Binary files /dev/null and b/assets/fonts/Caveat-Medium.ttf differ diff --git a/assets/fonts/Caveat-Regular.ttf b/assets/fonts/Caveat-Regular.ttf new file mode 100644 index 0000000..9654095 Binary files /dev/null and b/assets/fonts/Caveat-Regular.ttf differ diff --git a/assets/fonts/Caveat-SemiBold.ttf b/assets/fonts/Caveat-SemiBold.ttf new file mode 100644 index 0000000..113d70d Binary files /dev/null and b/assets/fonts/Caveat-SemiBold.ttf differ diff --git a/docs/notferris.png b/docs/notferris.png new file mode 100644 index 0000000..1b428b5 Binary files /dev/null and b/docs/notferris.png differ diff --git a/docs/notferris2.webp b/docs/notferris2.webp new file mode 100644 index 0000000..463e34d Binary files /dev/null and b/docs/notferris2.webp differ diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/utils.rs b/src/utils.rs new file mode 100644 index 0000000..6af5b92 --- /dev/null +++ b/src/utils.rs @@ -0,0 +1,8 @@ + +pub fn setup_hooks() { + #[cfg(debug_assertions)] + #[cfg(target_arch = "wasm32")] + { + console_error_panic_hook::set_once(); + } +}