Skip to content

Commit 54090f0

Browse files
updates
1 parent 789e00d commit 54090f0

File tree

1 file changed

+68
-28
lines changed
  • extensions/2.0/Khronos/KHR_gaussian_splatting

1 file changed

+68
-28
lines changed

extensions/2.0/Khronos/KHR_gaussian_splatting/README.md

Lines changed: 68 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,87 @@ Draft
1919

2020
Written against the glTF 2.0 spec.
2121

22+
## Table of Contents
23+
24+
-[Overview](#overview)
25+
-[Adding Gaussian Splats](#adding-gaussian-splats-to-primitives)
26+
-[Splat Data Mapping](#splat-data-mapping)
27+
-[Extension Attributes](#extension-attributes)
28+
-[Transforming Data](#transforming-gaussian-splat-data-for-gltf)
29+
-[Extending glTF Primitive](#extending-gltf-primitive)
30+
-[Implementation](#implementation)
31+
-[Schema](#schema)
32+
-[Known Implementations](#known-implementations)
33+
-[Resources](#resources)
34+
2235
## Overview
2336

24-
Currently, PLY files serve as the de facto standard through their sheer simplicity and ubiquity. This extension aims to bring structure and conformity to the Gaussian Splat space while utilizing glTF to its fullest extent. Gaussian Splats are essentially a superset of a traditional point cloud, so we approached the extension with this mindset. The **position**, **rotation**, **scale**, and **diffuse color** properties are stored as standard attributes on a point primitive. If the point primitive contains the extension the renderer can know to render the point primitive as Gaussian Splats instead of a points.
37+
Currently, PLY files serve as the de facto standard through their sheer simplicity and ubiquity. This extension aims to bring structure and conformity to the Gaussian Splat space while utilizing glTF to its fullest extent. Gaussian splats are essentially a superset of a traditional point cloud, so we approached the extension with this mindset. If the point primitive contains the extension the renderer can know to render the point primitive as Gaussian splats instead of a points. Gaussian splats are defined by a position, color, rotation, and scale. We store these values as attributes on primitives.
38+
39+
This approach allows for an easy fallback in the event the glTF is loaded within a renderer that doesn't support Gaussian splats. In this scenario, the glTF file will render as a sparse point cloud to the user. It also allows for easy integration with existing compression like meshopt.
2540

26-
This approach allows for an easy fallback in the event the glTF is loaded within a renderer that doesn't support Gaussian Splats. In this scenario, the glTF file will render as a sparse point cloud to the user. It also allows for easy integration with existing compression like meshopt.
41+
## Adding Gaussian Splats to Primitives
42+
43+
As Gaussian splats are defined by a position color, rotation and scale, we both map to existing attributes and define new ones. These are attached to a primitive by defining the `extensions.KHR_gaussian_splatting` property on that mesh.
2744

2845
### Splat Data Mapping
2946

30-
| Splat Data | glTF Attribute |
31-
| --- | --- |
32-
| Position | POSITION |
33-
| Color (Diffuse, Spherical Harmonic 0) | COLOR_0 RGB channels |
34-
| Opacity (Spherical Harmonic 0 Alpha) | COLOR_0 A channel |
35-
| Rotation | _ROTATION |
36-
| Scale | _SCALE |
47+
To define a Gaussian splat, it must contain the following attributes:
48+
49+
| Splat Data | glTF Attribute | Accessor Type | Component Type |
50+
| --- | --- | --- | --- |
51+
| Position | POSITION | VEC3 | float |
52+
| Color (SH0 (Diffuse) and alpha) | COLOR_0 | VEC4 | unsigned byte normalized |
53+
| Rotation | _ROTATION | VEC4 | float |
54+
| Scale | _SCALE | VEC3 | float |
55+
56+
Standard PLY splat formats have opacity and color separate, however they are combined into the COLOR_0 attribute here.
3757

38-
Spherical Harmonic channels 1 through 15, which map the splat specular, are currently unused by the extension.
58+
This implementation only contains the zeroth spherical harmonic for diffuse color. Spherical Harmonic channels 1 through 15, which map the splat specular, are currently unused by the extension.
3959

4060
### Extension attributes
4161

42-
| Attributes | Type | Description | Required
62+
`extensions.KHR_gaussian_splatting` may contain the following values:
63+
64+
| Attributes | Type | Description | Required |
4365
| --- | --- | --- | --- |
4466
| quantizedPositionScale | number | Scale value for dequantizing POSITION attribute values | No, default: `1.0` |
4567

68+
```json
69+
{
70+
"extensions": {
71+
"KHR_gaussian_splatting": {
72+
"quantizedPositionScale": 13.228187255859375
73+
}
74+
}
75+
}
76+
```
77+
78+
### Transforming Gaussian Splat Data for glTF
79+
80+
The data output from the Gaussian splat training process that is stored in the typical PLY must be transformed before storing in glTF.
81+
82+
#### Diffuse Color
83+
84+
Each color channel `red`, `green`, and `blue` must each be multiplied by the zeroth-order spherical harmonic constant `0.28209479177387814`
4685

47-
## Extending glTF node
86+
#### Alpha
87+
88+
Alpha must be activated through the logistic function $\sigma(a) = \frac{1}{1 + e^{-a}}$ which constrains it to the range `[0 - 1)`
89+
90+
It can then be converted to an `unsigned byte` color channel.
91+
92+
#### Scale
93+
94+
'Activated' via exponentiation similar to `alpha`. $\exp(x)$
95+
96+
#### Rotation
97+
98+
Normalized to a unit quaternion
99+
100+
$\hat{q} = \frac{q}{\|q\|} = \frac{q}{\sqrt{q_w^2 + q_x^2 + q_y^2 + q_z^2}}$
101+
102+
## Extending glTF Primitive
48103

49104
Sample:
50105

@@ -92,25 +147,13 @@ Sample:
92147
}
93148
```
94149

95-
## Gaussian Splats
96-
97-
Before storing values into attributes, the data will have been preprocessed from the Gaussian Splat training process.
98-
99-
| Attribute | Process |
100-
| --- | --- |
101-
| Alpha | Activated through logistic function `sigmoid(a) = 1 / (1 + e^(-a))` |
102-
| Scale | Natural exponentiation `exp(scale)` |
103-
| Rotation | Normalized Quaternion |
104-
| Diffuse Color | Multiplied by zero-order spherical harmonic constant `0.28209479177387814` |
105-
106-
107150
## Implementation
108151

109152
_This section is non-normative_
110153

111154
In this example, we follow a reference implementation for rendering Gaussian Splats.
112155

113-
In the vertex shader, we first must compute covariance in 3D and then 2D space. In optimizing implementations, 3D covariance can be computed ahead of time.
156+
In the vertex shader, we first must compute covariance in 3D and then 2D space. In optimizing implementations, 3D covariance can be computed ahead of time.
114157

115158
```glsl
116159
//https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/59f5f77e3ddbac3ed9db93ec2cfe99ed6c5d121d/cuda_rasterizer/forward.cu#L118
@@ -210,13 +253,10 @@ if(alpha < 1./255.)
210253
splatColor = vec4(color * alpha, alpha);
211254
```
212255

213-
214256
## Schema
215257

216258
[Gaussian Splatting JSON Schema](./schema/primitive.KHR_gaussian_splatting.schema.json)
217259

218-
219-
220260
## Known Implementations
221261

222262
This is currently implemented within [3D Tiles and CesiumJS as an experimental feature](https://github.com/CesiumGS/cesium/tree/splat-shader).

0 commit comments

Comments
 (0)