Introduction
SOG (Spatially Ordered Gaussians) is a compressed format for Gaussian splat scenes
from PlayCanvas. It stores each attribute of the
splats as the pixels of an image, one pixel a splat, saved as lossless WebP, with a
meta.json file that says how to turn the pixels back into values. The
images compress well because the splats are sorted so that neighbouring pixels hold
splats that are close together in space.
A SOG scene is either a folder of these files or a ZIP archive of them, usually
named .sog. The description below is of version 3, the current one;
version 2 differs as listed at the end.
Structure
meta.jsonMetadata version, splat count, ranges, codebooks and the names of the imagesJSONmeans_l.webpPositions, low bytes x, y, z in red, green, bluea pixel a splatmeans_u.webpPositions, high bytes x, y, z in red, green, bluea pixel a splatquats.webpRotations in red, green, bluea pixel a splatscales.webpScales codebook indices for x, y, za pixel a splatsh0.webpColour and opacity codebook indices in red, green, blue; opacity in alphaa pixel a splatshN_centroids.webpHarmonics palette optional64 entries a rowshN_labels.webpHarmonics labels optional: each splat’s palette entrya pixel a splat
Every per-splat image has the same size, and splat i is the pixel at x = i mod W, y = ⌊i / W⌋, counting from the top left, for an image W pixels wide. The image may have more pixels than there are splats; the extra ones are ignored. The images must be lossless, because lossy compression would change the values.
meta.json
| Key | Value |
|---|---|
version | 3 |
count | The number of splats |
asset.generator | The tool that wrote the scene; optional |
model | "antialiased" or "2dgs"; left out for ordinary splats |
means | mins and maxs, three numbers each, and files |
scales | codebook, 256 numbers, and files |
quats | files |
sh0 | codebook, 256 numbers, and files |
opacity | max, only when an opacity is above 1 |
shN | Optional: count (palette entries), bands (1 to 4), codebook (256 numbers) and files |
blind, extras, comments | Optional data for applications |
Readers ignore keys they do not know.
From the pixels to a Gaussian
- Position: for each axis, the high byte from
means_uand the low byte frommeans_lmake a 16-bit value q. Interpolate fromminstomaxsby q / 65535 to get n, then undo the log transform: sign(n) × (e|n| − 1). - Rotation: each byte b of red, green and blue gives p = (b − 128) / 127, a vector (px, py, pz). With r its length and θ = π/2 × r, the quaternion is w = cos θ and (x, y, z) = p × sin θ / r (zero when r is 0). The bytes 128, 128, 128 are no rotation.
- Scale: each channel is an index into the scales codebook, which holds logarithms; the scale is e to the power of the entry.
- Colour: each of red, green and blue in
sh0is an index into the sh0 codebook, and the colour is 0.5 + entry ×SH_C0, withSH_C0= 1 / (2√π). - Opacity: (A / 204)², from the alpha byte A of
sh0. 204 is an opacity of 1, and 255 about 1.5625, which a scene can use for splats that stand for several merged ones.
Spherical harmonics
The harmonics above degree 0 are shared through a palette. Each splat’s label in
shN_labels is red + green × 256 + blue × 65536, the number of its
palette entry. A palette entry has 3, 8, 15 or 24 coefficients a channel for 1, 2, 3 or
4 bands. shN_centroids holds 64 entries a row, so it is
64 × coefficients wide: coefficient c of entry n is the pixel
at u = (n mod 64) × coefficients + c,
v = ⌊n / 64⌋. Its red, green and blue are indices into the
shN codebook for the three channels.
Version 2
| Version 2 | Version 3 | |
|---|---|---|
| Rotation | Smallest three, 26 bits in quats.webp | The vector in red, green and blue described above |
| Opacity | sh0 alpha / 255, at most 1 | (alpha / 204)², at most 1.5625 |
| Harmonics bands | 1 to 3 | 1 to 4 |
| Palette | Up to 65,536 entries, 16-bit labels | Up to 224 entries, 24-bit labels |
| blind, extras, comments, model | Not present | Present |
Positions, scales, base colours, the palette layout and the file layout are the same in both.
Links
Software
- SuperSplat – PlayCanvas’s free open source splat editor (web)
Developers
- splat-transform – converts splat scenes to and from SOG (JavaScript)
- PlayCanvas engine – web 3D engine that loads and draws SOG scenes (JavaScript)
Reference
- SOG format – PlayCanvas’s specification of version 3, with the changes from version 2