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.2.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.2.0
File Size Uploaded Provenance Actions
pysdic_blender-1.2.0.tar.gz 45.7 kB Without provenance Details for pysdic_blender-1.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 97.3 kB

Release files / pysdic_blender-1.2.0.tar.gz

Download URL pysdic_blender-1.2.0.tar.gz
Size 45.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3e59cfa55dc501b2621ec5c9da90217634fb428ce1f71f0de2ee5b99fcf504cc
BLAKE2b-256 checksum
How to use checksums
f66678e3b888d1a86798f6efbf251f45fa5153c858cbde8f8e05e7a53b1a7871
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.2.0-py3-none-any.whl

Download URL pysdic_blender-1.2.0-py3-none-any.whl
Size 51.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7179f8eab4bbee75f6b05d82ac061b612d8d36bbe567107fc81564db0e89f9c7
BLAKE2b-256 checksum
How to use checksums
b462115cd7d11a4d5a2b98b895f2724dfbab9803411923da6dc75bb97e13c0b3
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.2.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