A Python library for image approximation via adaptive 2D Gaussian splatting. Iteratively optimizes a set of splats to reconstruct a target image with minimal memory footprint and allows quantization for shader use.

- 500 Splats after 1000 Epochs
- Adaptive sample splitting and scaling based on gradient magnitude
- Quantized export for ShaderToy as
uvec4arrays - Checkpointing and multi-bit quantization of splat parameters
https://www.shadertoy.com/view/Wc33W4
Install PyTorch
pip install -r requirements.txt-
Place your target image in the project root.
-
Adjust parameters in the
__main__section ofmain.pyif needed (epochs, sample count, thresholds). -
Run training:
python main.py
-
Interrupt with
Ctrl+Cto save the latest checkpoint. -
Automatically copies splat parameters to clipboard, for use in ShaderGraph
num_samples– Initial splat countnum_max_samples– Maximum allowed splatssigma_thre– Minimum standard deviation for splittinggrad_thre– Gradient threshold for adaptive refinementnum_epoch– Total training epochsnum_iter_per_epoch– Iterations per epoch
- Checkpoints saved under
training/<image_basename>/<image_basename>.pt - Quantized variants:
16-bit-quantized-<name>.pt8-bit-quantized-<name>.pt
- Reconstruction and target side-by-side images in
training/<name>/images/ - Clipboard export of
uvec4arrays for ShaderToy
This project is released under the MIT License.