Skip to content

Commit 03f1934

Browse files
committed
Updates to the SPZ extension.
1 parent fa056f0 commit 03f1934

File tree

1 file changed

+47
-26
lines changed
  • extensions/2.0/Khronos/KHR_gaussian_splatting_compression_spz

1 file changed

+47
-26
lines changed

extensions/2.0/Khronos/KHR_gaussian_splatting_compression_spz/README.md

Lines changed: 47 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,14 @@ At rest, the 3D Gaussian splats are stored within the SPZ compression format. Up
4444

4545
## Compressing 3D Gaussian splats using SPZ
4646

47-
If a primitive contains an `extension` property which defines both `KHR_gaussian_splatting` and `KHR_spz_gaussian_splats_compression` then support for SPZ compression is required. There is no requirement for a backup uncompressed buffer.
47+
To use this extension, it must be defined in the `extensions` property in a `KHR_gaussian_splatting` extension definition. Any mesh primitive using `KHR_gaussian_splatting` that is using this extension will use the SPZ payload to retreive the values for `POSITION`, `COLOR_0`, `KHR_gaussian_splatting:SCALE`, `KHR_gaussian_splatting:ROTATION`, and all `KHR_gaussian_splatting:SH_DEGREE_ℓ_COEF_n` attributes. The [attribute mapping](#attribute-mapping) section defines how the SPZ data is mapped to these attributes.
4848

49-
The extension must be listed in `extensionsUsed` alongside `KHR_gaussian_splatting`.
49+
The extension must then be listed in `extensionsUsed` alongside `KHR_gaussian_splatting`.
5050

5151
```json
5252
"extensionsUsed" : [
5353
"KHR_gaussian_splatting",
54-
"KHR_spz_gaussian_splats_compression"
55-
]
56-
```
57-
58-
It must also be listed in `extensionsRequired`. When `KHR_spz_gaussian_splats_compression` is in use, the `KHR_gaussian_splatting` extension must also be listed as required.
59-
60-
```json
61-
"extensionsRequired" : [
62-
"KHR_gaussian_splatting",
63-
"KHR_spz_gaussian_splats_compression"
54+
"KHR_gaussian_splatting_compression_spz"
6455
]
6556
```
6657

@@ -70,25 +61,29 @@ As this extension extends the base extension, all components of the base extensi
7061

7162
### Schema Example
7263

73-
Example SPZ extension shown below. This extension only affects any `primitive` nodes containting Gaussian splat data. Note that unlike the base `KHR_gaussian_splatting` extension, the `indices` property is excluded, and a `bufferView` is provided by the extension. This bufferview points to where the SPZ blob is stored.
64+
Example SPZ extension shown below. This extension only affects any `primitive` nodes containting Gaussian splat data. A `bufferView` is provided by the extension which points to where the SPZ blob is stored.
7465

7566
```json
7667
"meshes": [{
7768
"primitives": [{
7869
"attributes": {
7970
"POSITION": 0,
8071
"COLOR_0": 1,
81-
"_SCALE": 2,
82-
"_ROTATION": 3,
83-
"_SH_DEGREE_1_COEF_0": 4,
84-
"_SH_DEGREE_1_COEF_1": 5,
85-
"_SH_DEGREE_1_COEF_2": 6
72+
"KHR_gaussian_splatting:SCALE": 2,
73+
"KHR_gaussian_splatting:ROTATION": 3,
74+
"KHR_gaussian_splatting:SH_DEGREE_1_COEF_0": 4,
75+
"KHR_gaussian_splatting:SH_DEGREE_1_COEF_1": 5,
76+
"KHR_gaussian_splatting:SH_DEGREE_1_COEF_2": 6
8677
},
8778
"material": 0,
8879
"mode": 0,
8980
"extensions": {
90-
"KHR_spz_gaussian_splats_compression": {
91-
"bufferView": 0,
81+
"KHR_gaussian_splatting": {
82+
"extensions": {
83+
"KHR_gaussian_splatting_compression_spz": {
84+
"bufferView": 0,
85+
}
86+
}
9287
}
9388
}
9489
}]
@@ -109,29 +104,55 @@ Example SPZ extension shown below. This extension only affects any `primitive` n
109104

110105
This property points to the bufferView containing the Gaussian splat data compressed with SPZ.
111106

107+
### Attribute Mapping
108+
109+
Data may be used directly from SPZ or may be mapped to the placeholder attributes this extension provides. When mapping to attributes, the data from SPZ is mapped from the `GaussianCloudData` struct in SPZ to the following attributes in glTF. Several fields require additional conversion to make them glTF and renderer ready.
110+
111+
| SPZ `GaussianCloudData` field | glTF Attribute | Required Conversion |
112+
| --- | --- |
113+
| `positions` | `POSITION` | |
114+
| `colors` | `COLOR_0` RGB components | Compute _0.5 + 0.282095 * x_ to get the color between 0 and 1. |
115+
| `alphas` | `COLOR_0` A component | Compute the sigmoid to get the alpha between 0 and 1. (Sigmoid formula: _1 / (1 + e^-x)_) |
116+
| `scales` | `KHR_gaussian_splatting:SCALE` | Compute the base-e exponential of each scale value. (e.g. _e^x_ or `std::exp(x)`) |
117+
| `rotations` | `KHR_gaussian_splatting:ROTATION` | |
118+
| `sh` index 0 to 2 | `KHR_gaussian_splatting:SH_DEGREE_1_COEF_0` | |
119+
| `sh` index 3 to 5 | `KHR_gaussian_splatting:SH_DEGREE_1_COEF_2` | |
120+
| `sh` index 6 to 8 | `KHR_gaussian_splatting:SH_DEGREE_1_COEF_3` | |
121+
| `sh` index 9 to 11 | `KHR_gaussian_splatting:SH_DEGREE_2_COEF_0` | |
122+
| `sh` index 12 to 14 | `KHR_gaussian_splatting:SH_DEGREE_2_COEF_1` | |
123+
| `sh` index 15 to 17 | `KHR_gaussian_splatting:SH_DEGREE_2_COEF_2` | |
124+
| `sh` index 18 to 20 | `KHR_gaussian_splatting:SH_DEGREE_2_COEF_3` | |
125+
| `sh` index 21 to 23 | `KHR_gaussian_splatting:SH_DEGREE_2_COEF_4` | |
126+
| `sh` index 24 to 26 | `KHR_gaussian_splatting:SH_DEGREE_3_COEF_0` | |
127+
| `sh` index 27 to 29 | `KHR_gaussian_splatting:SH_DEGREE_3_COEF_1` | |
128+
| `sh` index 30 to 32 | `KHR_gaussian_splatting:SH_DEGREE_3_COEF_2` | |
129+
| `sh` index 33 to 35 | `KHR_gaussian_splatting:SH_DEGREE_3_COEF_3` | |
130+
| `sh` index 36 to 38 | `KHR_gaussian_splatting:SH_DEGREE_3_COEF_4` | |
131+
| `sh` index 39 to 41 | `KHR_gaussian_splatting:SH_DEGREE_3_COEF_5` | |
132+
| `sh` index 42 to 44 | `KHR_gaussian_splatting:SH_DEGREE_3_COEF_6` | |
133+
112134
### Accessors
113135

114136
Accessor requirements are modified from the base `KHR_gaussian_splatting` extension with the following adjustments to definition:
115137

116-
- SPZ compressed attributes must not include `bufferView` nor `byteOffset`. (See: [Conformance](#conformance))
117138
- Accessor `type` is defined for the resulting type after decompression and dequantization has occurred.
118139
- The accessor `count` must match the number of points in the compressed SPZ data.
119140

120141
## Conformance
121142

122143
The recommended process for handling SPZ compression is as follows:
123144

124-
- If the loader does not support `KHR_gaussian_splatting` and `KHR_spz_gaussian_splats_compression`, it must fail.
125-
- If the loader does support `KHR_gaussian_splatting` and `KHR_spz_gaussian_splats_compression` then:
145+
- If the loader does not support `KHR_gaussian_splatting_compression_spz` and `accessor.bufferView` is undefined, other extensions may be providing the data.
146+
- If the loader does not support `KHR_gaussian_splatting_compression_spz` and `accessor.bufferView` is defined, accessor data should be sourced as usual.
147+
- If the loader does support `KHR_gaussian_splatting_compression_spz` then the loader must process `KHR_gaussian_splatting_compression_spz` data first. The loader must get the data from `KHR_gaussian_splatting_compression_spz`'s `bufferView` extension property.
126148

127-
- The loader must process `KHR_spz_gaussian_splats_compression` data first. The loader must get the data from `KHR_spz_gaussian_splats_compression`'s `bufferView` property.
128-
- SPZ compressed attributes must not include `bufferView` nor `byteOffset` in their accessor declarations. Any attributes falling outside the SPZ format, however, must be stored as regular glTF attributes and must therefore include `bufferView` (and optionally `byteOffset`) in their accessor definitions.
149+
This allows for a graceful fallback when an implementation does not support this extension.
129150

130151
When compressing or decompressing the SPZ data to be stored within the glTF, you must specify a Left-Up-Front (`LUF`) coordinate system in the SPZ `PackOptions` or `UnpackOptions` within the SPZ library. This ensures that the data is compressed and decompressed appropriately for glTF.
131152

132153
## Schema
133154

134-
[SPZ Compression Schema](./schema/mesh.primitive.KHR_spz_gaussian_splats_compression.schema.json)
155+
[SPZ Compression Schema](./schema/mesh.primitive.KHR_gaussian_splatting_compression_spz.schema.json)
135156

136157
## Known Implementations
137158

0 commit comments

Comments
 (0)