Skip to content
プロジェクト

概要

A fast, lightweight 3D viewer for Python based on WGPU

デザイン・メディア

この数値の測り方

できること

  • Objects: meshes, points, lines, volumes, tubes and sparse volumes (tens of millions of voxels, including run-length encoded ones) - see Adding Objects
  • Looks good out of the box: shadows, ambient occlusion and a light that follows the camera are on by default; environment lighting, matcaps, outlines, silhouettes, subsurface scattering, depth of field, tone mapping and gradient backgrounds are one call away - see Effects & Shading
  • Animations: orbit, fly between views and zoom, then play it in the viewer or render it to .mp4, .gif or PNGs - see Animations
  • Many objects: optionally merge objects into fewer draw calls for scenes made of thousands of small objects, while still hiding, colouring and picking them one by one - see Managing Objects

計測したスター増加

24時間
0
7日間
0
15日間
0
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

octarine banner

Octarine is the eighth color of the Discworld's spectrum, which is described as the color of magic itself. Only wizards and cats can see it.

docs

Octarine

A minimalist, easy-to-use, high-performance 3D viewer. Octarine is built on top of the excellent pygfx WGPU rendering engine which does most of the heavy lifting - we're simply abstracting away some of the boiler plate code for you.

Rationale :thought_balloon:

Why another 3D viewer? There are plenty options out there: vedo, ipygany, polyscope, napari, fury, plotly or pyvista to name but a few. All of these are great in their own right but I wanted something (a) without heavy dependencies (i.e. no VTK), (b) that lets me interactively explore my data in both REPL and Jupyter and (c) is very performant. None of the existing solutions ticked all those boxes for me.

Octarine tries to fill that gap:

  1. Lightweight with very few direct or indirect dependencies.
  2. Works in both Jupyter and REPL.
  3. High performance: a mesh with 15M faces renders with 80 fps at 1080p on a 2023 MacBook Pro.

Features :sparkles:

  • Objects: meshes, points, lines, volumes, tubes and sparse volumes (tens of millions of voxels, including run-length encoded ones) - see Adding Objects
  • Looks good out of the box: shadows, ambient occlusion and a light that follows the camera are on by default; environment lighting, matcaps, outlines, silhouettes, subsurface scattering, depth of field, tone mapping and gradient backgrounds are one call away - see Effects & Shading
  • Animations: orbit, fly between views and zoom, then play it in the viewer or render it to .mp4, .gif or PNGs - see Animations
  • Many objects: optionally merge objects into fewer draw calls for scenes made of thousands of small objects, while still hiding, colouring and picking them one by one - see Managing Objects
  • Controls: a control panel with legend, effects, screenshots and animations; keep the cameras of several viewers in sync - see Viewer Controls

Installation :rocket:

pip install "octarine3d[all]"

Octarine requires Python 3.11 or later. The above will install the minimal requirements plus PySide6 and jupyter_rfb as window managers for IPython/shell and Jupyter, respectively. Check out the Install Instructions for details.

Quickstart :fire:

# Create a Viewer instance
from octarine import Viewer
v = Viewer()

# Add random points as scatter
import numpy as np
points = np.random.rand(10, 3)  # 10 random points
v.add(points)

# Clear scene
v.clear()

# Add a mesh (see also `Viewer.add_mesh`)
import pygfx as gfx
m = gfx.geometries.mobius_strip_geometry()
v.add(m, color='b')

# Close the viewer
v.close()

[!NOTE] The above example will work in interactive environments such as IPython and Jupyter. When using from the standard REPL or when running as a script you will have to additionally start the event loop. Please see the corresponding section in the Introduction.

demo gif

Want to learn more?

Head over to the Documentation!

Want to contribute?

We welcome all kinds of contributions. For example:

  • reports of bugs, broken examples, etc.
  • feature requests
  • pull requests with bug fixes or new features

If you already know what needs doing, feel free to open a pull request right away. When in doubt please open an issue so we can discuss the best way to address the issue.

Development :dash:

Tests

To run the test suite:

pip install -e .[dev]
pytest -v

Most tests render with an offscreen canvas, so they need a working GPU driver but no window. Tests for the Qt control panel are run if PySide6 is installed.

Docs

To generate the documentation:

pip install -e .[docs]
mkdocs build

関連プロジェクトを探す

読み込み中…