SplatMesh 🫟

SplatMesh is a small Wolfram Language [paclet](https://github.com/JerryI/wl-splatmesh) for importing, manipulating, and exporting Gaussian splatting meshes (`.spz` files). It provides a compact in-memory representation of splats (centers, scales, orientations, color and opacity data) using [SPZ format](https://github.com/nianticlabs/spz), extends default `Import`, `Export` expressions, allows bulk operations, simple transformations, and a lightweight preview using Wolfram Standard Library.

https://github.com/JerryI/wl-splatmesh

Compatible with:

- ==Mathematica== (no 3D render, only points preview)

- ==WLJS Notebook==

Load the library

*if you run it from examples directory*

PacletDirectoryLoad[NotebookDirectory[]]; <<CoffeeLiqueur`Workshop`SplatMesh` Import a butterfly

mesh = Import[FileNameJoin[{"Examples", "butterfly.spz"}], "SPZ"] Show properties and a preview using 3D points

mesh["Properties"] mesh["Preview"] :::tip

__A note for WLJS Notebook users__

This paclet is intentionally tiny and designed to integrate with open-source [Spark.js](https://sparkjs.dev/) ✨ library for GPU-based rendering in browser contexts. Since WLJS Notebook is a web-based app, **you can fully render and integrate Gaussian splats with your Graphics3D routies**

:::

Graphics3D[{ GeometricTransformation[ mesh, RotationMatrix[-75Degree, {1,1,0}] ] }] teapot = (*VB[*)(Uncompress@Get[FileNameJoin[{".iconized", "None-705.wl"}]])(*,*)(*"1:eJxTTMoPSmNhYGAo5gUSYZmp5S6pyflFiSX5RcEcQBHP5Py8zKrUlMwbdxkZ0phACkGqg0pzUoNZgQyfxKTUnGCQkF9+XiqaAhDDLTMnFSwSUlSaCgDo1BoX"*)(*]VB*); Graphics3D[{ Scale[ Import[FileNameJoin[{"Examples", "tap.spz"}], "SPZ"] , 10], Brown, MeshMaterial[MeshPhysicalMaterial[]], Directive["Roughness"->0, "Metalness"->0.5], Translate[Rotate[teapot, 3.14 0.9], (*VB[*)(Uncompress["1:eJxTTMoPSmNmYGAoZgESPpnFJUWhB1cs8XO4vL8ov5HlaL/h2/1FLr/evj5g+XM/AFN1E4U="])(*,*)(*"1:eJxTTMoPSmNmYGAo5gUSYZmp5S6pyflFiSX5RcEcQBHP5Py8zKrUlMwCICeNCaSQBUgEleakBrMCGT6JSak5wSAhv/y8VADqehJr"*)(*]VB*)], PointLight[White, {0,0,6}], HemisphereLight[White, Gray] }, "OrthographicCameraZoom"->0.8, Lighting->None] *Try to zoom in* 💡

Transformations

Apply rotation matrix:

rotated = TransformedSplat[ mesh, RotationMatrix[Pi/2, {1,0,0}] // N ]; Export transformed model

Export["butterfly_rotated.spz", rotated, "SPZ"] Append more splats to a mesh

Append[mesh, { {0.,0.,0.}, {0.01, 0.1, 0.9}, {.0, .0, .0, 1.0}, 1.0, {1.0,.0,.0} }] // Graphics3D :::tip

See [README.md](https://github.com/JerryI/wl-splatmesh) for more API features

:::