Easy-to-use Python renderer for 3D visualization
Project description
Pyrender
[!NOTE] This is a fork of pyrender by Matthew Matl, updated for compatibility with numpy v2. Install via
pip install pyrender2, but you stillimport pyrender, meaning your existing python code will just work if you switch to this fork (pip uninstall pyrender->pip install pyrender2).
Pyrender is a pure Python 3 library for physically-based rendering and visualization. It is designed to meet the glTF 2.0 specification from Khronos.
Pyrender is lightweight, easy to install, and simple to use. It comes packaged with both an intuitive scene viewer and a headache-free offscreen renderer with support for GPU-accelerated rendering on headless servers, which makes it perfect for machine learning applications.
Extensive documentation, including a quickstart guide, is provided here.
For a minimal working example of GPU-accelerated offscreen rendering using EGL, check out the EGL Google CoLab Notebook.
Installation
You can install pyrender directly from pip.
pip install pyrender2
Features
Despite being lightweight, pyrender has lots of features, including:
- Simple interoperation with the amazing trimesh project, which enables out-of-the-box support for dozens of mesh types, including OBJ, STL, DAE, OFF, PLY, and GLB.
- An easy-to-use scene viewer with support for animation, showing face and vertex normals, toggling lighting conditions, and saving images and GIFs.
- An offscreen rendering module that supports OSMesa and EGL backends.
- Shadow mapping for directional and spot lights.
- Metallic-roughness materials for physically-based rendering, including several types of texture and normal mapping.
- Transparency.
- Depth and color image generation.
Sample Usage
For sample usage, check out the quickstart guide or one of the Google CoLab Notebooks:
Viewer Keyboard and Mouse Controls
When using the viewer, the basic controls for moving about the scene are as follows:
- To rotate the camera about the center of the scene, hold the left mouse button and drag the cursor.
- To rotate the camera about its viewing axis, hold
CTRLleft mouse button and drag the cursor. - To pan the camera, do one of the following:
- Hold
SHIFT, then hold the left mouse button and drag the cursor. - Hold the middle mouse button and drag the cursor.
- Hold
- To zoom the camera in or out, do one of the following:
- Scroll the mouse wheel.
- Hold the right mouse button and drag the cursor.
The available keyboard commands are as follows:
a: Toggles rotational animation mode.c: Toggles backface culling.f: Toggles fullscreen mode.h: Toggles shadow rendering.i: Toggles axis display mode (no axes, world axis, mesh axes, all axes).l: Toggles lighting mode (scene lighting, Raymond lighting, or direct lighting).m: Toggles face normal visualization.n: Toggles vertex normal visualization.o: Toggles orthographic camera mode.q: Quits the viewer.r: Starts recording a GIF, and pressing again stops recording and opens a file dialog.s: Opens a file dialog to save the current view as an image.w: Toggles wireframe mode (scene default, flip wireframes, all wireframe, or all solid).z: Resets the camera to the default view.
As a note, displaying shadows significantly slows down rendering, so if you're experiencing low framerates, just kill shadows or reduce the number of lights in your scene.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyrender2-0.2.1.tar.gz.
File metadata
- Download URL: pyrender2-0.2.1.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
794334c31684bfffcd4830d199b9daab7331f28514464c79210f9fc08163db10
|
|
| MD5 |
c84ffdf40136be9316b57558d91c07ca
|
|
| BLAKE2b-256 |
a7f200e92f3c887de7392d9a95b6390427fd2c2c06ba913b86d72e0e9c01936a
|
Provenance
The following attestation bundles were made for pyrender2-0.2.1.tar.gz:
Publisher:
publish.yml on jasper-tms/pyrender
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrender2-0.2.1.tar.gz -
Subject digest:
794334c31684bfffcd4830d199b9daab7331f28514464c79210f9fc08163db10 - Sigstore transparency entry: 1285786483
- Sigstore integration time:
-
Permalink:
jasper-tms/pyrender@aa9b24727b710c71cf5cbfd14bb60748f7bb7fd9 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jasper-tms
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aa9b24727b710c71cf5cbfd14bb60748f7bb7fd9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyrender2-0.2.1-py3-none-any.whl.
File metadata
- Download URL: pyrender2-0.2.1-py3-none-any.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03ce45bf78a71098aa69c23f0a717b31c183d982963c263519354d9816fc1e9c
|
|
| MD5 |
3c5bccbaab094edfee5f05d41cbfe64f
|
|
| BLAKE2b-256 |
f82f7b40ad505b88d1db8f43b12215efeb7309aaadedf8416272945ec32bddd3
|
Provenance
The following attestation bundles were made for pyrender2-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on jasper-tms/pyrender
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrender2-0.2.1-py3-none-any.whl -
Subject digest:
03ce45bf78a71098aa69c23f0a717b31c183d982963c263519354d9816fc1e9c - Sigstore transparency entry: 1285786575
- Sigstore integration time:
-
Permalink:
jasper-tms/pyrender@aa9b24727b710c71cf5cbfd14bb60748f7bb7fd9 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jasper-tms
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aa9b24727b710c71cf5cbfd14bb60748f7bb7fd9 -
Trigger Event:
push
-
Statement type: