Skip to main content

PyVista and CoDimensional

pyvista-render-passes

SSAA, SSAO, EDL, depth peeling and shadows for PyVista, composed in the one order that works.

PyPI CI MIT license

Marble bust with depth peeling, SSAO, shadows and SSAA

Volume-safe supersampling (SSAA), screen-space ambient occlusion (SSAO), eye-dome lighting (EDL), depth peeling, shadow maps, depth of field and Gaussian blur, driven from plotter.render_passes.

Built and maintained by CoDimensional PBC.

The passes are VTK render passes written in C++ and wrapped for Python. Each wheel carries two builds, one against the stock vtk wheel and one against cvista, and loads the one matching the distribution PyVista is running on.

Install

pip install "pyvista-render-passes[cvista]"  # recommended
pip install "pyvista-render-passes[vtk]"     # stock VTK

Each wheel carries a build for both distributions and loads the one that is installed, preferring cvista when both are; the extra pins the version the build was compiled against. PyVista itself still requires stock vtk, so [cvista] installs both unless the resolver is told otherwise; with uv:

[project]
dependencies = ["pyvista-render-passes[cvista]"]

[tool.uv]
exclude-dependencies = ["vtk"]

or, one-off, uv pip install --excludes <(echo vtk) "pyvista-render-passes[cvista]". See the PyVista install docs for the details and the caveats. Wheels are published for CPython 3.12 to 3.14 on Linux (x86_64, aarch64), and for macOS (arm64) with the cvista build only, since Kitware ships no arm64 wheel SDK. Windows wheels wait on a cvista release whose DLL names the extension can link against. The stock build targets VTK 9.7. PYVISTA_VTK_BACKEND=vtk or =cvista forces the choice, as it does for PyVista; pyvista_render_passes.BACKEND reports it.

Quickstart

import pyvista as pv
import pyvista_render_passes  # registers plotter.render_passes

pl = pv.Plotter()
pl.add_mesh(pv.Sphere(radius=8, center=(8, 0, 0)), opacity=0.5)
pl.add_volume(pv.Wavelet(), opacity='sigmoid')
pl.render_passes.enable_depth_peeling().enable_ssao().enable_anti_aliasing()
pl.show()

Every enable_* / disable_* call only records a setting; the chain is rebuilt before the next render. Call apply() to rebuild immediately, or describe() to see what is enabled:

>>> pl.render_passes.describe()
'DepthPeeling(peels=8) → SSAO(r=1.04, derived) → AntiAliasing'

The SSAO radius is derived from the scene bounds unless one is passed to enable_ssao(radius=...).

get_state() / set_state() round-trip the settings as a plain dict, and preset_interactive(), preset_still() and preset_photo_real() set common combinations.

PyVista's example datasets, rendered by scripts/render_gallery.py into docs/images/<example>/off.png and on.png. The angel statue is by Ivan Nikolov (CC BY 4.0); the Washington bust is a Smithsonian CC0 scan.

OffOn
EDL on a lidar point cloud: enable_edl()
SSAO on a CAD enclosure: enable_ssao()
Shadow maps on a statue: enable_shadows()
SSAA on a finite element mesh: enable_anti_aliasing()
Depth peeling on a translucent floor plan: enable_depth_peeling()
EDL annotation bypass keeps the cube axes and orientation axes out of EDL (text and scalar bars always are), on by default; off is disable_annotation_bypass()
CT volume under an opaque slice with SSAA: off is PyVista's enable_anti_aliasing('ssaa'), which draws the volume through the slice; on is enable_anti_aliasing()
preset_photo_real(): peeling, SSAO, shadows, SSAA

Depth of field and Gaussian blur are VTK's passes unchanged and are not shown; depth of field is driver-sensitive.

Subplots

plotter.render_passes is the active subplot's settings, so each subplot gets its own chain:

pl = pv.Plotter(shape=(1, 3))
grid = pv.ImageData(dimensions=(5, 5, 5)).explode(0.2)

pl.subplot(0, 0)
pl.add_mesh(grid)
pl.add_text('plain')

pl.subplot(0, 1)
pl.add_mesh(grid)
pl.add_text('EDL')
pl.render_passes.enable_edl()

pl.subplot(0, 2)
pl.add_mesh(grid)
pl.add_text('SSAO + SSAA')
pl.render_passes.enable_ssao().enable_anti_aliasing()

pl.link_views()
pl.show()

Three linked subplots: plain, EDL, SSAO with SSAA

