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`

Filtering Gaussian Splats

Let's import a messy scene scanned with Scaniverse App:

mesh = Import[FileNameJoin[{"attachments", "Untitled scan-663.spz 2"}], "SPZ"] Next step is to render it and mask parts of interest with a simple cylinder primitive:

Graphics3D[Scale[{mesh, Cylinder[{{0.0053`,-0.0088`,0.0077`},{0.0017`,0.0902`,0.0119`}}, 0.7/30.0]}, 100], "OrthographicCameraZoom"->5]

:::tip

Use helper tools such as __drag gizmo__ from the command palette. Apply it on the selected {x,y,z}

:::

Create a region function for faster processing:

f = RegionMember[Cylinder[{{0.0053`,-0.0088`,0.0077`},{0.0017`,0.0902`,0.0119`}}, 0.7/30.0]] Filter splats 🫟

Note that filtering function accepts

[index, center, scales, quaternions, opacity, color]

filtered = SplatMeshFilter[mesh, (f[#2])&]; Graphics3D[filtered, "OrthographicCameraZoom"->26] *Try to zoom in* 💡

Preview using 3D points (compatible with ✨ Mathematica ✨)

filtered["Preview"] Export our modified model:

Export["filtered.spz", filtered, "SPZ"] :::tip

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

:::