gaussian-splat-lite 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/CONTRIBUTING.md +79 -0
  3. package/Gaussian-Splat-Lite.svg +104 -0
  4. package/LICENSE +202 -0
  5. package/NOTICE +10 -0
  6. package/README.md +272 -0
  7. package/THIRD_PARTY_LICENSES.md +53 -0
  8. package/dist/assets/worker-7HrXsEvI.js.map +1 -0
  9. package/dist/assets/worker-XHJGFfdJ.js.map +1 -0
  10. package/dist/gaussian-splat-lite.cjs +3039 -0
  11. package/dist/gaussian-splat-lite.cjs.map +1 -0
  12. package/dist/gaussian-splat-lite.min.cjs +886 -0
  13. package/dist/gaussian-splat-lite.min.cjs.map +1 -0
  14. package/dist/gaussian-splat-lite.module.js +3023 -0
  15. package/dist/gaussian-splat-lite.module.js.map +1 -0
  16. package/dist/gaussian-splat-lite.module.min.js +2840 -0
  17. package/dist/gaussian-splat-lite.module.min.js.map +1 -0
  18. package/dist/types/GaussianSplatRenderer.d.cts +385 -0
  19. package/dist/types/GaussianSplatRenderer.d.ts +385 -0
  20. package/dist/types/SplatAccumulator.d.cts +72 -0
  21. package/dist/types/SplatAccumulator.d.ts +72 -0
  22. package/dist/types/SplatEdit.d.cts +86 -0
  23. package/dist/types/SplatEdit.d.ts +86 -0
  24. package/dist/types/SplatGeometry.d.cts +4 -0
  25. package/dist/types/SplatGeometry.d.ts +4 -0
  26. package/dist/types/SplatLoader.d.cts +31 -0
  27. package/dist/types/SplatLoader.d.ts +31 -0
  28. package/dist/types/SplatMesh.d.cts +74 -0
  29. package/dist/types/SplatMesh.d.ts +74 -0
  30. package/dist/types/SplatSource.d.cts +23 -0
  31. package/dist/types/SplatSource.d.ts +23 -0
  32. package/dist/types/SplatWorker.d.cts +30 -0
  33. package/dist/types/SplatWorker.d.ts +30 -0
  34. package/dist/types/Splats.d.cts +54 -0
  35. package/dist/types/Splats.d.ts +54 -0
  36. package/dist/types/cameraRelative.d.cts +22 -0
  37. package/dist/types/cameraRelative.d.ts +22 -0
  38. package/dist/types/defines.d.cts +22 -0
  39. package/dist/types/defines.d.ts +22 -0
  40. package/dist/types/index.d.cts +12 -0
  41. package/dist/types/index.d.mts +1 -0
  42. package/dist/types/index.d.ts +12 -0
  43. package/dist/types/shaders.d.cts +1 -0
  44. package/dist/types/shaders.d.ts +1 -0
  45. package/dist/types/splatTransform.d.cts +10 -0
  46. package/dist/types/splatTransform.d.ts +10 -0
  47. package/dist/types/utils.d.cts +33 -0
  48. package/dist/types/utils.d.ts +33 -0
  49. package/dist/types/wasm.d.cts +2 -0
  50. package/dist/types/wasm.d.ts +2 -0
  51. package/dist/types/worker.d.cts +42 -0
  52. package/dist/types/worker.d.ts +42 -0
  53. package/docs/GaussianSplatRenderer.md +107 -0
  54. package/docs/SplatAccumulator.md +44 -0
  55. package/docs/SplatEdit.md +84 -0
  56. package/docs/SplatFileType.md +30 -0
  57. package/docs/SplatLoader.md +28 -0
  58. package/docs/SplatMesh.md +80 -0
  59. package/docs/SplatSource.md +26 -0
  60. package/docs/Splats.md +58 -0
  61. package/package.json +109 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project follows [Semantic Versioning](https://semver.org/).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2026-08-24
11
+
12
+ ### Added
13
+
14
+ - Initial public release of the Three.js Gaussian Splatting renderer.
15
+
16
+ [Unreleased]: https://github.com/WilliamLiu-1997/Gaussian-Splat-Lite/compare/v0.1.0...HEAD
17
+ [0.1.0]: https://github.com/WilliamLiu-1997/Gaussian-Splat-Lite/releases/tag/v0.1.0
@@ -0,0 +1,79 @@
1
+ # Contributing
2
+
3
+ Thanks for contributing to `gaussian-splat-lite`.
4
+
5
+ ## Development setup
6
+
7
+ Building the WebAssembly module requires Node.js 20.9 or newer, a Rust
8
+ toolchain installed through `rustup`, and the `wasm32-unknown-unknown` target.
9
+
10
+ ```bash
11
+ npm ci
12
+ npm run build:wasm
13
+ ```
14
+
15
+ Start the local viewer with `npm run dev`.
16
+
17
+ ## Validation
18
+
19
+ Run the complete release check before opening a pull request:
20
+
21
+ ```bash
22
+ npm run release:check
23
+ ```
24
+
25
+ This builds the WebAssembly module and example site, type-checks and lints the
26
+ source, runs the tests, builds the package, and verifies the npm tarball.
27
+
28
+ When dependency updates introduce or change install scripts, review them and
29
+ update the pinned `allowScripts` entries with `npm approve-scripts`.
30
+
31
+ ## Pull requests
32
+
33
+ - Keep changes focused on one problem.
34
+ - Update the README and API docs when public behavior changes.
35
+ - Add or update tests for behavior that can be exercised without WebGL.
36
+ - Include a minimal reproduction and captures for rendering changes when
37
+ possible.
38
+ - Add user-visible changes to the `Unreleased` section of `CHANGELOG.md`.
39
+ - Do not commit generated `dist/`, `site-dist/`, Rust `target/`, or wasm-pack
40
+ `pkg/` directories.
41
+
42
+ ## Maintainer releases
43
+
44
+ The npm package is published by `.github/workflows/publish.yml` when a matching
45
+ `v*` tag is pushed. The workflow rejects tags that do not match the version in
46
+ `package.json`, skips versions already present on npm, and creates the GitHub
47
+ release from `CHANGELOG.md`.
48
+
49
+ Before the first automated release, make the GitHub repository public, then
50
+ publish the package once from a maintainer account so that its npm settings
51
+ exist:
52
+
53
+ ```bash
54
+ npm run release:check
55
+ npm publish --access public
56
+ ```
57
+
58
+ Then, using a current npm CLI, configure GitHub Actions as the trusted publisher
59
+ for future releases:
60
+
61
+ ```bash
62
+ npm trust github gaussian-splat-lite \
63
+ --repo WilliamLiu-1997/Gaussian-Splat-Lite \
64
+ --file publish.yml \
65
+ --allow-publish
66
+ ```
67
+
68
+ The same setting is available under the package's npm **Settings → Trusted
69
+ Publisher** page. The workflow uses short-lived OIDC credentials, so no
70
+ `NPM_TOKEN` repository secret is required after this setup.
71
+
72
+ For each release:
73
+
74
+ 1. Move the relevant changelog entries from `Unreleased` into a dated version
75
+ section.
76
+ 2. Update `package.json` and `package-lock.json` with
77
+ `npm version <version> --no-git-tag-version`.
78
+ 3. Run `npm run release:check`, commit the release changes, then create and push
79
+ `v<version>`.
@@ -0,0 +1,104 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg
3
+ width="645"
4
+ height="180"
5
+ viewBox="0 0 645 180"
6
+ version="1.1"
7
+ id="svg16"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ xmlns:svg="http://www.w3.org/2000/svg">
10
+ <defs
11
+ id="defs20" />
12
+ <rect
13
+ width="645"
14
+ height="180"
15
+ fill="#10151e"
16
+ id="rect2" />
17
+ <circle
18
+ cx="83"
19
+ cy="90"
20
+ r="38"
21
+ fill="none"
22
+ stroke="#69717e"
23
+ stroke-width="3"
24
+ opacity=".82"
25
+ id="circle4" />
26
+ <circle
27
+ cx="54"
28
+ cy="65"
29
+ r="11"
30
+ fill="#cfff58"
31
+ id="circle6" />
32
+ <circle
33
+ cx="112"
34
+ cy="65"
35
+ r="11"
36
+ fill="#8ea9ff"
37
+ id="circle8" />
38
+ <circle
39
+ cx="83"
40
+ cy="124"
41
+ r="11"
42
+ fill="#f6f5f0"
43
+ id="circle10" />
44
+ <g
45
+ aria-label="Gaussian Splat Lite"
46
+ id="text14"
47
+ style="fill:#ffffff">
48
+ <path
49
+ d="m 183.3,81.05 q -1.15,-2.9 -3.25,-4.45 -2.1,-1.6 -6.55,-1.6 -2.45,0 -4.2,0.65 -1.75,0.6 -3.15,2.1 -1.4,1.5 -2.1,4.35 -0.7,2.8 -0.7,6.95 v 4.9 q 0,4.15 0.7,7 0.7,2.8 2.1,4.3 1.4,1.5 3.15,2.15 1.75,0.6 4.2,0.6 4.5,0 7.15,-1.9 2.65,-1.95 2.65,-4.15 V 93.5 h -6.15 V 92 h 7.95 v 9.45 q 0,3.35 -3.05,5.7 -3,2.35 -8.55,2.35 -6.15,0 -8.9,-3.75 -2.75,-3.8 -2.75,-11.8 v -4.9 q 0,-8 2.75,-11.75 2.75,-3.8 8.9,-3.8 4.95,0 7.4,1.85 2.45,1.8 3.8,5.15 z"
50
+ id="path22" />
51
+ <path
52
+ d="m 195.74999,107.5 h 16.3 l -10.25,-24.15 -10.9,25.65 h -1.6 l 12.5,-29.5 12.5,29.5 h -18.55 z"
53
+ id="path24" />
54
+ <path
55
+ d="m 220.59999,80 v 14.5 q 0,7.45 2.35,10.5 2.4,3 6.55,3 4.15,0 6.5,-3 2.4,-3.05 2.4,-10.5 V 80 h 1.5 v 14.5 q 0,15 -10.4,15 -10.4,0 -10.4,-15 V 80 Z"
56
+ id="path26" />
57
+ <path
58
+ d="m 256.15002,79.4 q 6.2,0 8.8,2.75 l -1,1.1 q -2.4,-2.35 -7.6,-2.35 -7.8,0 -7.8,6.2 0,2.4 1.9,3.85 1.9,1.4 4.6,2.15 2.75,0.75 5.45,1.6 2.75,0.8 4.65,2.65 1.9,1.8 1.9,4.75 0,3.45 -2.85,5.5 -2.85,2.05 -8.25,2.05 -2.65,0 -5.25,-0.7 -2.55,-0.7 -3.8,-2.05 l 1,-1.1 q 2.55,2.35 7.85,2.35 4.85,0 7.3,-1.8 2.5,-1.8 2.5,-4.2 0,-2.5 -1.9,-4.05 -1.9,-1.55 -4.65,-2.3 -2.7,-0.8 -5.45,-1.6 -2.7,-0.85 -4.6,-2.6 -1.9,-1.75 -1.9,-4.6 0,-3.85 2.55,-5.7 2.6,-1.9 6.55,-1.9 z"
59
+ id="path28" />
60
+ <path
61
+ d="m 281.60003,79.4 q 6.2,0 8.8,2.75 l -1,1.1 q -2.4,-2.35 -7.6,-2.35 -7.8,0 -7.8,6.2 0,2.4 1.9,3.85 1.9,1.4 4.6,2.15 2.75,0.75 5.45,1.6 2.75,0.8 4.65,2.65 1.9,1.8 1.9,4.75 0,3.45 -2.85,5.5 -2.85,2.05 -8.25,2.05 -2.65,0 -5.25,-0.7 -2.55,-0.7 -3.8,-2.05 l 1,-1.1 q 2.55,2.35 7.85,2.35 4.85,0 7.3,-1.8 2.5,-1.8 2.5,-4.2 0,-2.5 -1.9,-4.05 -1.9,-1.55 -4.65,-2.3 -2.7,-0.8 -5.45,-1.6 -2.7,-0.85 -4.6,-2.6 -1.9,-1.75 -1.9,-4.6 0,-3.85 2.55,-5.7 2.6,-1.9 6.55,-1.9 z"
62
+ id="path30" />
63
+ <path
64
+ d="m 299.40004,80 h 1.5 v 29 h -1.5 z"
65
+ id="path32" />
66
+ <path
67
+ d="m 312.65,107.5 h 16.3 L 318.7,83.35 307.8,109 h -1.6 l 12.5,-29.5 12.5,29.5 h -18.55 z"
68
+ id="path34" />
69
+ <path
70
+ d="M 336.5,109 V 80 h 1.5 l 16.3,26.25 V 80 h 1.5 v 29 h -1.5 L 338,82.7 V 109 Z"
71
+ id="path36" />
72
+ <path
73
+ d="m 378.40002,82.65 q 0,-4.85 2.45,-7 2.45,-2.15 7.95,-2.15 3.85,0 6.2,2 2.35,2 3.4,6.1 l -4.65,3.5 h -2.45 l 5.4,-4.05 q -1.05,-3.35 -3.05,-4.7 -1.95,-1.35 -4.85,-1.35 -2,0 -3.4,0.25 -1.35,0.25 -2.75,1 -1.35,0.7 -2.05,2.3 -0.7,1.6 -0.7,4.1 0,2.2 2,3.9 2.05,1.7 4.95,2.9 2.9,1.2 5.8,2.45 2.95,1.25 4.95,3.2 2.05,1.95 2.05,4.5 0,5 -2.5,7.45 -2.45,2.45 -8.45,2.45 -4.9,0 -7.7,-1.95 -2.8,-2 -3.85,-6.15 l 1.4,-0.6 q 1,4.05 3.4,5.65 2.45,1.55 6.75,1.55 4.8,0 7.1,-1.85 2.35,-1.85 2.35,-6.55 0,-2.2 -2.05,-3.9 -2,-1.7 -4.95,-2.9 -2.9,-1.2 -5.8,-2.45 -2.9,-1.25 -4.95,-3.2 -2,-1.95 -2,-4.5 z"
74
+ id="path38" />
75
+ <path
76
+ d="m 419.30005,98.2 -0.75,-1.3 2.8,-1.6 q 3.45,-1.9 3.45,-6.05 0,-7.75 -11.8,-7.75 h -4.6 V 119 h -1.5 V 80 h 6.1 q 6.6,0 9.95,2.45 3.35,2.4 3.35,6.8 0,5 -4.2,7.35 z"
77
+ id="path40" />
78
+ <path
79
+ d="m 449.65004,107.5 v 1.5 h -16.7 V 80 h 1.5 v 27.5 z"
80
+ id="path42" />
81
+ <path
82
+ d="m 457.65,107.5 h 16.3 L 463.7,83.35 452.8,109 h -1.6 l 12.5,-29.5 12.5,29.5 h -18.55 z"
83
+ id="path44" />
84
+ <path
85
+ d="m 500.25,80 v 1.5 h -10.5 V 109 h -1.5 V 81.5 h -10.5 V 80 Z"
86
+ id="path46" />
87
+ <path
88
+ d="m 541.04998,107.5 v 1.5 h -20.9 V 74 h 1.5 v 33.5 z"
89
+ style="fill:#cfff58"
90
+ id="path48" />
91
+ <path
92
+ d="m 546.14996,80 h 1.5 v 29 h -1.5 z"
93
+ style="fill:#cfff58"
94
+ id="path50" />
95
+ <path
96
+ d="m 575.49994,80 v 1.5 h -10.5 V 109 h -1.5 V 81.5 h -10.5 V 80 Z"
97
+ style="fill:#cfff58"
98
+ id="path52" />
99
+ <path
100
+ d="m 600.24995,106.05 q -2.75,3.45 -9,3.45 -6.25,0 -8.95,-3.55 -2.7,-3.55 -2.7,-11.45 0,-7.9 2.7,-11.45 2.7,-3.55 8.95,-3.55 7.25,0 9.85,4.75 l -12.25,10.25 h -2.35 l 12.65,-10.55 q -2.2,-2.95 -7.9,-2.95 -2.5,0 -4.2,0.55 -1.7,0.5 -3.15,1.95 -1.4,1.4 -2.1,4.15 -0.7,2.7 -0.7,6.85 0,4.15 0.7,6.9 0.7,2.7 2.1,4.15 1.45,1.4 3.15,1.95 1.7,0.5 4.2,0.5 5.7,0 7.9,-2.95 z"
101
+ style="fill:#cfff58"
102
+ id="path54" />
103
+ </g>
104
+ </svg>
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,10 @@
1
+ Gaussian Splat Lite
2
+ Copyright 2026 William Liu <lyz15972107087@gmail.com>
3
+
4
+ This product includes software derived from SparkJS v2.1.0,
5
+ Copyright © 2025 WORLD LABS TECHNOLOGIES, INC., licensed under the MIT
6
+ License. See THIRD_PARTY_LICENSES.md for the complete license notice.
7
+
8
+ This product includes ruzstd v0.7.3,
9
+ Copyright © 2019 Moritz Borcherding, licensed under the MIT License.
10
+ See THIRD_PARTY_LICENSES.md for the complete license notice.
package/README.md ADDED
@@ -0,0 +1,272 @@
1
+ <div align="center">
2
+
3
+ # Gaussian-Splat-Lite
4
+
5
+ [![npm version](https://img.shields.io/npm/v/gaussian-splat-lite)](https://www.npmjs.com/package/gaussian-splat-lite)
6
+ [![CI](https://github.com/WilliamLiu-1997/Gaussian-Splat-Lite/actions/workflows/ci.yml/badge.svg)](https://github.com/WilliamLiu-1997/Gaussian-Splat-Lite/actions/workflows/ci.yml)
7
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
8
+
9
+ <p align="center">
10
+ <img src="./Gaussian-Splat-Lite.svg" alt="Gaussian Splat Lite" width="645">
11
+ </p>
12
+
13
+ </div>
14
+
15
+ `Gaussian-Splat-Lite` is a lightweight 3D Gaussian Splatting renderer for Three.js. It is based on the overall architecture of [SparkJS](https://github.com/sparkjsdev/spark), simplified and adapted to retain a stable, general-purpose Gaussian Splat rendering pipeline while removing LoD, paging, dynamic shader graphs, and broad format compatibility layers. It also fixes SparkJS precision issues with large GIS/ECEF world coordinates and provides faster depth sorting and raycasting implementations.
16
+
17
+ It works alongside standard Three.js scenes, cameras, meshes, and render loops, and supports unified generation, sorting, and blended rendering of multiple Splat objects.
18
+
19
+ ## Features
20
+
21
+ - Native integration with the Three.js scene graph and rendering pipeline
22
+ - Multiple `SplatMesh` objects rendered with correct global sorting
23
+ - `.ply` and `.spz` file support
24
+ - URL, in-memory byte, and standard `ReadableStream` inputs
25
+ - Rust/WebAssembly file decoding, depth sorting, and raycasting
26
+ - 3DGS rendering and optional 2DGS support
27
+ - Spherical harmonics, depth of field, offscreen rendering, and environment-map rendering
28
+ - SDF-based color and opacity editing
29
+ - Camera-relative rendering for large GIS/ECEF world coordinates
30
+ - TypeScript declarations, ESM, and CommonJS builds
31
+
32
+ ## Requirements
33
+
34
+ - A modern browser with WebGL2, WebAssembly, Web Workers, and ES modules
35
+ - Three.js `0.185.1` or newer
36
+ - Correct CORS headers when loading Splat files from another origin
37
+
38
+ ## Installation
39
+
40
+ ```sh
41
+ npm install gaussian-splat-lite three
42
+ ```
43
+
44
+ ## Quick start
45
+
46
+ ```js
47
+ import * as THREE from "three";
48
+ import { GaussianSplatRenderer, SplatMesh } from "gaussian-splat-lite";
49
+
50
+ const scene = new THREE.Scene();
51
+ const camera = new THREE.PerspectiveCamera(
52
+ 60,
53
+ window.innerWidth / window.innerHeight,
54
+ 0.1,
55
+ 1000,
56
+ );
57
+ camera.position.set(0, 0, 3);
58
+
59
+ const renderer = new THREE.WebGLRenderer({
60
+ antialias: false,
61
+ powerPreference: "high-performance",
62
+ });
63
+ renderer.setPixelRatio(window.devicePixelRatio);
64
+ renderer.setSize(window.innerWidth, window.innerHeight);
65
+ document.body.appendChild(renderer.domElement);
66
+
67
+ // One GaussianSplatRenderer is normally enough for each Three.js renderer.
68
+ const splatRenderer = new GaussianSplatRenderer({ renderer });
69
+ scene.add(splatRenderer);
70
+
71
+ const splat = new SplatMesh({ url: "/assets/scene.spz" });
72
+ scene.add(splat);
73
+
74
+ // Wait before reading loaded data such as the count or bounding box.
75
+ await splat.initialized;
76
+ console.log(`Loaded ${splat.numSplats} splats`);
77
+
78
+ renderer.setAnimationLoop(() => {
79
+ renderer.render(scene, camera);
80
+ });
81
+
82
+ window.addEventListener("resize", () => {
83
+ camera.aspect = window.innerWidth / window.innerHeight;
84
+ camera.updateProjectionMatrix();
85
+ renderer.setSize(window.innerWidth, window.innerHeight);
86
+ });
87
+ ```
88
+
89
+ `GaussianSplatRenderer` is itself a Three.js scene object. It collects visible `SplatMesh` objects, generates GPU data, sorts the combined collection, and draws it. Application code continues to use the standard `renderer.render(scene, camera)` call; it does not need to issue a separate draw call for each Splat.
90
+
91
+ Some PLY/SPZ data uses a `+Y`-down, `+Z`-forward convention. If a model appears upside down or faces the wrong direction, rotate the object without changing its decoded data:
92
+
93
+ ```js
94
+ splat.quaternion.set(1, 0, 0, 0); // Rotate 180 degrees around X.
95
+ ```
96
+
97
+ ## Loading data
98
+
99
+ ### From a URL
100
+
101
+ ```js
102
+ const splat = new SplatMesh({
103
+ url: "/assets/model.ply", // .spz is also supported.
104
+ onProgress: (event) => {
105
+ if (event.lengthComputable) {
106
+ console.log(`${Math.round((event.loaded / event.total) * 100)}%`);
107
+ }
108
+ },
109
+ onLoad: (mesh) => console.log(mesh.numSplats),
110
+ });
111
+
112
+ scene.add(splat);
113
+ await splat.initialized;
114
+ ```
115
+
116
+ ### From a File or ReadableStream
117
+
118
+ This form is suitable for file pickers, drag and drop, and large local files. The data is decoded locally by WebAssembly and is not automatically uploaded anywhere.
119
+
120
+ ```js
121
+ import { SplatFileType, SplatMesh } from "gaussian-splat-lite";
122
+
123
+ const file = fileInput.files[0];
124
+ const fileType = file.name.toLowerCase().endsWith(".spz")
125
+ ? SplatFileType.SPZ
126
+ : SplatFileType.PLY;
127
+
128
+ const splat = new SplatMesh({
129
+ fileName: file.name,
130
+ fileType,
131
+ stream: file.stream(),
132
+ streamLength: file.size,
133
+ onProgress: ({ loaded, total }) => console.log(loaded, total),
134
+ });
135
+
136
+ scene.add(splat);
137
+ await splat.initialized;
138
+ ```
139
+
140
+ Complete in-memory file data can also be supplied:
141
+
142
+ ```js
143
+ const bytes = new Uint8Array(await file.arrayBuffer());
144
+ const splat = new SplatMesh({
145
+ fileBytes: bytes,
146
+ fileType: SplatFileType.SPZ,
147
+ });
148
+ ```
149
+
150
+ When the input URL does not have a recognizable extension, specify `fileType` explicitly or provide a `.ply` / `.spz` name through `fileName`.
151
+
152
+ ### Creating Splats in code
153
+
154
+ ```js
155
+ import * as THREE from "three";
156
+ import { SplatMesh } from "gaussian-splat-lite";
157
+
158
+ const splat = new SplatMesh({
159
+ maxSplats: 100,
160
+ constructSplats: (data) => {
161
+ data.pushSplat(
162
+ new THREE.Vector3(0, 0, 0), // center
163
+ new THREE.Vector3(0.2, 0.1, 0.1), // scales
164
+ new THREE.Quaternion(), // rotation
165
+ 1, // opacity
166
+ new THREE.Color(0x4f8cff), // color
167
+ );
168
+ },
169
+ });
170
+
171
+ scene.add(splat);
172
+ await splat.initialized;
173
+ ```
174
+
175
+ ## Core concepts and public API
176
+
177
+ | API | Purpose |
178
+ | --- | --- |
179
+ | [`GaussianSplatRenderer`](docs/GaussianSplatRenderer.md) | Integrates with Three.js and generates, sorts, and draws every visible Splat |
180
+ | [`SplatMesh`](docs/SplatMesh.md) | A transformable, visible, and raycastable Gaussian Splat scene object |
181
+ | [`SplatLoader`](docs/SplatLoader.md) | A Three.js Loader-style PLY/SPZ decoder |
182
+ | [`Splats`](docs/Splats.md) | The built-in mutable Splat source, with per-Splat read and write access |
183
+ | [`SplatSource`](docs/SplatSource.md) | The TypeScript interface implemented by custom Splat sources |
184
+ | [`SplatEdit`](docs/SplatEdit.md) / [`SplatEditSdf`](docs/SplatEdit.md) | SDF-region RGBA editing objects |
185
+ | [`SplatAccumulator`](docs/SplatAccumulator.md) | A low-level generation buffer used by the renderer; normally internal |
186
+ | [`SplatFileType`](docs/SplatFileType.md) | File type enum containing `PLY` and `SPZ` |
187
+
188
+ ## Large world coordinates / GIS / ECEF
189
+
190
+ The renderer keeps large translations separate from float32 local coordinates. Rendering subtracts the camera origin while values are still JavaScript double-precision numbers, and sorting stores one float64 world origin per `SplatMesh` alongside its float32 local centers. This happens automatically and does not move scene objects or change the world-coordinate behavior of `SplatMesh`, Raycaster, or SDF edits.
191
+
192
+ Source Splat centers should still remain local to their mesh wherever possible. Precision already lost by storing absolute ECEF coordinates in a float32 source cannot be recovered during rendering.
193
+
194
+ ## Manual updates and animation
195
+
196
+ By default, the renderer automatically detects object-count, transform, appearance, and camera changes. Use `onFrame` for per-frame animation:
197
+
198
+ ```js
199
+ const splat = new SplatMesh({
200
+ url: "/assets/model.spz",
201
+ onFrame: ({ mesh, time }) => {
202
+ mesh.rotation.y = time * 0.2;
203
+ },
204
+ });
205
+ ```
206
+
207
+ When automatic updates are disabled, call `update()` after the scene or camera changes:
208
+
209
+ ```js
210
+ const splatRenderer = new GaussianSplatRenderer({
211
+ renderer,
212
+ autoUpdate: false,
213
+ });
214
+
215
+ await splatRenderer.update({ scene, camera });
216
+ renderer.render(scene, camera);
217
+ ```
218
+
219
+ ## Offscreen rendering
220
+
221
+ ```js
222
+ const captureRenderer = new GaussianSplatRenderer({
223
+ renderer,
224
+ target: {
225
+ width: 1920,
226
+ height: 1080,
227
+ superXY: 2,
228
+ },
229
+ });
230
+ scene.add(captureRenderer);
231
+
232
+ await captureRenderer.update({ scene, camera });
233
+ const rgba = await captureRenderer.renderReadTarget({ scene, camera });
234
+ // rgba is a 1920 * 1080 * 4 Uint8Array.
235
+ ```
236
+
237
+ If the same scene also contains a `GaussianSplatRenderer` used for canvas display, control the instances with `layers` or `visible` as appropriate so that both are not rendered as ordinary scene objects during the same pass.
238
+
239
+ ## Development
240
+
241
+ Building from source requires Node.js 20.9 or newer, a Rust toolchain installed through `rustup`, and the `wasm32-unknown-unknown` target. `build:wasm` installs `wasm-pack` through Cargo when it is not already available.
242
+
243
+ ```sh
244
+ npm install
245
+ npm run build:wasm
246
+ npm run build
247
+ npm test
248
+ ```
249
+
250
+ Start the local PLY/SPZ viewer with:
251
+
252
+ ```sh
253
+ npm run dev
254
+ ```
255
+
256
+ Open the local URL printed by Vite, normally `http://localhost:8080/`. Drag a `.ply` or `.spz` file onto the viewer, or use its file picker. Files are decoded locally and are not uploaded.
257
+
258
+ Other useful commands:
259
+
260
+ ```sh
261
+ npm run build:watch
262
+ npm run check
263
+ npm run lint
264
+ npm run format
265
+ npm run release:check
266
+ ```
267
+
268
+ The package build emits ESM and CommonJS bundles in `dist/`, together with TypeScript declarations and source maps.
269
+
270
+ ## License
271
+
272
+ Gaussian Splat Lite is licensed under the [Apache License 2.0](LICENSE). Required attribution notices are provided in [NOTICE](NOTICE), and bundled third-party licenses are listed in [THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md).