Convert 360° equirectangular panoramas into viewable 3D Gaussian Splat files.
- Native 360° Depth Estimation - Uses DAP (Depth Any Panoramas) for equirectangular-aware depth
- SHARP Refinement - Optional high-frequency detail enhancement using Apple's ML-SHARP
- 360° Video Support - Convert video sequences with frame extraction and trimming
- Metric Depth Output - Real-world scale with manual adjustment option
- Standard 3DGS PLY Output - Compatible with gsplat, SuperSplat, SHARP viewers
- Compressed SPLAT Format - ~8x smaller for web delivery
- Web UI - Preview 360° input (with Flat/Sphere modes) and 3D result
- CLI - Batch processing and automation
This section assumes a clean install on a new machine and walks you through each step.
- Install Python 3.10+ from https://www.python.org/downloads/ (check "Add Python to PATH")
- Install Git from https://git-scm.com/downloads
- If you have an NVIDIA GPU, update your driver (recommended for speed)
- Make sure you have an internet connection and a few GB of free space (model weights download on first use)
Open PowerShell and run:
git clone --recurse-submodules https://github.com/cedarconnor/SPAG4d.git
cd SPAG4dIf you already cloned the repo, run this once:
git submodule update --init --recursivepython -m venv .venv
.\.venv\Scripts\activateOn macOS/Linux:
source .venv/bin/activateIf PowerShell blocks activation, run:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSignedThen activate the environment again.
If you have an NVIDIA GPU:
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121If you do not have an NVIDIA GPU:
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpuRecommended (Web UI + downloads, no SHARP):
pip install -e ".[server,download]"Full install (includes Magic Fix / SHARP):
pip install -e ".[all]"ml-sharp is not on PyPI — you must install it manually from GitHub:
# Step 1: Install ml-sharp from GitHub
pip install git+https://github.com/apple/ml-sharp.git
# Step 2: (Optional) Install the sharp extra for documentation/metadata
pip install -e ".[sharp]"SHARP weights (~3GB) are downloaded automatically the first time you use Magic Fix.
Verify SHARP install (optional):
python -c "import sharp; print('ML-SHARP installed successfully')"No module named 'spag4d.dap_arch.DAP.networks': DAP submodule is missing. Rungit submodule update --init --recursive.pythonorpipnot found: reinstall Python and check "Add Python to PATH".- PowerShell blocks activation: run the
Set-ExecutionPolicycommand above, then re-activate the venv.
SHARP works by projecting the 360° image to perspective faces, running inference, and reprojecting:
| Mode | Faces | Quality | Speed | VRAM |
|---|---|---|---|---|
cubemap |
6 | Good | Fast | ~6GB |
icosahedral |
20 | Better | ~3x slower | ~12GB |
Select the projection mode in the UI (dropdown next to "Magic Fix") or via CLI:
python -m spag4d.cli convert input.jpg out.ply --sharp-refine --sharp-projection icosahedral- Start the server:
.\start_spag4d.bat # Or manually: python -m spag4d.cli serve --port 7860
- Open http://localhost:7860 in your browser.
- Upload a panoramic image or video.
- SHARP Refinement: Check the "Magic Fix (SHARP)" box to enable detail enhancement.
- Adjust "Detail Blend" slider to control the strength.
- Click Convert and view the result in the 3D viewer.
- Input Preview: Toggle between 360° Sphere and Flat Equirectangular views.
- Splat Viewer: Use WASD + Mouse to fly, Scroll to zoom. "Outside" center view.
# Basic conversion
python -m spag4d.cli convert panorama.jpg output.ply
# With SHARP refinement
python -m spag4d.cli convert panorama.jpg output.ply \
--sharp-refine \
--scale-blend 0.5 \
--format splat
# Batch processing
python -m spag4d.cli convert ./input/ ./output/ --batch
# Video conversion (automatic frame extraction)
python -m spag4d.cli convert_video input.mp4 output_dir --fps 10 --start 0.0 --duration 5.0from spag4d import SPAG4D
# Initialize with SHARP support
converter = SPAG4D(
device='cuda',
use_sharp_refinement=True
)
result = converter.convert(
input_path='panorama.jpg',
output_path='output.ply',
stride=2,
scale_factor=1.5,
# Enable SHARP for this conversion
use_sharp_refinement=True,
scale_blend=0.5
)
print(f"Generated {result.splat_count:,} Gaussians")| Parameter | Default | Description |
|---|---|---|
stride |
2 | Spatial downsampling (1, 2, 4, 8) |
scale_factor |
1.5 | Gaussian scale multiplier |
thickness |
0.1 | Radial thickness ratio |
global_scale |
1.0 | Depth scale correction |
depth_min |
0.1 | Minimum depth (meters) |
depth_max |
100.0 | Maximum depth (meters) |
sky_threshold |
80.0 | Filter points beyond this distance |
| Parameter | Default | Description |
|---|---|---|
sharp_refine |
False | Enable SHARP refinement |
scale_blend |
0.5 | Blend ratio for geometric vs learned scales (0=Geo, 1=Learned) |
opacity_blend |
1.0 | Blend ratio for opacities |
- Python 3.10+
- CUDA-capable GPU (8GB+ VRAM recommended)
- ffmpeg (for video processing)
SPAG-4D/
├── spag4d/ # Main package
│ ├── dap_arch/ # DAP model wrapper
│ ├── core.py # Main orchestrator
│ ├── sharp_refiner.py # SHARP integration
│ └── ...
├── static/ # Web UI assets
├── api.py # FastAPI backend
├── ml-sharp/ # (Optional) Local ml-sharp dependency
└── TestImage/ # Sample panoramas
