scikit-robot-pyrender 0.1.46__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scikit_robot_pyrender-0.1.46/LICENSE +22 -0
- scikit_robot_pyrender-0.1.46/MANIFEST.in +5 -0
- scikit_robot_pyrender-0.1.46/PKG-INFO +55 -0
- scikit_robot_pyrender-0.1.46/README.md +103 -0
- scikit_robot_pyrender-0.1.46/pyproject.toml +42 -0
- scikit_robot_pyrender-0.1.46/pyrender/__init__.py +50 -0
- scikit_robot_pyrender-0.1.46/pyrender/camera.py +439 -0
- scikit_robot_pyrender-0.1.46/pyrender/constants.py +149 -0
- scikit_robot_pyrender-0.1.46/pyrender/font.py +273 -0
- scikit_robot_pyrender-0.1.46/pyrender/fonts/OpenSans-Bold.ttf +0 -0
- scikit_robot_pyrender-0.1.46/pyrender/fonts/OpenSans-BoldItalic.ttf +0 -0
- scikit_robot_pyrender-0.1.46/pyrender/fonts/OpenSans-ExtraBold.ttf +0 -0
- scikit_robot_pyrender-0.1.46/pyrender/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- scikit_robot_pyrender-0.1.46/pyrender/fonts/OpenSans-Italic.ttf +0 -0
- scikit_robot_pyrender-0.1.46/pyrender/fonts/OpenSans-Light.ttf +0 -0
- scikit_robot_pyrender-0.1.46/pyrender/fonts/OpenSans-LightItalic.ttf +0 -0
- scikit_robot_pyrender-0.1.46/pyrender/fonts/OpenSans-Regular.ttf +0 -0
- scikit_robot_pyrender-0.1.46/pyrender/fonts/OpenSans-Semibold.ttf +0 -0
- scikit_robot_pyrender-0.1.46/pyrender/fonts/OpenSans-SemiboldItalic.ttf +0 -0
- scikit_robot_pyrender-0.1.46/pyrender/light.py +385 -0
- scikit_robot_pyrender-0.1.46/pyrender/material.py +709 -0
- scikit_robot_pyrender-0.1.46/pyrender/mesh.py +328 -0
- scikit_robot_pyrender-0.1.46/pyrender/node.py +262 -0
- scikit_robot_pyrender-0.1.46/pyrender/offscreen.py +160 -0
- scikit_robot_pyrender-0.1.46/pyrender/opengl_utils.py +135 -0
- scikit_robot_pyrender-0.1.46/pyrender/platforms/__init__.py +6 -0
- scikit_robot_pyrender-0.1.46/pyrender/platforms/base.py +76 -0
- scikit_robot_pyrender-0.1.46/pyrender/platforms/egl.py +232 -0
- scikit_robot_pyrender-0.1.46/pyrender/platforms/osmesa.py +61 -0
- scikit_robot_pyrender-0.1.46/pyrender/platforms/pyglet_platform.py +123 -0
- scikit_robot_pyrender-0.1.46/pyrender/primitive.py +492 -0
- scikit_robot_pyrender-0.1.46/pyrender/renderer.py +1337 -0
- scikit_robot_pyrender-0.1.46/pyrender/sampler.py +102 -0
- scikit_robot_pyrender-0.1.46/pyrender/scene.py +588 -0
- scikit_robot_pyrender-0.1.46/pyrender/shader_program.py +283 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/debug_quad.frag +23 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/debug_quad.vert +25 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/flat.frag +126 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/flat.vert +86 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/mesh.frag +456 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/mesh.vert +86 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/mesh_depth.frag +8 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/mesh_depth.vert +13 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/segmentation.frag +13 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/segmentation.vert +14 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/text.frag +12 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/text.vert +12 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/vertex_normals.frag +10 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/vertex_normals.geom +74 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/vertex_normals.vert +27 -0
- scikit_robot_pyrender-0.1.46/pyrender/shaders/vertex_normals_pc.geom +29 -0
- scikit_robot_pyrender-0.1.46/pyrender/texture.py +258 -0
- scikit_robot_pyrender-0.1.46/pyrender/trackball.py +215 -0
- scikit_robot_pyrender-0.1.46/pyrender/utils.py +115 -0
- scikit_robot_pyrender-0.1.46/pyrender/viewer.py +1190 -0
- scikit_robot_pyrender-0.1.46/scikit_robot_pyrender.egg-info/PKG-INFO +55 -0
- scikit_robot_pyrender-0.1.46/scikit_robot_pyrender.egg-info/SOURCES.txt +60 -0
- scikit_robot_pyrender-0.1.46/scikit_robot_pyrender.egg-info/dependency_links.txt +1 -0
- scikit_robot_pyrender-0.1.46/scikit_robot_pyrender.egg-info/requires.txt +22 -0
- scikit_robot_pyrender-0.1.46/scikit_robot_pyrender.egg-info/top_level.txt +1 -0
- scikit_robot_pyrender-0.1.46/setup.cfg +4 -0
- scikit_robot_pyrender-0.1.46/setup.py +78 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Matthew Matl
|
|
4
|
+
Copyright (c) 2025 Iori Yanokura
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: scikit-robot-pyrender
|
|
3
|
+
Version: 0.1.46
|
|
4
|
+
Summary: Easy-to-use Python renderer for 3D visualization
|
|
5
|
+
Home-page: https://github.com/iory/scikit-robot-pyrender
|
|
6
|
+
Author: Matthew Matl (original), Iori Yanokura (fork)
|
|
7
|
+
Author-email: yanokura@jsk.imi.i.u-tokyo.ac.jp
|
|
8
|
+
License: MIT License
|
|
9
|
+
Keywords: rendering graphics opengl 3d visualization pbr gltf
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Natural Language :: English
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: freetype-py
|
|
24
|
+
Requires-Dist: imageio
|
|
25
|
+
Requires-Dist: networkx
|
|
26
|
+
Requires-Dist: numpy
|
|
27
|
+
Requires-Dist: Pillow
|
|
28
|
+
Requires-Dist: pyglet>=1.4.10
|
|
29
|
+
Requires-Dist: PyOpenGL~=3.1.0
|
|
30
|
+
Requires-Dist: scipy
|
|
31
|
+
Requires-Dist: six
|
|
32
|
+
Requires-Dist: trimesh
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: flake8; extra == "dev"
|
|
35
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
38
|
+
Requires-Dist: tox; extra == "dev"
|
|
39
|
+
Provides-Extra: docs
|
|
40
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
41
|
+
Requires-Dist: sphinx_rtd_theme; extra == "docs"
|
|
42
|
+
Requires-Dist: sphinx-automodapi; extra == "docs"
|
|
43
|
+
Dynamic: author
|
|
44
|
+
Dynamic: author-email
|
|
45
|
+
Dynamic: classifier
|
|
46
|
+
Dynamic: description
|
|
47
|
+
Dynamic: home-page
|
|
48
|
+
Dynamic: keywords
|
|
49
|
+
Dynamic: license
|
|
50
|
+
Dynamic: license-file
|
|
51
|
+
Dynamic: provides-extra
|
|
52
|
+
Dynamic: requires-dist
|
|
53
|
+
Dynamic: summary
|
|
54
|
+
|
|
55
|
+
A simple implementation of Physically-Based Rendering (PBR) in Python. Compliant with the glTF 2.0 standard. This is a fork of pyrender with improved OpenGL fallback capabilities.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# scikit-robot-pyrender
|
|
2
|
+
|
|
3
|
+
[](https://github.com/iory/scikit-robot-pyrender/actions/workflows/test.yml)
|
|
4
|
+
[](https://badge.fury.io/py/scikit-robot-pyrender)
|
|
5
|
+
|
|
6
|
+
A fork of [pyrender](https://github.com/mmatl/pyrender) with enhanced OpenGL compatibility.
|
|
7
|
+
|
|
8
|
+
This package provides improved OpenGL fallback capabilities, making it more reliable on various systems including:
|
|
9
|
+
- WSL2 environments
|
|
10
|
+
- Systems with limited OpenGL support
|
|
11
|
+
- Headless servers
|
|
12
|
+
- Virtual machines
|
|
13
|
+
|
|
14
|
+
## Key Improvements
|
|
15
|
+
|
|
16
|
+
- **Robust OpenGL fallback**: Automatically falls back from OpenGL 4.1 → 4.0 → 3.3 with software rendering as needed
|
|
17
|
+
- **WSL2 support**: Enhanced compatibility with Windows Subsystem for Linux
|
|
18
|
+
- **Better error reporting**: Detailed troubleshooting information for OpenGL issues
|
|
19
|
+
- **Automatic software rendering**: Enables software rendering when hardware acceleration fails
|
|
20
|
+
|
|
21
|
+
scikit-robot-pyrender is a pure Python library for physically-based
|
|
22
|
+
rendering and visualization, designed to meet the [glTF 2.0 specification from Khronos](https://www.khronos.org/gltf/).
|
|
23
|
+
|
|
24
|
+
The library is lightweight, easy to install, and simple to use.
|
|
25
|
+
It comes packaged with both an intuitive scene viewer and a headache-free
|
|
26
|
+
offscreen renderer with support for GPU-accelerated rendering on headless
|
|
27
|
+
servers, which makes it perfect for machine learning applications.
|
|
28
|
+
|
|
29
|
+
Extensive documentation, including a quickstart guide, is provided [here](https://pyrender.readthedocs.io/en/latest/).
|
|
30
|
+
|
|
31
|
+
For a minimal working example of GPU-accelerated offscreen rendering using EGL,
|
|
32
|
+
check out the [EGL Google CoLab Notebook](https://colab.research.google.com/drive/1pcndwqeY8vker3bLKQNJKr3B-7-SYenE?usp=sharing).
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<img width="48%" src="https://github.com/mmatl/pyrender/blob/master/docs/source/_static/rotation.gif?raw=true" alt="GIF of Viewer"/>
|
|
37
|
+
<img width="48%" src="https://github.com/mmatl/pyrender/blob/master/docs/source/_static/damaged_helmet.png?raw=true" alt="Damaged Helmet"/>
|
|
38
|
+
</p>
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
You can install pyrender directly from pip.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install pyrender
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
Despite being lightweight, pyrender has lots of features, including:
|
|
50
|
+
|
|
51
|
+
* Simple interoperation with the amazing [trimesh](https://github.com/mikedh/trimesh) project,
|
|
52
|
+
which enables out-of-the-box support for dozens of mesh types, including OBJ,
|
|
53
|
+
STL, DAE, OFF, PLY, and GLB.
|
|
54
|
+
* An easy-to-use scene viewer with support for animation, showing face and vertex
|
|
55
|
+
normals, toggling lighting conditions, and saving images and GIFs.
|
|
56
|
+
* An offscreen rendering module that supports OSMesa and EGL backends.
|
|
57
|
+
* Shadow mapping for directional and spot lights.
|
|
58
|
+
* Metallic-roughness materials for physically-based rendering, including several
|
|
59
|
+
types of texture and normal mapping.
|
|
60
|
+
* Transparency.
|
|
61
|
+
* Depth and color image generation.
|
|
62
|
+
|
|
63
|
+
## Sample Usage
|
|
64
|
+
|
|
65
|
+
For sample usage, check out the [quickstart
|
|
66
|
+
guide](https://pyrender.readthedocs.io/en/latest/examples/index.html) or one of
|
|
67
|
+
the Google CoLab Notebooks:
|
|
68
|
+
|
|
69
|
+
* [EGL Google CoLab Notebook](https://colab.research.google.com/drive/1pcndwqeY8vker3bLKQNJKr3B-7-SYenE?usp=sharing)
|
|
70
|
+
|
|
71
|
+
## Viewer Keyboard and Mouse Controls
|
|
72
|
+
|
|
73
|
+
When using the viewer, the basic controls for moving about the scene are as follows:
|
|
74
|
+
|
|
75
|
+
* To rotate the camera about the center of the scene, hold the left mouse button and drag the cursor.
|
|
76
|
+
* To rotate the camera about its viewing axis, hold `CTRL` left mouse button and drag the cursor.
|
|
77
|
+
* To pan the camera, do one of the following:
|
|
78
|
+
* Hold `SHIFT`, then hold the left mouse button and drag the cursor.
|
|
79
|
+
* Hold the middle mouse button and drag the cursor.
|
|
80
|
+
* To zoom the camera in or out, do one of the following:
|
|
81
|
+
* Scroll the mouse wheel.
|
|
82
|
+
* Hold the right mouse button and drag the cursor.
|
|
83
|
+
|
|
84
|
+
The available keyboard commands are as follows:
|
|
85
|
+
|
|
86
|
+
* `a`: Toggles rotational animation mode.
|
|
87
|
+
* `c`: Toggles backface culling.
|
|
88
|
+
* `f`: Toggles fullscreen mode.
|
|
89
|
+
* `h`: Toggles shadow rendering.
|
|
90
|
+
* `i`: Toggles axis display mode (no axes, world axis, mesh axes, all axes).
|
|
91
|
+
* `l`: Toggles lighting mode (scene lighting, Raymond lighting, or direct lighting).
|
|
92
|
+
* `m`: Toggles face normal visualization.
|
|
93
|
+
* `n`: Toggles vertex normal visualization.
|
|
94
|
+
* `o`: Toggles orthographic camera mode.
|
|
95
|
+
* `q`: Quits the viewer.
|
|
96
|
+
* `r`: Starts recording a GIF, and pressing again stops recording and opens a file dialog.
|
|
97
|
+
* `s`: Opens a file dialog to save the current view as an image.
|
|
98
|
+
* `w`: Toggles wireframe mode (scene default, flip wireframes, all wireframe, or all solid).
|
|
99
|
+
* `z`: Resets the camera to the default view.
|
|
100
|
+
|
|
101
|
+
As a note, displaying shadows significantly slows down rendering, so if you're
|
|
102
|
+
experiencing low framerates, just kill shadows or reduce the number of lights in
|
|
103
|
+
your scene.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[tool.ruff]
|
|
2
|
+
# Exclude directories from linting
|
|
3
|
+
extend-exclude = [".?*", "src/", "build", "docs", "examples", "tests"]
|
|
4
|
+
line-length = 120
|
|
5
|
+
|
|
6
|
+
[tool.ruff.lint]
|
|
7
|
+
preview = true
|
|
8
|
+
|
|
9
|
+
# Enable flake8-style rules
|
|
10
|
+
select = [
|
|
11
|
+
"E", # style errors
|
|
12
|
+
"F", # flakes
|
|
13
|
+
"W", # style warnings
|
|
14
|
+
"G", # flake8-logging-format
|
|
15
|
+
"I", # import sorting
|
|
16
|
+
]
|
|
17
|
+
# Ignore specific rules to match current flake8 config
|
|
18
|
+
ignore = [
|
|
19
|
+
"E741", # ambiguous variable name
|
|
20
|
+
"F403", # `from OpenGL.GL import *` used; unable to detect undefined names
|
|
21
|
+
"F405", # may be undefined, or defined from star imports
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[tool.ruff.lint.per-file-ignores]
|
|
25
|
+
"pyrender/platforms/egl.py" = ["E402"] # Module level import not at top of file (required for EGL setup)
|
|
26
|
+
|
|
27
|
+
[tool.ruff.lint.isort]
|
|
28
|
+
# Match current isort configuration
|
|
29
|
+
force-single-line = true
|
|
30
|
+
force-sort-within-sections = true
|
|
31
|
+
order-by-type = false
|
|
32
|
+
lines-after-imports = 2
|
|
33
|
+
|
|
34
|
+
[tool.typos]
|
|
35
|
+
default.extend-ignore-re = [
|
|
36
|
+
"(?Rm)^.*(#|//)\\s*spellchecker:disable-line$", # spellchecker:disable-line
|
|
37
|
+
"(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on", # spellchecker:<on|off>
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
default.extend-ignore-identifiers-re = [
|
|
41
|
+
# Add individual words here to ignore them
|
|
42
|
+
]
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
from .camera import Camera
|
|
4
|
+
from .camera import IntrinsicsCamera
|
|
5
|
+
from .camera import OrthographicCamera
|
|
6
|
+
from .camera import PerspectiveCamera
|
|
7
|
+
from .constants import GLTF
|
|
8
|
+
from .constants import RenderFlags
|
|
9
|
+
from .constants import TextAlign
|
|
10
|
+
from .light import DirectionalLight
|
|
11
|
+
from .light import Light
|
|
12
|
+
from .light import PointLight
|
|
13
|
+
from .light import SpotLight
|
|
14
|
+
from .material import Material
|
|
15
|
+
from .material import MetallicRoughnessMaterial
|
|
16
|
+
from .mesh import Mesh
|
|
17
|
+
from .node import Node
|
|
18
|
+
from .offscreen import OffscreenRenderer
|
|
19
|
+
from .primitive import Primitive
|
|
20
|
+
from .renderer import Renderer
|
|
21
|
+
from .sampler import Sampler
|
|
22
|
+
from .scene import Scene
|
|
23
|
+
from .texture import Texture
|
|
24
|
+
from .viewer import Viewer
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def determine_version(module_name):
|
|
28
|
+
"""Determine version of the package."""
|
|
29
|
+
if (sys.version_info[0] == 3 and sys.version_info[1] >= 8) \
|
|
30
|
+
or sys.version_info[0] > 3:
|
|
31
|
+
import importlib.metadata
|
|
32
|
+
return importlib.metadata.version(module_name)
|
|
33
|
+
else:
|
|
34
|
+
import pkg_resources
|
|
35
|
+
return pkg_resources.get_distribution(module_name).version
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
try:
|
|
39
|
+
__version__ = determine_version('scikit-robot-pyrender')
|
|
40
|
+
except Exception:
|
|
41
|
+
__version__ = '0.1.45' # fallback version
|
|
42
|
+
|
|
43
|
+
__all__ = [
|
|
44
|
+
'Camera', 'PerspectiveCamera', 'OrthographicCamera', 'IntrinsicsCamera',
|
|
45
|
+
'Light', 'PointLight', 'DirectionalLight', 'SpotLight',
|
|
46
|
+
'Sampler', 'Texture', 'Material', 'MetallicRoughnessMaterial',
|
|
47
|
+
'Primitive', 'Mesh', 'Node', 'Scene', 'Renderer', 'Viewer',
|
|
48
|
+
'OffscreenRenderer', '__version__', 'RenderFlags', 'TextAlign',
|
|
49
|
+
'GLTF'
|
|
50
|
+
]
|