@playcanvas/supersplat-viewer 1.20.0 → 1.20.1

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.
package/README.md CHANGED
@@ -15,19 +15,46 @@ This is the official viewer for [SuperSplat](https://superspl.at).
15
15
 
16
16
  The web app compiles to a simple, self-contained static website.
17
17
 
18
- The app supports a few useful URL parameters (though please note these are subject to change):
18
+ ## URL Parameters
19
+
20
+ The app supports a number of URL parameters (these are subject to change):
21
+
22
+ ### Content
19
23
 
20
24
  | Parameter | Description | Default |
21
25
  | --------- | ----------- | ------- |
22
26
  | `settings` | URL of the `settings.json` file | `./settings.json` |
23
- | `content` | URL of the scene file (`.ply`, `.sog`, `.meta.json`, `.lod-meta.json`) | `./scene.compressed.ply` |
27
+ | `content` | URL of the scene file (`.ply`, `.sog`, `.compressed.ply`, `.meta.json`, `.lod-meta.json`) | `./scene.compressed.ply` |
24
28
  | `skybox` | URL of an equirectangular skybox image | |
25
29
  | `poster` | URL of an image to show while loading | |
26
- | `noui` | Hide UI | |
27
- | `noanim` | Start with animation paused | |
28
- | `ministats` | Show runtime CPU/GPU performance graphs | |
29
- | `unified` | Force unified rendering mode | |
30
- | `aa` | Enable antialiasing (not supported in unified mode) | |
30
+ | `collision` | URL of a collision asset (`.glb` mesh, or voxel data). `voxel` is accepted as an alias. | |
31
+
32
+ ### UI
33
+
34
+ | Parameter | Description |
35
+ | --------- | ----------- |
36
+ | `noui` | Hide the UI overlay |
37
+ | `noanim` | Start with animation paused |
38
+ | `ministats` | Show runtime CPU/GPU performance graphs |
39
+
40
+ ### Renderer
41
+
42
+ By default the viewer uses WebGL. The flags below opt into WebGPU rendering paths:
43
+
44
+ | Parameter | Description |
45
+ | --------- | ----------- |
46
+ | `compute` | Use the WebGPU compute renderer |
47
+ | `gpu` | Use the WebGPU GPU sort renderer |
48
+ | `cpu` | Use the WebGPU CPU sort renderer |
49
+ | `aa` | Enable antialiasing (WebGL only) |
50
+ | `nofx` | Disable post effects |
51
+ | `hpr` | Override `highPrecisionRendering` from settings (`?hpr`, `?hpr=1`, `?hpr=true`, `?hpr=enable` to enable) |
52
+ | `budget` | Override the splat budget, in millions of splats |
53
+ | `colorize` | Render with LOD colorization |
54
+ | `fullload` | Load all streaming LOD data before the first frame |
55
+ | `heatmap` | Render the heatmap debug overlay (WebGPU only) |
56
+
57
+ ## NPM Package
31
58
 
32
59
  The web app source files are available as strings for templating when you import the package from npm:
33
60
 
@@ -44,6 +71,22 @@ console.log(css);
44
71
  console.log(js);
45
72
  ```
46
73
 
74
+ The package also exports the settings schema types and helpers via the `/settings` subpath, which is useful for generating, validating or migrating a `settings.json` file:
75
+
76
+ ```ts
77
+ import {
78
+ importSettings,
79
+ validateSettings,
80
+ type ExperienceSettings
81
+ } from '@playcanvas/supersplat-viewer/settings';
82
+
83
+ // throws on invalid input
84
+ validateSettings(json);
85
+
86
+ // migrates a v1 settings object to the latest schema
87
+ const settings: ExperienceSettings = importSettings(json);
88
+ ```
89
+
47
90
  ## Local Development
48
91
 
49
92
  To initialize a local development environment for SuperSplat Viewer, ensure you have [Node.js](https://nodejs.org/) 18 or later installed. Follow these steps:
@@ -71,15 +114,13 @@ To initialize a local development environment for SuperSplat Viewer, ensure you
71
114
 
72
115
  ## Settings Schema
73
116
 
74
- The `settings.json` file has the following schema (defined in TypeScript and taken from the SuperSplat editor):
75
-
117
+ The `settings.json` file uses the schema below (defined in TypeScript and exported from `@playcanvas/supersplat-viewer/settings`). Legacy v1 settings produced by older SuperSplat releases are automatically migrated to v2 on load.
76
118
 
77
119
  ```typescript
78
120
  type AnimTrack = {
79
121
  name: string,
80
122
  duration: number,
81
123
  frameRate: number,
82
- target: 'camera',
83
124
  loopMode: 'none' | 'repeat' | 'pingpong',
84
125
  interpolation: 'step' | 'spline',
85
126
  smoothness: number,
@@ -88,22 +129,51 @@ type AnimTrack = {
88
129
  values: {
89
130
  position: number[],
90
131
  target: number[],
132
+ fov: number[],
91
133
  }
92
134
  }
93
135
  };
94
136
 
137
+ type CameraPose = {
138
+ position: [number, number, number],
139
+ target: [number, number, number],
140
+ fov: number
141
+ };
142
+
143
+ type Camera = {
144
+ initial: CameraPose
145
+ };
146
+
147
+ type Annotation = {
148
+ position: [number, number, number],
149
+ title: string,
150
+ text: string,
151
+ extras?: any,
152
+ camera: Camera
153
+ };
154
+
155
+ type PostEffectSettings = {
156
+ sharpness: { enabled: boolean, amount: number },
157
+ bloom: { enabled: boolean, intensity: number, blurLevel: number },
158
+ grading: { enabled: boolean, brightness: number, contrast: number, saturation: number, tint: [number, number, number] },
159
+ vignette: { enabled: boolean, intensity: number, inner: number, outer: number, curvature: number },
160
+ fringing: { enabled: boolean, intensity: number }
161
+ };
162
+
95
163
  type ExperienceSettings = {
96
- camera: {
97
- fov?: number,
98
- position?: number[],
99
- target?: number[],
100
- startAnim: 'none' | 'orbit' | 'animTrack',
101
- animTrack: string
102
- },
164
+ version: 2,
165
+ tonemapping: 'none' | 'linear' | 'filmic' | 'hejl' | 'aces' | 'aces2' | 'neutral',
166
+ highPrecisionRendering: boolean,
167
+ soundUrl?: string,
103
168
  background: {
104
- color?: number[]
169
+ color: [number, number, number],
170
+ skyboxUrl?: string
105
171
  },
106
- animTracks: AnimTrack[]
172
+ postEffectSettings: PostEffectSettings,
173
+ animTracks: AnimTrack[],
174
+ cameras: Camera[],
175
+ annotations: Annotation[],
176
+ startMode: 'default' | 'animTrack' | 'annotation'
107
177
  };
108
178
  ```
109
179
 
@@ -111,13 +181,30 @@ type ExperienceSettings = {
111
181
 
112
182
  ```json
113
183
  {
114
- "background": {"color": [0,0,0,0]},
115
- "camera": {
116
- "fov": 1.0,
117
- "position": [0,1,-1],
118
- "target": [0,0,0],
119
- "startAnim": "orbit"
120
- },
121
- "animTracks": []
184
+ "version": 2,
185
+ "tonemapping": "none",
186
+ "highPrecisionRendering": false,
187
+ "background": {
188
+ "color": [0, 0, 0]
189
+ },
190
+ "postEffectSettings": {
191
+ "sharpness": { "enabled": false, "amount": 0 },
192
+ "bloom": { "enabled": false, "intensity": 1, "blurLevel": 2 },
193
+ "grading": { "enabled": false, "brightness": 0, "contrast": 1, "saturation": 1, "tint": [1, 1, 1] },
194
+ "vignette": { "enabled": false, "intensity": 0.5, "inner": 0.3, "outer": 0.75, "curvature": 1 },
195
+ "fringing": { "enabled": false, "intensity": 0.5 }
196
+ },
197
+ "animTracks": [],
198
+ "cameras": [
199
+ {
200
+ "initial": {
201
+ "position": [0, 1, -1],
202
+ "target": [0, 0, 0],
203
+ "fov": 60
204
+ }
205
+ }
206
+ ],
207
+ "annotations": [],
208
+ "startMode": "default"
122
209
  }
123
210
  ```