pyvale.render.blender package¶
Submodules¶
- pyvale.render.blender.adapter module
- pyvale.render.blender.blendertools module
- pyvale.render.blender.calibration module
- pyvale.render.blender.config module
EBlenderEngineEBlenderDeviceBlenderConfigBlenderConfig.output_dirBlenderConfig.engineBlenderConfig.deviceBlenderConfig.samplesBlenderConfig.max_bouncesBlenderConfig.threadsBlenderConfig.render_deformedBlenderConfig.save_imagesBlenderConfig.save_sceneBlenderConfig.seedBlenderConfig.use_denoisingBlenderConfig.use_adaptive_samplingBlenderConfig.__init__()
- pyvale.render.blender.shader module
Module contents¶
Blender implementation of pyvale’s unified renderer API.
- class Blender(config)[source]¶
Bases:
IRenderer3DRender common scene data and deformation frames in Blender.
- capabilities = RenderCapabilities(element_types=frozenset({<EElemType.TRI3: 'tri3'>}), supports_lights=True, supports_camera_distortion=False, supports_psf=False)¶
- class BlenderCalibrationData(angle_lims=(-10.0, 10.0), angle_step=5.0, plunge_lims=(-5.0, 5.0), plunge_step=5.0, x_limit=None, y_limit=None, max_images=None)[source]¶
Bases:
objectDescribe the pose sweep used to render a camera calibration target.
- Parameters:
angle_lims (
tuple[float,float], optional) – Inclusive lower and upper target-angle limits in degrees.angle_step (
float, optional) – Angular increment in degrees.plunge_lims (
tuple[float,float], optional) – Inclusive lower and upper target-depth limits.plunge_step (
float, optional) – Target-depth increment.x_limit (
floatorNone, optional) – Optional lateral target-position limits retained for calibration scene generation.y_limit (
floatorNone, optional) – Optional lateral target-position limits retained for calibration scene generation.max_images (
intorNone, optional) – Maximum number of TIFF files to render.Nonerenders every pose.
- angle_lims¶
- angle_step¶
- plunge_lims¶
- plunge_step¶
- x_limit¶
- y_limit¶
- max_images¶
- __init__(angle_lims=(-10.0, 10.0), angle_step=5.0, plunge_lims=(-5.0, 5.0), plunge_step=5.0, x_limit=None, y_limit=None, max_images=None)¶
- class BlenderCalibrationTarget(size, image_path, millimetres_per_pixel, material=<factory>)[source]¶
Bases:
objectA textured planar target used to generate calibration images.
- Parameters:
size (
numpy.ndarray) – Target width, height, and thickness in world units.image_path (
pathlib.Path) – Calibration-target texture image.millimetres_per_pixel (
float) – Texture resolution used by Blender UV unwrapping.material (
BlenderMaterial, optional) – Backend-owned material controls for the target.
- size¶
- image_path¶
- millimetres_per_pixel¶
- material¶
- __init__(size, image_path, millimetres_per_pixel, material=<factory>)¶
- class BlenderConfig(output_dir, engine=EBlenderEngine.CYCLES, device=EBlenderDevice.CPU, samples=2, max_bounces=12, threads=1, render_deformed=False, save_images=False, save_scene=False, seed=0, use_denoising=True, use_adaptive_sampling=True)[source]¶
Bases:
objectStable Blender controls accepted by the unified adapter.
- Parameters:
output_dir (
pathlib.Path) – Directory used for optional TIFF and Blender-project outputs.engine (
EBlenderEngine, optional) – Blender render engine.device (
EBlenderDevice, optional) – Cycles compute device. CPU is the reproducible regression default.samples (
int, optional) – Per-pixel render samples.max_bounces (
int, optional) – Cycles maximum light-bounce count.threads (
int, optional) – Blender render worker count.render_deformed (
bool, optional) – Render each nodal-displacement frame instead of a static scene.save_images (
bool, optional) – Persist TIFFs and return their paths rather than retaining image arrays.save_scene (
bool, optional) – Persist the constructed Blender scene as a.blendproject file.seed (
int, optional) – Fixed Cycles sampling seed used for reproducible rendering.use_denoising (
bool, optional) – Enable Cycles image denoising.use_adaptive_sampling (
bool, optional) – Enable Cycles adaptive sampling.
- output_dir¶
- engine¶
- device¶
- samples¶
- max_bounces¶
- threads¶
- render_deformed¶
- save_images¶
- save_scene¶
- seed¶
- use_denoising¶
- use_adaptive_sampling¶
- __init__(output_dir, engine=EBlenderEngine.CYCLES, device=EBlenderDevice.CPU, samples=2, max_bounces=12, threads=1, render_deformed=False, save_images=False, save_scene=False, seed=0, use_denoising=True, use_adaptive_sampling=True)¶
- class BlenderImageShader(image, millimetres_per_pixel, material=BlenderMaterial(roughness=1.0, metallic=0.0, interpolant='Cubic'))[source]¶
Bases:
objectIn-memory texture-image controls for a Blender mesh material.
- Parameters:
image (
numpy.ndarray) – Greyscale or RGBA image texture supplied directly to Blender.millimetres_per_pixel (
float) – Texture scale used by Blender UV unwrapping.material (
BlenderMaterial, optional) – Backend-owned principled material controls.
- image¶
- millimetres_per_pixel¶
- material¶
- __init__(image, millimetres_per_pixel, material=BlenderMaterial(roughness=1.0, metallic=0.0, interpolant='Cubic'))¶
- class BlenderMaterial(roughness=1.0, metallic=0.0, interpolant='Cubic')[source]¶
Bases:
objectPrincipled-material controls owned by the Blender backend.
- Parameters:
- roughness¶
- metallic¶
- interpolant¶
- __init__(roughness=1.0, metallic=0.0, interpolant='Cubic')¶
- class BlenderTextureShader(image_path, millimetres_per_pixel, material=BlenderMaterial(roughness=1.0, metallic=0.0, interpolant='Cubic'))[source]¶
Bases:
objectImage texture controls for a Blender mesh material.
- Parameters:
image_path (
pathlib.Path) – Speckle or surface texture image supplied to Blender.millimetres_per_pixel (
float) – Texture scale used by Blender UV unwrapping.material (
BlenderMaterial, optional) – Backend-owned principled material controls.
- image_path¶
- millimetres_per_pixel¶
- material¶
- __init__(image_path, millimetres_per_pixel, material=BlenderMaterial(roughness=1.0, metallic=0.0, interpolant='Cubic'))¶
- class EBlenderDevice(*values)[source]¶
Bases:
EnumCycles compute devices supported by the unified adapter.
- CPU = 'CPU'¶
- GPU = 'GPU'¶
- class EBlenderEngine(*values)[source]¶
Bases:
EnumBlender render engines supported by the unified adapter.
- CYCLES = 'CYCLES'¶
- EEVEE = 'BLENDER_EEVEE'¶
- WORKBENCH = 'BLENDER_WORKBENCH'¶
- blender_camera_from_resolution(pixels_num, pixels_size, working_dist, resolution)[source]¶
Create a perspective camera from working distance and resolution.
- blender_gpu_available()[source]¶
Return whether Blender reports a supported Cycles GPU device.
- Returns:
bool–Truewhen Blender’s Cycles preferences report a CUDA, OptiX, HIP, Metal, or oneAPI device.Falseif Blender is unavailable.
- blender_mm_per_pixel(camera)[source]¶
Calculate the horizontal world length represented by one pixel.
- calibration_image_count(data)[source]¶
Return the number of legacy Blender calibration-target images.
- Parameters:
data (
BlenderCalibrationData) – Calibration target pose-sweep configuration.- Returns:
int– Number of target poses in the historical nine-position lateral sweep.
- focal_length_from_resolution(pixels_size, working_dist, resolution)[source]¶
Calculate the focal length for a requested image resolution.
Raise RenderInputError if the optional Blender backend is missing.
- render_calibration_images(target, cameras, config, data=None, lights=None)[source]¶
Render a legacy-compatible Blender calibration-target pose sweep.
- Parameters:
target (
BlenderCalibrationTarget) – Textured physical calibration target.cameras (
Sequence[Camera]) – Exactly two perspective cameras defining the calibration rig.config (
BlenderConfig) – Blender engine, image output, and sampling controls.data (
BlenderCalibrationData, optional) – Target translation and rotation sweep controls.lights (
Sequence[Light]orNone, optional) – Optional scene lights.Nonepreserves Blender’s dark default world.
- Returns:
RenderResult– File-only result containing the calibration TIFF paths.- Raises:
RenderInputError – If input is invalid or the Blender backend is unavailable.