-
Notifications
You must be signed in to change notification settings - Fork 330
Add initial SOG format support #478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds initial support for the SOG (Spatially Ordered Gaussians) scene format to GaussianSplats3D, enabling loading of both bundled .sog archives and multi-file SOG directories.
Key changes include:
- Implementation of a minimal ZIP reader for browser-based .sog archive extraction (STORE method only)
- SOG parser that reconstructs 3D Gaussian splats from WebP-encoded data using quantization and codebooks
- Integration with existing loader infrastructure and viewer components
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/loaders/sog/ZipReaderBrowser.js | Minimal ZIP reader supporting STORE compression for .sog archives |
| src/loaders/sog/SogParser.js | Core parser for SOG format data reconstruction from WebP images |
| src/loaders/sog/SogLoader.js | Main loader with support for both directory and ZIP-based SOG files |
| src/loaders/Utils.js | Added SOG format detection for .sog file extensions |
| src/loaders/UncompressedSplatArray.js | Fixed spherical harmonics data placement in splat components |
| src/loaders/SceneFormat.js | Added SOG format enum value |
| src/index.js | Exported SogLoader for public API |
| src/Viewer.js | Integrated SOG loading support into main viewer |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| const rIdx = centroidsImg.data[cidx + 0]; | ||
| const gIdx = centroidsImg.data[cidx + 1]; | ||
| const bIdx = centroidsImg.data[cidx + 2]; | ||
| rest[j + 0 * shNCoeffsWanted] = shNCodebook[rIdx] ?? 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code here createed a sequential layout [R0, R1, R2, ..., G0, G1, G2, ..., B0, B1, B2, ...], but the renderer expects an interleaved lauout.
The code here should be changed to something like this:
const shIndexMap = [
0, 1, 2, 9, 10, 11, 12, 13, 24, 25, 26, 27, 28, 29, 30, // R channel indices
3, 4, 5, 14, 15, 16, 17, 18, 31, 32, 33, 34, 35, 36, 37, // G channel indices
6, 7, 8, 19, 20, 21, 22, 23, 38, 39, 40, 41, 42, 43, 44 // B channel indices
];
for (let j = 0; j < 3; j++) {
for (let k = 0; k < shNCoeffsWanted; k++) {
const u = (label % 64) * shNCoeffsTotal + k;
const v = Math.floor(label / 64);
if (u < centroidsImg.width && v < centroidsImg.height) {
const cidx = (v * centroidsImg.width + u) * 4;
const codebookIdx = centroidsImg.data[cidx + j];
const outIndex = shIndexMap[j * 15 + k];
if (outIndex < restCount) {
rest[outIndex] = shNCodebook[codebookIdx] ?? 0;
}
}
}
}
Issue: #476
This PR adds first-class support for the SOG (Spatially Ordered Gaussians) scene format to GaussianSplats3D. It enables loading both:
Limitations and follow-ups
Zipreader supports only STORE (no DEFLATE). This matches thesplat-transformwriter.