Skip to main content

Lightweight 3D mesh and point cloud viewer that opens an interactive browser tab. No Open3D, no VTK, no heavy dependencies.

Project description

shapeviz

A lightweight 3D mesh and point cloud viewer that opens an interactive browser tab.

No Open3D. No VTK. No 500 MB install that breaks every time you change Python versions. Just pip install shapeviz, point it at a file, call view(), and a beautiful interactive 3D viewer opens in your browser — powered by Three.js loaded straight from a CDN.

import shapeviz

shapeviz.view("mesh.ply")
shapeviz.view("cloud.xyz", mode="pointcloud", point_size=2)
shapeviz.compare("before.ply", "after.ply")   # side by side

Why shapeviz?

If you work with 3D geometry in Python — robotics, point-cloud ML, NeRF, mesh processing, game assets — your options for just looking at the thing are heavy. Open3D and VTK are powerful but large, native, and notoriously fragile across Python/OS versions.

shapeviz is the opposite:

shapeviz Open3D
Install size a few KB ~500 MB
Required dependencies zero many native libs
Rendering Three.js in your browser native OpenGL window
Works over SSH / in notebooks ✅ (browser / inline IFrame) ✗ awkward
Breaks on Python upgrade basically never often

numpy and scipy are optional — install them only if you want faster mesh processing. Everything works without them.


Installation

pip install shapeviz

Optional extras:

pip install "shapeviz[numpy]"   # faster normal computation / heatmaps
pip install "shapeviz[full]"    # numpy + scipy
pip install "shapeviz[dev]"     # contributor tooling (pytest, ruff, build…)

Requires Python 3.9+. Works on Windows, macOS, and Linux.


Supported formats

Extension Type ASCII Binary
.ply mesh / point cloud
.obj mesh (with vertex colors)
.stl mesh
.xyz, .xyzrgb, .pts point cloud (XYZ / XYZRGB / XYZ+normals)
.pcd point cloud

The loader auto-detects meshes vs. point clouds and reads vertex colors and normals when present.


Python API

view(source, **options)

Open a single mesh or point cloud.

import shapeviz

# From a file path...
shapeviz.view("bunny.ply")

# ...or from an in-memory object you built yourself.
from shapeviz import Mesh
m = Mesh(vertices=[[0,0,0],[1,0,0],[0,1,0]], faces=[[0,1,2]])
shapeviz.view(m)

Common options (all keyword-only):

Option Values Description
mode "solid", "wireframe", "pointcloud", "normals" initial render mode
color_mode "solid", "vertex", "normals", "heatmap" initial coloring
point_size float point size for clouds
color hex string, e.g. "#6cb6ff" solid color
background hex string background color
show_axes bool show XYZ axes on start
show_grid bool show the ground grid
compute_normals bool compute per-vertex normals for meshes that lack them
open_browser bool open the system browser (default True)
inline bool force/disable inline Jupyter rendering (default: auto)
return_html bool return the raw HTML string instead of viewing
shapeviz.view("cloud.xyz", mode="pointcloud", point_size=3, color_mode="heatmap")
shapeviz.view("part.stl", color="#ff8866", compute_normals=True)

compare(*sources, titles=None, **options)

Show two or more geometries side by side with synchronised cameras — rotate one, they all rotate. Perfect for before/after, ground-truth vs. prediction, raw vs. filtered.

shapeviz.compare("before.ply", "after.ply")
shapeviz.compare(raw, filtered, meshed, titles=["raw", "filtered", "meshed"])

save_html(source, path, **options)

Render to a standalone .html file you can email, embed, or open later. (The only external thing it needs is the Three.js CDN at view time.)

shapeviz.save_html("scan.pcd", "report.html", color_mode="heatmap", point_size=2)

load(path)

Just parse a file into geometry without rendering.

g = shapeviz.load("mesh.ply")
print(g)                       # <Mesh 'mesh.ply' vertices=35947 faces=69451 ...>
print(g.num_vertices, g.bounds())

Interactive viewer controls

Once the viewer opens, a floating panel gives you:

  • Render mode — solid · wireframe · point cloud · normals overlay
  • Color mode — solid color · vertex colors · normals-as-color · heatmap (by Z)
  • Solid color picker and point size slider
  • Toggles for grid, axes, and a light/dark background
  • Sync cameras (in compare mode)
  • Reset view and Screenshot (saves a PNG)

Mouse: drag to rotate · right-drag to pan · scroll to zoom.


Command line

shapeviz installs a shapeviz command:

shapeviz view mesh.ply
shapeviz view cloud.xyz --mode pointcloud --point-size 3 --color-mode heatmap
shapeviz compare before.ply after.ply
shapeviz save mesh.ply out.html --color "#ff8866"
shapeviz info cloud.pcd          # print stats without rendering

shapeviz view/compare start a tiny local HTTP server and open your browser; press Ctrl+C to stop. Add --no-browser to start the server without opening a tab. Run shapeviz --help or shapeviz <command> --help for all options.


Jupyter notebooks

Inside a notebook, view() and compare() render inline automatically via an IFrame — no server, no new tab:

import shapeviz
shapeviz.view("mesh.ply", height=500)

Use inline=False to force a browser tab instead, or inline=True to force inline rendering outside a notebook.


How it works

  1. Parse the file in pure Python into a Mesh or PointCloud.
  2. Serialise vertices/faces/colors/normals into a compact JSON payload.
  3. Embed that payload into a self-contained HTML document that pulls Three.js from a CDN and builds a BufferGeometry in the browser.
  4. Serve it from Python's built-in http.server (or inline it as a data-URI IFrame in Jupyter, or write it to disk with save_html).

No native rendering, no GPU drivers to fight with — your browser already has a great WebGL renderer.


Development

git clone https://github.com/amanmukati09/shapeviz.git
cd shapeviz
python -m venv .venv
.venv\Scripts\activate           # Windows
# source .venv/bin/activate      # macOS/Linux
pip install -e ".[dev]"
pytest
ruff check src tests

The test suite generates tiny sample files for every format on the fly and runs both with and without numpy, so it verifies the pure-Python fallbacks too.


License

MIT © Tushar Mukati. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shapeviz-0.1.0.tar.gz (28.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shapeviz-0.1.0-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file shapeviz-0.1.0.tar.gz.

File metadata

  • Download URL: shapeviz-0.1.0.tar.gz
  • Upload date:
  • Size: 28.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for shapeviz-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9cdf4f44f7acf5dea5485d959ae66306d2d99e9990c16a341c6e3679fe09f7f7
MD5 830bdd2a38bdb4b872280da23fc4d5ac
BLAKE2b-256 aad3d031a63f4817f76eb867c5719ee2e8258d9675d8f772b062b151439f1e26

See more details on using hashes here.

File details

Details for the file shapeviz-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: shapeviz-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for shapeviz-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf08ae224c8d584e550c71a1715f003ce08d3182dd85ea1f05df262f59a4f347
MD5 baf8cf43cd58517aad58171853cc261b
BLAKE2b-256 a688554c3ae3579184dd408fe44f943efe9b3fe066be92fc8d8878a8b37061b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page