Skip to main content

pybullet_rendering

External rendering for PyBullet simulator.

Install

Using pip

pip install pybullet_rendering

From source code

Install NumPy

pip install numpy

Install PyBullet from source code

git clone https://github.com/bulletphysics/bullet3.git
cd bullet3
python setup.py install
export BULLET_ROOT_DIR="$PWD"

Install the package

cd ..
git clone https://github.com/ikalevatykh/pybullet_rendering.git
cd pybullet_rendering
python setup.py install --bullet_dir "$BULLET_ROOT_DIR"

Run tests

python -m unittest discover tests -v

Run examples

Example of using Panda3D for rendering in GUI mode:

python -m pybullet_rendering.examples.panda3d_gui --multisamples 8

Test performance of diferent renderers:

python -m pybullet_rendering.examples.performance

Renderers

This package provide example renderers based on Panda3D and pyrender.

Example of usage

import pybullet as pb
from pybullet_rendering import RenderingPlugin
from pybullet_rendering.render.panda3d import P3dRenderer # panda3d-based renderer
from pybullet_rendering.render.pyrender import PyrRenderer # pyrender-based renderer

client_id = pb.connect(pb.DIRECT)

# bind your renderer to pybullet
renderer = P3dRenderer(multisamples=4) # or PyrRenderer(platform='egl', egl_device=1)
plugin = RenderingPlugin(client_id, renderer)

# render thru the standard pybullet API
w, h, rgba, depth, mask = pb.getCameraImage(w, h, projectionMatrix=..., viewMatrix=...)

Implement your own renderer in Python

Your renderer should inherit from the BaseRenderer class and implement its update_scene and render_frame methods. To get an idea of their parameters, see examples and tests.

from pybullet_rendering import BaseRenderer

class MyRenderer(BaseRenderer):

    def __init__(self):
        """The base class initializer have to be called first."""
        BaseRenderer.__init__(self)

    def update_scene(self, scene_graph, materials_only):
        """Update a scene using scene_graph description

        Arguments:
            scene_graph {SceneGraph} -- scene description
            materials_only {bool} -- update only shape materials
        """
        for uid, pb_node in scene_graph.nodes.items():
            "update nodes of your scene"

    def render_frame(self, scene_state, scene_view, frame):
        """Render a scene at scene_state with a scene_view settings

        Arguments:
            scene_state {SceneState} --  scene state, e.g. transformations of all objects
            scene_view {SceneView} -- view settings, e.g. camera, light, viewport parameters
            frame {FrameData} -- output image buffer
        """
        w, h = scene_view.viewport        
        if return_to_bullet:
            frame.color_img[:] = ... # np.uint8, (h,w,4)
            frame.depth_img[:] = ... # np.float32 (h,w)
            frame.mask_img[:] = ... # np.int32 (h,w)
            return True

        return False  

Citation

If you find pybullet_rendering useful in your research, please cite the repository using the following BibTeX entry.

@Misc{kalevatykh2020pybullet_rendering,
  author =       {Kalevatykh, Igor et al.},
  title =        {pybullet_rendering - External rendering for the PyBullet simulator},
  howpublished = {Github},
  year =         {2020},
  url =          {https://github.com/ikalevatykh/pybullet_rendering}
}

License

mano_pybullet is released under the GPLv3 license.

Metadata

Release files for pybullet-rendering 0.6.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for pybullet-rendering 0.6.5
File
pybullet_rendering-0.6.5-cp39-cp39-manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
pybullet_rendering-0.6.5-cp38-cp38-manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
pybullet_rendering-0.6.5-cp37-cp37m-manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
pybullet_rendering-0.6.5-cp36-cp36m-manylinux2014_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 Details
pybullet_rendering-0.6.5-cp35-cp35m-manylinux2014_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.17+ x86-64 Details

Total release size: 16.6 MB

Release files / pybullet_rendering-0.6.5-cp39-cp39-manylinux2014_x86_64.whl

Download URL pybullet_rendering-0.6.5-cp39-cp39-manylinux2014_x86_64.whl
Size 3.2 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a17adc9b37e85e53910117d265f2f3f4f7af9dec86de4a21e588013da14d44b1
BLAKE2b-256 checksum
How to use checksums
06a578235f70711277d72ed3f7d21aa30f3c667c6ccf2198e4de8905e61ac179
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release files / pybullet_rendering-0.6.5-cp38-cp38-manylinux2014_x86_64.whl

Download URL pybullet_rendering-0.6.5-cp38-cp38-manylinux2014_x86_64.whl
Size 3.3 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
498e76de544cad53121c179f3bb71d4e67e64a905330e48c9cba0142e1b30d46
BLAKE2b-256 checksum
How to use checksums
49fc0c908a483f5c17539bf6ccabaa9e27f67889cf86461cd31fda36e9a19ee3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release files / pybullet_rendering-0.6.5-cp37-cp37m-manylinux2014_x86_64.whl

Download URL pybullet_rendering-0.6.5-cp37-cp37m-manylinux2014_x86_64.whl
Size 3.4 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
746bc9c03f82f8e33bdf937a33067168dedf87f10cc18e08d196de4f72a6ce02
BLAKE2b-256 checksum
How to use checksums
d8bbe590172485fb72f03d579f26966e30d784ebee03e3c49e72b51590771db5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release files / pybullet_rendering-0.6.5-cp36-cp36m-manylinux2014_x86_64.whl

Download URL pybullet_rendering-0.6.5-cp36-cp36m-manylinux2014_x86_64.whl
Size 3.4 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d688384c4911b7b5d0d2a704e79eb176e34d032ed05fa29b5764e9a406aef525
BLAKE2b-256 checksum
How to use checksums
ae47ba4e591b2819b17693ca417b2493c45fded3dbd098511eb2dfe288d2b0ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release files / pybullet_rendering-0.6.5-cp35-cp35m-manylinux2014_x86_64.whl

Download URL pybullet_rendering-0.6.5-cp35-cp35m-manylinux2014_x86_64.whl
Size 3.4 MB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e63c2f252622f0935fa6d7bc7ab486bc69182762fba7d2c7d0ef31692e0cff86
BLAKE2b-256 checksum
How to use checksums
03fe73d9df368ed81585afb8de6b0f99d2bb51a62d587a226de8796b63205e25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.6.5 This release

5 release files

0.6.3

5 release 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