Skip to main content

pysdic-blender

Rendering of synthetic images for pysdic with Blender (Cycles): shading, shadows and the reflections of materials, as a complement of pysdic.generate_synthetic_image (exact gray levels of the texture, without lighting).

Documentation: https://Artezaru.github.io/pysdic-blender

Why a separate package

Blender as a Python module (bpy) supports exactly one version of Python per release of Blender (Blender 5.3: Python 3.13). Keeping it out of pysdic lets pysdic support several versions of Python, while pysdic-blender follows the version of Python of Blender.

Installation

python3.13 -m venv .venv && source .venv/bin/activate
pip install pysdic-blender   # installs pysdic and bpy

On a Linux server without display (e.g. a CI runner), bpy may need some system libraries:

sudo apt-get install -y libegl1 libgl1 libgomp1 \
  libx11-6 libxrender1 libxi6 libxxf86vm1 libxfixes3 libxkbcommon0 libsm6 libice6

Usage

import pysdic_blender  # First: see "Import order" below
from pysdic_blender import (BlenderCamera, BlenderExperiment, BlenderMesh, BlenderSpotLight,
                            get_matte_paint_material)

experiment = BlenderExperiment(background_strength=0.1)
experiment.add_camera("left", BlenderCamera(left_camera))      # pysdic.Camera, OpenCV pinhole model
experiment.add_spotlight("spot", BlenderSpotLight.looking_at([0, -200, 600], [0, 0, 0], energy=5e5))
experiment.add_mesh("specimen", BlenderMesh(mesh, texture=speckle), material=get_matte_paint_material())

for frame, displacement in enumerate(displacements):
    experiment.update_mesh("specimen", BlenderMesh(mesh, displacement=displacement))
    intensity = experiment.render("left", n_samples=256)   # (H, W) linear intensity

Requirements on the pysdic objects:

  • the camera: PerspectiveExtrinsic, PinholeIntrinsic without skew, no distortion (render without the distortion, then apply it with pysdic.distort_image);
  • the mesh: a 3D triangle_3 mesh (with a UV map for a texture).

Import order

bpy is imported when pysdic_blender is loaded. bpy and open3d (used by pysdic for the ray casting) both bundle the library TBB, and the older version of open3d breaks bpy if it is loaded first (undefined symbol in libopenvdb). Import pysdic_blender at the top of your scripts, before any ray casting with pysdic (Mesh.cast_rays, generate_synthetic_image with a 3D mesh, ...). import pysdic before import pysdic_blender is fine: pysdic imports open3d only at the first ray casting.

Metadata

Release files for pysdic-blender 1.3.0

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

Source distribution (sdist)

Source distribution for pysdic-blender 1.3.0
File Size Uploaded Provenance Actions
pysdic_blender-1.3.0.tar.gz 61.2 kB Without provenance Details for pysdic_blender-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pysdic-blender 1.3.0
File Interpreter ABI Platform Actions
pysdic_blender-1.3.0-py3-none-any.whl Python 3 none any Details for pysdic_blender-1.3.0-py3-none-any.whl

Total release size: 126.3 kB

Release files / pysdic_blender-1.3.0.tar.gz

Download URL pysdic_blender-1.3.0.tar.gz
Size 61.2 kB
Tags Source
SHA-256 checksum
How to use checksums
db01ebb991df5840abe08581330e8c9f190ee82bda78e480cde09fb78860bc51
BLAKE2b-256 checksum
How to use checksums
f25291cc1a12798689c8d7dc5f4a3aba86844650502e1e2d16bbc20cd79d9b42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

Release files / pysdic_blender-1.3.0-py3-none-any.whl

Download URL pysdic_blender-1.3.0-py3-none-any.whl
Size 65.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dbcdac2929a985f462e6f9fa89b47019ea8720493026d4cd2789dfcfe8a9ad61
BLAKE2b-256 checksum
How to use checksums
0fba124bb8ea9acfc2a8e314de5a9900fe347f18d7993a059bbab16fbbaa6b02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

Security for pysdic-blender 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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