MLX3D¶
Differentiable 3D computer vision on Apple Silicon, built on MLX.
MLX3D brings the PyTorch3D workflow to Macs: batched 3D data structures, cameras, differentiable rendering, and modern view-synthesis methods (NeRF and 3D Gaussian Splatting) — all running natively on the Apple GPU through MLX, with the Gaussian Splatting and mesh rasterizers implemented as custom Metal kernels.
All rendered through MLX3D: a Phong-lit mesh, a hash-grid NeRF on the Lego scene, a 3D Gaussian Splatting checkpoint trained on the truck scene, and two-sided mesh shading.
Highlights¶
- Data structures — batched
MeshesandPointcloudswith list / packed / padded views, differentiable through construction. - Cameras & transforms — OpenCV-convention pinhole
Camera(drop-in for COLMAP / NeRF datasets) and a full set of rotation conversions. - Geometry ops & losses — k-NN, chamfer distance, surface sampling, Laplacian smoothing, edge length and normal consistency losses, PSNR/SSIM.
- NeRF — positional encoding, the NeRF MLP, stratified + hierarchical sampling and volume rendering, with a training script for the Blender synthetic scenes.
- Mesh rendering — differentiable soft triangle rasterization, OBJ/MTL texture loading and UV sampling, plus scalar-field mesh extraction.
- 3D Gaussian Splatting — a Metal translation of the reference CUDA rasterizer: tile-based forward and backward kernels wrapped in
mx.custom_function, EWA and 3DGUT-style UT projection, spherical harmonics, anti-aliased and arbitrary feature rendering, adaptive density control, COLMAP loading, and standard.plycheckpoints viewable in any splat viewer. - Feed-forward geometry — Depth Anything 3: photos → per-view depth, intrinsics and poses in one forward pass, with official pretrained weights.
- Real-world training — foreground masks (masked or transparent cut-out), per-image exposure compensation, and depth / normal priors.
- Spaghetti Splatting — curve-segment primitives for thin structures, a strict superset of 3DGS.
- Interactive viewer —
mlx3d-viewopens any 3DGS checkpoint in the browser with orbit/pan/zoom, rendered live by the Metal kernels; NeRFs are supported too. - IO — OBJ and PLY (ascii/binary) loading and saving, including 3DGS checkpoint layouts.
What's new¶

- Photos → splat in one command —
mlx3d-captureturns a photo folder or phone video into a trained splat, with poses from Depth Anything 3, COLMAP or a built-in SfM. - Feed-forward geometry — depth, intrinsics and poses for any number of photos in one forward pass, matching the official implementation to ~1e-6.
- Real-world training — foreground masks, exposure compensation and depth priors for phone captures.
- Fast viewing — a forward-only rasterizer 1.5–2× faster than the training path, including 4D sequence playback.
See the changelog for everything in each release.
Installation¶
pip install mlx3d
Requires an Apple Silicon Mac (M1 or newer) and Python ≥ 3.11.
A 60-second taste¶
import mlx.core as mx
from mlx3d.cameras import Camera
from mlx3d.splatting import GaussianModel
# Random colored Gaussians...
model = GaussianModel.from_points(
points=mx.random.normal((10_000, 3)) * 0.5,
colors=mx.random.uniform(shape=(10_000, 3)),
)
# ...rendered from a camera, differentiably, on the Apple GPU.
camera = Camera.look_at(eye=(0, 0, -4), at=(0, 0, 0), width=1280, height=720)
out = model.render(camera)
print(out["image"].shape) # (720, 1280, 3)
For checkpoints and mesh assets, render from the shell:
mlx3d-render point_cloud.ply --out render.png --antialias
mlx3d-render mesh.glb --type mesh --mode depth --out depth.png
mlx3d-eval point_cloud.ply --data scene/ --format colmap --views 20
Continue with the Quickstart, then pick a tutorial:
| Tutorial | What you build |
|---|---|
| Mesh Optimization | Deform a sphere into a target shape with chamfer + regularizers |
| Point Cloud Fitting | Optimize raw points with chamfer distance |
| NeRF | Train a neural radiance field on the Blender synthetic scenes |
| Gaussian Splatting | Train 3DGS on a COLMAP scene with the Metal rasterizer |