Eye-dome lighting, blur and depth of field composite over the whole window from inside one subplot in VTK (#18849), which blanks or whitens the others; the chain confines them to their own tile. pl.render_passes.components lists the subplots configured so far.

Passes without the component

The passes are usable directly on any vtkRenderer:

from pyvista_render_passes import enable_ssaa, enable_ssao, make_split_pass

enable_ssaa(pl, factor=2.0)  # SSAA on every renderer of a plotter

pvRenderPassChain builds the whole graph from a set of flags; pvSSAAVolumePass supersamples while keeping GPU volumes correct; pvPropKeyFilterPass renders a delegate over a tagged subset of the props (used to keep axes and other annotations out of EDL). See docs/design.md for the reasoning behind the chain.

Your own passes in the chain

A package with a pass of its own registers a provider on the plotter and the component composes it into the chain at one of three seams: 'translucent' replaces the translucent stage (and takes over depth peeling), 'base' wraps the scene base below SSAO, 'post' wraps the shaded frame below SSAA.

from pyvista_render_passes import register_pass_provider


@register_pass_provider(pl)
class ToneMapping:
    stage = 'post'

    def build_pass(self, renderer, chain, delegate):
        return vtkToneMappingPass()


@register_pass_provider(pl, stage='base')
def splat_points(renderer, chain, delegate):
    return make_point_splat_pass(delegate)


register_pass_provider(pl, ToneMapping())  # or an instance, directly

build_pass runs on every rebuild; the component releases what it returns. 'base' providers receive the pass they must wrap as delegate and nest in registration order. unregister_pass_provider(pl, ...) takes the same object the registration did.

Why a chain

VTK's render passes compose by delegation: each pass renders its delegate and post-processes the result. The order they are nested in decides whether they work at all, and a few pairs do not compose. plotter.render_passes owns that order so callers only set flags. Innermost first:

Stage Setting Where it sits and why
Lights, opaque, translucent, volumetric always The scene base. Laid out flat rather than through vtkRenderStepsPass, whose own camera pass clears the buffers and would erase anything rendered ahead of it.
Shadow maps enable_shadows() Replace the opaque stage, so opaque geometry is drawn once, with shadows. Needs a scene light away from the camera; the default headlight casts none.
Dual depth peeling enable_depth_peeling() Replaces the translucent stage, but only when another pass is on. Alone, the renderer's built-in peeling is used and no pass is installed at all.
SSAO enable_ssao() Directly above the opaque base. SSAO reads the positions and normals of the props its delegate renders; put above a pass that composites through a full-screen quad (EDL, blur) it sees nothing and does nothing. Translucent props and volumes render after it, over the shaded opaque scene: inside its delegate, dual depth peeling paints translucent geometry with its normals.
EDL enable_edl() Above SSAO. With annotation bypass (the default), tagged props (axes, cube axes, legend scales) render in a second stage after EDL, so their lines are not read as depth discontinuities and painted dark; 2D text and scalar bars sit in the overlay stage and never pass through EDL.
Depth of field, Gaussian blur enable_dof(), enable_blur() Colour post-processing over the shaded frame.
SSAA enable_anti_aliasing() Outermost scene pass: supersamples everything below and resolves colour and depth to the window. Point and line widths are scaled to stay visually constant. Also installed at 1x under EDL, blur and depth of field, which otherwise wipe the other subplots (VTK #18849).
Overlay always Last, at the window: text, scalar bars, legends and point labels are drawn after every pass has resolved, at window resolution. Point labels test against the window depth, which inside a pass's framebuffer is a frame stale and makes them flicker (pyvista #4831).

Rules the component enforces or warns about:

Combination Result
SSAO + depth of field Refused: enable_ssao() and enable_dof() raise ValueError while the other is on.
MSAA + any custom pass Warning; MSAA has no effect once the scene renders into a pass's framebuffer. Use SSAA.
MSAA + depth peeling Warning; multisampling corrupts the depth buffer peeling relies on.
Shadows + EDL Warning; the annotation stage has no shadow-map pass, so annotations are not shadowed.
FXAA Turned off on every apply; SSAA replaces it.
SSAO + translucency Translucent props and volumes are not occlusion-shaded; they composite over the SSAO-shaded opaque scene.
SSAO radius A world-space length, so it is derived from the visible bounds unless passed to enable_ssao(radius=...); get_state() reports a derived one as None.

Pixel correctness

The test suite runs on software GL (llvmpipe) in CI against both distributions and checks the state machine, the chain graph, the lifecycle, the prop filter and rendered pixels. The pixel tests assert measured properties (coverage, thickness, occlusion, depth) rather than comparing against image baselines, so none are shipped.

Development

just sync         # fetch the VTK wheel SDK, build both variants, install with the dev extras
just test vtk     # pytest against stock VTK
just test cvista  # pytest against cvista
just lint         # pre-commit

A C++17 compiler and CMake are required. cvista-sdk supplies the headers and CMake config for the cvista build; scripts/fetch_vtk_sdk.py downloads Kitware's wheel SDK for the stock build into build/vtk-sdk/. Without that SDK the package still builds, carrying the cvista variant only.

The passes themselves are backend-neutral C++; pyvista_render_passes.backend_module('vtkRenderingOpenGL2') returns the active distribution's module for code that needs VTK classes without choosing one.

Download files

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

Source Distribution

pyvista_render_passes-0.1.0.tar.gz (3.9 MB view details)

Uploaded Source

Built Distributions

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

pyvista_render_passes-0.1.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (203.0 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pyvista_render_passes-0.1.0-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (199.0 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

pyvista_render_passes-0.1.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (203.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pyvista_render_passes-0.1.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (198.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

pyvista_render_passes-0.1.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (203.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pyvista_render_passes-0.1.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (198.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

pyvista_render_passes-0.1.0-cp312-abi3-macosx_11_0_arm64.whl (90.7 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: pyvista_render_passes-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pyvista_render_passes-0.1.0.tar.gz
Algorithm Hash digest
SHA256 69343770c12192638baf529917845e14d570196bf1d2ca7fdcabea57d483f95a
MD5 a627d8c3d1a7a60b4d2a8f95024e8e08
BLAKE2b-256 1a2633ac445e9bd854d471f6106f6fc6ca6d49c4dbb318ccdc76e45ef84722a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvista_render_passes-0.1.0.tar.gz:

Publisher: release.yml on codimensional/pyvista-render-passes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvista_render_passes-0.1.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyvista_render_passes-0.1.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 acda176cfc4a2ea2f517d1c251e283d0da86e19dcb0af48fe3ac2ff9ca1097f2
MD5 7baf2044b4cc30af19cad4388f143865
BLAKE2b-256 21f95f1de51bb85ff6b2319e2fe7fba5dfde5577966547ca3570936ef0fae4ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvista_render_passes-0.1.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on codimensional/pyvista-render-passes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvista_render_passes-0.1.0-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pyvista_render_passes-0.1.0-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e6cc602f08c184f60707e6b9d084614cabadc25536201598e04ceaa7d463f4c3
MD5 184bad1da85102f032adfc59edb6acbc
BLAKE2b-256 5a57c5c1909ac868b4bb9514286331c370631875a4956a6e5c372ea2fa208d30

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvista_render_passes-0.1.0-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl:

Publisher: release.yml on codimensional/pyvista-render-passes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvista_render_passes-0.1.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyvista_render_passes-0.1.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e31b8ca9773ae6d4250d7c324b0b458f5e124e0a997c5bd836b1306e8606b872
MD5 0381ec0d278b695cd25fd5a7ce1a6378
BLAKE2b-256 6f40d2c02a00a1a790c5975625c0019abdef5fdf365097a3407382050c728a94

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvista_render_passes-0.1.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on codimensional/pyvista-render-passes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvista_render_passes-0.1.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pyvista_render_passes-0.1.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d37feeb60c55027728a13e45cd3e965270b406351f32079b7843c0e54097f3a4
MD5 32c7e5203854900fd3fd98715bf19cab
BLAKE2b-256 ca64f4df649fc29f58aece68a49f34f54659e0ef19384a4cf606a90cd40fea07

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvista_render_passes-0.1.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl:

Publisher: release.yml on codimensional/pyvista-render-passes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvista_render_passes-0.1.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyvista_render_passes-0.1.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9c82f667d55778153f72d3435513dc70160f65fbc8d33691567d0caf59f80b11
MD5 e3a6e5dd1f7948fbb7de92476c6105e2
BLAKE2b-256 1cc5f230c997d70ba79a81f3bb42c44358c21c2a00928a8837fa357e1fc17ac7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvista_render_passes-0.1.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on codimensional/pyvista-render-passes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvista_render_passes-0.1.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pyvista_render_passes-0.1.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5770dd89d6acd57c76bb828e7012b369c337e8d3383e5819df4168fc79262016
MD5 5124563152218ea6aae855c28c966845
BLAKE2b-256 1214ead3349c4106ee62bdca37fdd009dc40978e392b0d05079342c1e5cd2fac

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvista_render_passes-0.1.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl:

Publisher: release.yml on codimensional/pyvista-render-passes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvista_render_passes-0.1.0-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyvista_render_passes-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f6e87e884caccb5e46ebf65c460e7d2fad58f48f0bd032ba0fc86b145e08dd2a
MD5 7a7db42996f3f13c688c65e4f27e866e
BLAKE2b-256 82ce8a6b1370eeebf5b280ba2da1b802dd9821f9eb171d15887075e4f111a593

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvista_render_passes-0.1.0-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on codimensional/pyvista-render-passes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.0

11 files

0.1.2

11 files

0.1.1

8 files

This release

0.1.0 This release

8 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page